@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');


/* ------------------------------------------------------- */
/* LIGHT THEME VARIABLES                                */
/* ------------------------------------------------------- */
:root {
    --bg: #f7f2e8;
    --card-bg: #ffffff;
    --text: #3e2723;
    --text-light: #704f38;
    --title: #947e6b;

    --input-bg: #faf7f2;
    --input-border: #cfc6b8;

    --table-head: #f4f2ee;
    --table-border: #d6d1c7;
    --table-bg: #ffffff;

    --sql-bg: #f7f3ee;
    --sql-border: #e0d7cc;

    --user-text: #835850;

    --copy-icon: #999090;
}

/* ------------------------------------------------------- */
/* DARK THEME VARIABLES (auto)                           */
/* ------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #181818;
        --card-bg: #1a1a1a;
        --text: #ececec;
        --text-light: #c9c9c9;
        --title: #ffffff;

        --input-bg: #2a2a2a;
        --input-border: #444;

        --table-head: #333;
        --table-border: #555;
        --table-bg: #1e1e1e;

        --sql-bg: #2a2a2a;
        --sql-border: #444;

        --user-text: #ffffff;

        --copy-icon: #999090;
    }
}

/* ------------------------------------------------------- */
/* GLOBAL & BODY                                            */
/* ------------------------------------------------------- */
body {
    background: var(--bg);
    font-family: "Roboto", sans-serif !important;
    margin: 0;
    padding: 0;
    display: block;
    /* justify-content: center; */
    color: var(--text);
    line-height: 1.6;
}


/* Title */
h2 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 600;
    color: var(--title);
}


/* BOTH user & bot on LEFT */
.chat-row.user{
    justify-content: flex-start !important;
    margin-bottom: 10px;
    
}
.chat-row.bot {
    justify-content: flex-start !important;
    margin-bottom: 50px;
}

/* MESSAGE TEXT */
.chat-text {
    padding: 0;
    background: none;
    border: none;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    max-width: 90%;
    font-weight: 300;
    white-space: pre-wrap;
}

/* USER MESSAGE COLOR */
.chat-row.user .chat-text {
    color: var(--user-text);
    font-weight: 600;
}

/* BOT MESSAGE CONTAINER */
.chat-content {
    max-width: 95%;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 12px;
    border-radius: 10px;
    background: var(--table-bg);
    border: 1px solid var(--table-border);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}

thead th {
    background: var(--table-head);
    padding: 12px 14px;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid var(--table-border);
    white-space: nowrap;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

td {
    padding: 14px;
    border-bottom: 1px solid var(--table-border);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}


.para-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.7;
}

.para-card .para-label {
    color: #888;
}

.para-card .para-name a {
    color: #4f7ee6;
    text-decoration: underline;
    font-weight: bold;
}

/*Expert Image*/
.expert-img-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #333;
    border: 1px solid #444;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.expert-img-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

.expert-img-circle i {
    color: #666;
    font-size: 1.1rem;
    z-index: 1;
}


.expert-name a {
    color: #4f7ee6;
    font-weight: 600;
    text-decoration: none;
}

.expert-name a:hover {
    text-decoration: underline;
}


/* SQL BOX */
.sql-toggle {
    margin-top: 5px;
    background: var(--sql-bg);
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--sql-border);
    font-size: 11px;
    cursor: pointer;
}

.sql-box {
    background: var(--table-bg);
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--sql-border);
    font-family: monospace;
    font-size: 11px;
    line-height: 1.2;
    max-width: 95%;
    white-space: pre-wrap;
}

/* TIME INFO */
.time-info {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 20px;
    font-weight: 400;
}
/* new */
.input-normal {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 12px 14px 10px;
    box-sizing: border-box;
    gap: 8px;
}

.input-normal input[name="prompt"] {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.input-recording {
    display: none; /* hidden by default */
    flex-direction: column;
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 12px 14px 10px;
    box-sizing: border-box;
    gap: 8px;
}


.input-recording .waveform {
    flex: 1;
    height: 36px;
    border-radius: 10px;
    border: 1px dashed #aaa;
    animation: pulse 1s infinite;
}

.input-recording .rec-buttons {
    display: flex;
    justify-content: space-between;
}

.btn-row {
    display: flex;
    align-items: center;
    justify-content: space-between;  /* + mic on LEFT, send on RIGHT */
}

.btn-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-right {
    display: flex;
    align-items: center;
}

/* INPUT BAR */
.input-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 16px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 22px;
    margin-bottom: 20px;
}

.input-form input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 1px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    font-size: 14px;
    color: var(--text);
}

/* SEND BUTTON - ICON ONLY */
.send-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    font-size: 24px;
    color: var(--text);
    transition: 0.2s ease;
}

.send-btn:hover {
    color: #F43E01;
} */

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn:disabled:hover {
    color: var(--text);
}

