/* ─── AI Simulator — Mobile First ───────────────── */

.ai-sim {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    max-height: 500px;
}

/* Header */
.ai-sim__header {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    border-left: 3px solid;
    background: #fafafa;
}

.ai-sim__tool {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-sim__tool-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.ai-sim__tool-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ai-sim__tool-name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.ai-sim__badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-sim__badge--text {
    background: #eff6ff;
    color: #3b82f6;
}

.ai-sim__badge--image {
    background: #fef3c7;
    color: #d97706;
}

.ai-sim__title {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* Output / messages area */
.ai-sim__output {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 150px;
    max-height: 320px;
    background: #f9fafb;
}

.ai-sim__messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Message */
.ai-sim__msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ai-sim__msg--user {
    flex-direction: row-reverse;
}

.ai-sim__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.ai-sim__avatar--user {
    background: #e0e7ff;
    color: #4338ca;
}

.ai-sim__avatar--ai {
    background: #111827;
    color: #fff;
}

.ai-sim__msg-bubble {
    max-width: 85%;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.6;
}

.ai-sim__msg-bubble--user {
    background: #4f46e5;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-sim__msg-bubble--assistant {
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

/* Cursor animation */
.ai-sim__cursor {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: #4f46e5;
    margin-left: 2px;
    animation: blink 0.8s infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Code blocks */
.ai-sim__code {
    background: #1f2937;
    color: #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.5;
}

.ai-sim__inline-code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #dc2626;
}

/* Image output */
.ai-sim__image-wrap {
    border-radius: 8px;
    overflow: hidden;
    margin: 4px 0;
}

.ai-sim__image {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
    border-radius: 8px;
}

.ai-sim__revised {
    font-size: 11px;
    color: #6b7280;
    margin-top: 8px;
    font-style: italic;
}

.ai-sim__model-tag {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 6px;
}

.ai-sim__error {
    color: #dc2626;
    font-size: 13px;
    padding: 8px;
    background: #fef2f2;
    border-radius: 6px;
}

/* Loading spinner */
.ai-sim__loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7280;
    font-size: 13px;
    padding: 8px 0;
}

.ai-sim__spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Input area */
.ai-sim__input-area {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.ai-sim__input-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ai-sim__textarea {
    flex: 1;
    resize: none;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
    min-height: 40px;
    max-height: 120px;
}

.ai-sim__textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.ai-sim__textarea::placeholder {
    color: #9ca3af;
}

.ai-sim__send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.1s;
}

.ai-sim__send:hover {
    opacity: 0.9;
}

.ai-sim__send:active {
    transform: scale(0.95);
}

.ai-sim__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-sim__hint {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 6px;
}

/* ─── Responsive ──────────────────────────────────── */

/* Tablet and up */
@media (min-width: 768px) {
    .ai-sim {
        max-height: 560px;
    }

    .ai-sim__output {
        max-height: 380px;
    }

    .ai-sim__msg-bubble {
        font-size: 14px;
    }

    .ai-sim__image {
        max-width: 512px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .ai-sim {
        max-height: 620px;
    }

    .ai-sim__output {
        max-height: 440px;
    }
}
