@import url('https://fonts.googleapis.com/css?family=Heebo:900');

/* ================================================================
   mai-chat.css — dedicated stylesheet for the Malay Digital chat UI
   (moved out of index.html's inline <style> block)
   ================================================================ */

/* Custom animations (Tailwind min may not include these) */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out both;
}

.animate-spin {
    animation: spin 0.8s linear infinite;
}

/* contentEditable placeholder */
[contenteditable][data-placeholder]:empty:before {
    content: attr(data-placeholder);
    color: #6b7280;
    pointer-events: none;
}

/* Card text areas */
.p-ltr {
    direction: ltr;
    text-align: left;
}

.p-rtl {
    direction: rtl;
    text-align: right;
    font-family: 'Heebo', 'Traditional Arabic', 'Noto Naskh Arabic', 'Geeza Pro', serif;
    font-weight: 900;
}

    .p-ltr pre,
    .p-rtl pre {
        direction: ltr;
        text-align: left;
        margin: 0.5rem 0;
    }

    .p-ltr code,
    .p-rtl code {
        font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
        font-size: 0.85em;
    }

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(255,255,255,0.25);
    }

/* Selection */
::selection {
    background: rgba(59,130,246,0.3);
    color: white;
}

/* Material Symbols sizing */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* --- Chat message styling --- */

/* Nice framed bubble for user messages */
.msg-user-frame {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(30, 64, 175, 0.06));
    border: 1px solid rgba(96, 165, 250, 0.35);
    border-left: 3px solid rgba(96, 165, 250, 0.65);
    border-radius: 6px 18px 18px 18px; /* chat-bubble shape */
    padding: 18px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.msg-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Jawi / Arabic text — Heebo 900 per brand spec */
.jawi-text {
    font-family: 'Heebo', 'Traditional Arabic', 'Noto Naskh Arabic', 'Geeza Pro', serif;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: none;
}

/* Aref Ruqaa — respond card (Jawi answer) */
.aref-ruqaa-regular {
    font-family: "Aref Ruqaa", serif;
    font-weight: 400;
    font-style: normal;
    font-size: 32px;
    line-height: 1.9;
}

.aref-ruqaa-bold {
    font-family: "Aref Ruqaa", serif;
    font-weight: 700;
    font-style: normal;
    font-size: 32px;
    line-height: 1.9;
}

/* Aref Ruqaa — larian Jawi di dalam panel inferens (thinking) */
.aref-ruqaa-inline {
    font-family: "Aref Ruqaa", serif;
    font-size: 20px;
    line-height: 1.9;
}

/* Collapsible "Thinking" panel (inprogress stream) */
.thinking-body {
    background: rgba(17, 24, 39, 0.65);
    border: 1px solid rgba(75, 85, 99, 0.3);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.6;
    color: #9ca3af;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 240px;
    overflow-y: auto;
}

    .thinking-body::-webkit-scrollbar {
        width: 4px;
    }

/* Right session panel + top-right buttons */
.panel-bg {
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.top-btn {
    background: rgba(31, 41, 55, 0.85);
    border: 1px solid rgba(75, 85, 99, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.overlay-dim {
    background: rgba(0, 0, 0, 0.55);
}

/* --- Session drawer (mobile: off-canvas right drawer; md+: static right column) --- */
.sidebar-drawer {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

    .sidebar-drawer.sidebar-open {
        transform: translateX(0);
    }

@media (min-width: 768px) {
    .sidebar-drawer {
        display: none;
        transform: none;
    }

        .sidebar-drawer.sidebar-open {
            display: block;
            position: static;
            z-index: auto;
            flex: none;
            order: 2;
        }
}

/* --- Footer input panel (original layout, beautified) --- */
@keyframes fireFlicker {
    0% {
        text-shadow: 0px 0px 5px orange, 0px 0px 10px gold;
    }

    50% {
        text-shadow: 0px 0px 8px red, 0px 0px 12px yellow;
    }

    100% {
        text-shadow: 0px 0px 5px orange, 0px 0px 10px gold;
    }
}

.chat-input-panel {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

    .chat-input-panel:focus-within {
        border-color: rgba(96, 165, 250, 0.65);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18), 0 12px 40px rgba(0, 0, 0, 0.45);
    }

.chat-textarea {
    min-height: 92px; /* one line + paddings */
    max-height: 215px; /* auto-expands up to 6 lines, then scrolls internally */
    padding: 12px 16px 56px; /* bottom padding keeps text clear of the button rows */
    font-size: 15px;
    line-height: 1.625;
    word-break: break-word;
}

    .chat-textarea:focus {
        outline: none;
    }

/* Original round buttons: white/10 bg, teal hover/selected */
.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.15s ease, opacity 0.3s ease;
}

    .icon-btn .material-symbols-outlined {
        font-size: 20px;
    }

    .icon-btn:hover {
        background: rgba(0, 255, 163, 0.2);
        border-color: rgba(0, 255, 163, 0.45);
    }

    .icon-btn:active {
        transform: scale(0.92);
    }

    .icon-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .icon-btn.btn-active {
        background: rgba(0, 255, 163, 0.2);
        border-color: rgba(0, 255, 163, 0.45);
    }

    .icon-btn.btn-fire {
        animation: fireFlicker 0.2s infinite alternate ease-in-out;
    }

.button-row-left,
.button-row-right {
    position: absolute;
    bottom: 8px;
    display: flex;
    gap: 6px;
    z-index: 2;
}

.button-row-left {
    left: 8px;
}

.button-row-right {
    right: 8px;
}

/* Improved send button (gradient + glow), original -90deg send icon */
.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(96, 165, 250, 0.6);
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.45);
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.15s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}

    .send-btn .material-symbols-outlined {
        font-size: 20px;
        transform: rotate(-90deg);
    }

    .send-btn:hover {
        box-shadow: 0 8px 24px rgba(59, 130, 246, 0.65);
        transform: scale(1.06);
    }

    .send-btn:active {
        transform: scale(0.94);
    }

    .send-btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
        box-shadow: none;
    }

    .send-btn.send-busy {
        background: rgba(0, 255, 163, 0.2);
        border-color: rgba(0, 255, 163, 0.5);
        animation: fireFlicker 0.2s infinite alternate ease-in-out;
    }

    .send-btn.send-busy-deep {
        background: rgba(255, 0, 0, 0.25);
        border-color: rgba(255, 0, 0, 0.5);
        animation: fireFlicker 0.2s infinite alternate ease-in-out;
    }