/* COPY BUTTON */
.copy-btn {
    background: transparent;
    border: none;
    color: var(--copy-icon);
    cursor: pointer;
    font-size: 16px;
    transition: 0.2s;
}

.copy-btn:hover {
    color: #F43E01;
}

.read-aloud-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--copy-icon);
    font-size: 16px;
    transition: 0.2s;
}

.read-aloud-btn:hover {
    color: #F43E01;
}

/* NO RESULT */
.no-result {
    padding: 10px 14px;
    background: #2a2a2a;
    border-left: 4px solid #ff7b7b;
    color: #ffb3b3;
    border-radius: 8px;
    font-size: 14px;
}

/* CLEAR CHAT LINK */
.clear-chat-link {
    margin-left: 10px;
    font-size: 12px;
    color: #999090;
    cursor: pointer;
    transition: color .2s ease;
    font-weight: bold;
    margin-top: 20px;
}

.clear-chat-link:hover {
    color: #F43E01;
}

.loading-text {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    line-height: 1.4;
    color: #807f7f;
    margin-top: 5px;
}

.loading-text i {
    font-size: 14px;
    line-height: 1.4;      /* ✔ fixes misalignment */
    color:#807f7f
}

.download-btn {
    color: #999090;
}

.download-btn:hover {
    color: #F43E01;
}

/**********/

.hidden {
    display: none !important;
}
/* .input-normal {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
}
.input-normal, .input-recording {
    display: flex;
    align-items: center;
    width: 90%;
    gap: 10px;
} */

/* .waveform {
    flex: 1;
    height: 40px;
    border-radius: 10px;
    border: 1px dashed #aaa;
    animation: pulse 1s infinite;
} */

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

.rec-btn-cancel,
.rec-btn-approve {
    background: none;
    border: none;
    padding: 0;
    margin: 0 6px;
    cursor: pointer;
    font-size: 22px;      /* icon size */
    color:var(--text);         /* icon color */
}


.rec-btn-cancel:active,
.rec-btn-approve:active {
    transform: scale(0.9);
}

.resend-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    margin-left: 6px;
}

.resend-btn:hover {
    color: #4f7ee6;
}


.icon-btn {
    background: transparent;
    border: none;
    color: var(--copy-icon);
    cursor: pointer;
    font-size: 16px;
    transition: 0.2s ease;
}

.icon-btn:hover {
    color: #F43E01;
}

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

.icon-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

#copy-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #333;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(10px);
    z-index: 9999;
}

#copy-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Loading  */

.chat-row.bot.loading .chat-text {
    background: none;
    padding: 6px 0;
    border: none;
    box-shadow: none;
}

/* Typing indicator dots */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Dots */
.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: rgba(200, 200, 200, 0.8);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
    opacity: 0.3;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%   { transform: translateY(0); opacity: 0.3; }
    20%  { transform: translateY(-4px); opacity: 1; }
    40%  { transform: translateY(0); opacity: 0.3; }
    100% { opacity: 0.3; }
}


/* Mode Selection */
.plus-wrapper {
    position: relative;
}

.mode-menu {
    position: absolute;
    bottom: 48px;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--table-border);
    border-radius: 10px;
    min-width: 160px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 50;
}

.mode-menu.hidden {
    display: none;
}

.mode-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-size: 14px;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 6px;
}

.mode-item:hover {
    background: var(--table-head);
    color: var(--title);
}

