/* ============================================
   Sanaa Chat — Polished AI assistant UI
   ============================================ */

.sanaa-chat-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(180deg, rgba(14, 17, 24, 0.98) 0%, rgba(10, 12, 18, 1) 100%);
    overflow: hidden;
}

.sanaa-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
}

.sanaa-chat-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sanaa-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #818cf8;
    flex-shrink: 0;
}

.sanaa-chat-avatar svg {
    width: 18px;
    height: 18px;
}

.sanaa-chat-title-wrap {
    min-width: 0;
}

.sanaa-chat-eyebrow {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 2px;
}

.sanaa-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.sanaa-chat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(63, 185, 80, 0.6);
    animation: sanaaChatPulse 2s ease-in-out infinite;
}

@keyframes sanaaChatPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.sanaa-chat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sanaa-chat-provider {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.sanaa-chat-provider:focus {
    border-color: rgba(99, 102, 241, 0.45);
}

.sanaa-chat-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sanaa-chat-icon-btn:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.sanaa-chat-icon-btn svg {
    width: 14px;
    height: 14px;
}

.sanaa-chat-prompts {
    display: flex;
    gap: 8px;
    padding: 10px 16px 0;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}

.sanaa-chat-prompts::-webkit-scrollbar { display: none; }

.sanaa-chat-prompt {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
}

.sanaa-chat-prompt:hover {
    color: var(--text-secondary);
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.08);
}

.sanaa-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.sanaa-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    text-align: center;
    opacity: 0.45;
    margin: auto 0;
}

.sanaa-chat-empty-line {
    width: 1px;
    height: 32px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.15), rgba(255,255,255,0.15));
    margin-bottom: 12px;
}

.sanaa-chat-empty-label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}

.sanaa-chat-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 88%;
    animation: sanaaChatMsgIn 0.25s ease;
}

@keyframes sanaaChatMsgIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.sanaa-chat-msg.user {
    align-self: flex-end;
    align-items: flex-end;
}

.sanaa-chat-msg.assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.sanaa-chat-msg-label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0 4px;
}

.sanaa-chat-msg.user .sanaa-chat-msg-label {
    color: rgba(255, 255, 255, 0.25);
}

.sanaa-chat-msg.assistant .sanaa-chat-msg-label {
    color: rgba(129, 140, 248, 0.75);
}

.sanaa-chat-bubble {
    padding: 12px 14px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.sanaa-chat-msg.user .sanaa-chat-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
}

.sanaa-chat-msg.assistant .sanaa-chat-bubble {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
    border-bottom-left-radius: 4px;
}

.sanaa-chat-bubble p {
    margin: 0 0 8px;
}

.sanaa-chat-bubble p:last-child {
    margin-bottom: 0;
}

.sanaa-chat-bubble code {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.sanaa-chat-bubble pre {
    margin: 8px 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: pre-wrap;
}

.sanaa-chat-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    align-self: flex-start;
}

.sanaa-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(129, 140, 248, 0.7);
    animation: sanaaChatBounce 1.2s ease-in-out infinite;
}

.sanaa-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.sanaa-chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes sanaaChatBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.sanaa-chat-composer {
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    position: relative;
}

.sanaa-chat-suggestions {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 14px;
    right: 14px;
    max-height: 180px;
    overflow-y: auto;
    background: rgba(16, 20, 28, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    z-index: 10;
    display: none;
}

.sanaa-chat-suggestions.visible {
    display: block;
}

.sanaa-chat-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-left: 2px solid transparent;
    background: transparent;
    color: var(--text-primary);
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
}

.sanaa-chat-suggestion:hover,
.sanaa-chat-suggestion.active {
    background: rgba(99, 102, 241, 0.12);
    border-left-color: #6366f1;
}

.sanaa-chat-suggestion-cat {
    margin-left: auto;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
}

.sanaa-chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 6px 8px 6px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.3);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.sanaa-chat-input-row:focus-within {
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.sanaa-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    padding: 8px 0;
    min-width: 0;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
}

.sanaa-chat-input::placeholder {
    color: var(--text-muted);
}

.sanaa-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.1s, opacity 0.15s;
}

.sanaa-chat-send:hover {
    opacity: 0.92;
}

.sanaa-chat-send:active {
    transform: scale(0.95);
}

.sanaa-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sanaa-chat-send svg {
    width: 16px;
    height: 16px;
}

.sanaa-chat-footer-hint {
    margin-top: 8px;
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 640px) {
    .sanaa-chat-header {
        padding: 10px 12px;
        flex-wrap: wrap;
    }

    .sanaa-chat-provider {
        max-width: 110px;
        font-size: 11px;
    }

    .sanaa-chat-prompts {
        padding: 8px 10px;
        gap: 6px;
    }

    .sanaa-chat-prompt {
        font-size: 11px;
        padding: 5px 10px;
    }

    .sanaa-chat-messages {
        padding: 12px;
    }

    .sanaa-chat-bubble {
        max-width: 92%;
    }

    .sanaa-chat-footer-hint {
        display: none;
    }
}