.mode-indicator {
    margin-top: 4px;
    font-size: 12px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mode-indicator.hidden {
    display: none;
}

.mode-close {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 2px;
}

.mode-close:hover {
    color: #ff5c5c;
}

/* ── Sidebar ─────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
    width: 260px; flex-shrink: 0;
    background: #111; border-right: 0.5px solid #2a2a2a;
    display: flex; flex-direction: column;
    transition: width 0.2s ease;
    overflow: hidden;
}
.sidebar.collapsed { width: 0; }

.sidebar-header {
    padding: 16px 14px 10px;
    border-bottom: 0.5px solid #2a2a2a;
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-title { font-size: 12px; font-weight: 500; color: #888; text-transform: uppercase; letter-spacing: 0.06em; }

.new-chat-btn {
    width: 100%; padding: 10px 14px;
    background: #1a1a1a; border: 0.5px solid #2a2a2a;
    border-radius: 8px; color: #aaa; font-size: 13px;
    cursor: pointer; text-align: left; margin: 10px 14px;
    width: calc(100% - 28px);
    display: flex; align-items: center; gap: 8px;
    transition: background 0.15s;
}
.new-chat-btn:hover { background: #222; color: #eee; }

.sidebar-sessions { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.session-group-label { font-size: 10px; color: #444; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 4px 4px; }

.session-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 10px; border-radius: 8px; cursor: pointer;
    margin-bottom: 2px; gap: 6px;
    transition: background 0.12s;
}
.session-item:hover { background: #1e1e1e; }
.session-item.active { background: #1e2a4a; }

.session-title { font-size: 12px; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.session-time  { font-size: 10px; color: #444; flex-shrink: 0; }

.session-delete {
    background: none; border: none; color: #444; cursor: pointer;
    font-size: 11px; padding: 2px 4px; border-radius: 4px;
    opacity: 0; transition: opacity 0.1s, color 0.1s; flex-shrink: 0;
}
.session-item:hover .session-delete { opacity: 1; }
.session-delete:hover { color: #e24b4a; }

.sidebar-footer {
    padding: 12px 14px;
    border-top: 0.5px solid #2a2a2a;
}

/* quota bar */
.quota-bar-wrap { margin-bottom: 8px; }
.quota-bar-label { display: flex; justify-content: space-between; font-size: 11px; color: #555; margin-bottom: 5px; }
.quota-bar-label span:last-child { font-family: monospace; }
.quota-bar-track { height: 4px; background: #222; border-radius: 2px; overflow: hidden; }
.quota-bar-fill  { height: 100%; border-radius: 2px; transition: width 0.3s; }
.quota-ok   { background: #1D9E75; }
.quota-warn { background: #ba7517; }
.quota-full { background: #e24b4a; }

.quota-full-msg {
    background: #1a0a0a; border: 0.5px solid #5a1a1a;
    border-radius: 8px; padding: 10px 12px;
    font-size: 12px; color: #f09595; margin-bottom: 8px; line-height: 1.5;
}
.quota-clear-btn {
    width: 100%; padding: 8px; background: #2a1010;
    border: 0.5px solid #5a2020; border-radius: 8px;
    color: #f09595; font-size: 12px; cursor: pointer;
    transition: background 0.15s;
}
.quota-clear-btn:hover { background: #3a1515; }

.user-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.user-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: #1e2a5e; border: 0.5px solid #4f6ef7;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: #a0b0ff; font-weight: 500; flex-shrink: 0;
}
.user-email { font-size: 11px; color: #555; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn { background: none; border: none; color: #444; cursor: pointer; font-size: 12px; padding: 4px; }
.logout-btn:hover { color: #e24b4a; }

/* sidebar toggle */
.sidebar-toggle {
    position: absolute; top: 16px; left: 16px; z-index: 10;
    background: #1a1a1a; border: 0.5px solid #2a2a2a;
    border-radius: 8px; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #666; font-size: 13px;
    transition: color 0.15s, background 0.15s;
}
.sidebar-toggle:hover { color: #ccc; background: #222; }

/* ── Main area ───────────────────────────── */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-width: 0; /* ← ADD THIS — prevents flex children from overflowing */
}

.chat-container.wide {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;       /* ← ADD */
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* ← ADD */
}

.header { padding: 16px 20px 0 60px; }

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    width: 100%;       /* ← ADD */
    box-sizing: border-box; /* ← ADD */
}

/* quota warning banner in chat */
.quota-warn-banner {
    background: #1a1400; border: 0.5px solid #5a4000;
    border-radius: 8px; padding: 8px 12px;
    font-size: 12px; color: #ba7517;
    margin: 8px 20px; text-align: center;
}
.quota-full-banner {
    background: #1a0a0a; border: 0.5px solid #5a1a1a;
    border-radius: 10px; padding: 14px 16px;
    margin: 8px 20px; text-align: center;
}
.quota-full-banner p { font-size: 13px; color: #f09595; margin-bottom: 10px; }
.quota-full-banner button {
    background: #3a1010; border: 0.5px solid #7a2020;
    border-radius: 8px; color: #f09595; padding: 8px 18px;
    font-size: 12px; cursor: pointer;
}
.quota-full-banner button:hover { background: #4a1515; }

.no-sessions { font-size: 12px; color: #333; text-align: center; padding: 20px 10px; }

.toggle-btn {
    font-size: 12px;
    padding: 4px 10px;
    border: 0.5px solid #ccc;
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
}
.toggle-btn.active {
    background: transparent;
    color: #F43E01;
    font-weight: 600;
    border-color: #F43E01;
}

.chat-topbar {
    display: flex;
    justify-content: flex-end;  /* push button to right */
    padding: 8px 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: transparent;
}

.new-chat-btn {
    background: transparent;
    border: 1px solid #444;
    color: var(--text);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;          /* ← add this */
    white-space: nowrap;  /* ← add this */
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: #F43E01;
    color: #ffffff;
    border-color:#F43E01;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1rem 2rem;
    gap: 1rem;
    height: 100%;
}

.wc-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--input-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.wc-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.wc-sub {
    font-size: 14px;
    color: var(--text-muted, #888);
    margin: 0;
    max-width: 360px;
    line-height: 1.6;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 520px;
    margin-top: 0.5rem;
}

.chip {
    background: transparent;
    border: 1px solid var(--input-border);
    border-radius: 999px;
    padding: 8px 18px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}

.chip:hover {
    background: var(--input-bg);
}