/* ============================================================
   DubeyAI — App Stylesheet
   TenderAstra dark/golden premium design
   ============================================================ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
    --bg:           #080a0e;
    --panel:        #0d1016;
    --panel-soft:   #12161e;
    --panel-raised: #171b24;
    --line:         rgba(255, 255, 255, 0.08);
    --line-strong:  rgba(214, 168, 79, 0.24);
    --text:         #f6f4ef;
    --muted:        #979ba6;
    --muted-light:  #c8c8c5;
    --gold:         #d6a84f;
    --gold-light:   #f0cd7b;
    --gold-dark:    #9c6e20;
    --danger:       #ff7f87;
    --success:      #6fd7a1;
    --shadow:       0 24px 80px rgba(0, 0, 0, 0.38);
    --radius:       18px;
}

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system,
                 BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; color: inherit; }
a { color: inherit; }

svg {
    width: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── App shell (chatbot page) ──────────────────────────────── */
.app-body { height: 100vh; overflow: hidden; }

.app-shell {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    height: 100vh;
    background:
        radial-gradient(circle at 80% 0%, rgba(214, 168, 79, 0.07), transparent 30%),
        var(--bg);
}

/* ── Sidebar ───────────────────────────────────────────────── */
.app-sidebar {
    position: relative;
    z-index: 30;
    display: flex;
    min-height: 0;
    flex-direction: column;
    padding: 24px 18px 18px;
    border-right: 1px solid var(--line);
    background: rgba(11, 13, 18, 0.96);
}

/* ── Brand mark ────────────────────────────────────────────── */
.brand, .auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}
.brand { padding: 0 8px 24px; }

.brand-mark {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid rgba(240, 205, 123, 0.5);
    border-radius: 12px;
    color: #15100a;
    background: linear-gradient(145deg, var(--gold-light), var(--gold-dark));
    box-shadow: 0 8px 24px rgba(214, 168, 79, 0.18);
    font-family: Georgia, serif;
    font-size: 22px;
    font-weight: 700;
}

.brand strong, .auth-brand strong {
    display: block;
    font-size: 16px;
    letter-spacing: 0.01em;
}
.brand small, .auth-brand small {
    display: block;
    margin-top: 1px;
    color: var(--muted);
    font-size: 11px;
}

/* ── New chat button ───────────────────────────────────────── */
.new-chat-button {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 12px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    color: #18120a;
    background: linear-gradient(135deg, #edc86f, #bd8734);
    box-shadow: 0 8px 30px rgba(184, 126, 37, 0.15);
    font-size: 14px;
    font-weight: 700;
    transition: transform .2s ease, box-shadow .2s ease;
}
.new-chat-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 34px rgba(184, 126, 37, 0.23);
}
.new-chat-button svg { width: 17px; }

/* ── History search ────────────────────────────────────────── */
.history-search {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 16px 0 18px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.025);
}
.history-search:focus-within {
    border-color: rgba(214, 168, 79, 0.5);
    box-shadow: 0 0 0 3px rgba(214, 168, 79, 0.08);
}
.history-search svg { width: 16px; }
.history-search input {
    width: 100%;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font-size: 13px;
}
.history-search input::placeholder { color: #6f737d; }

/* ── History label / list ──────────────────────────────────── */
.sidebar-label {
    display: flex;
    justify-content: space-between;
    padding: 0 8px 8px;
    color: #767b86;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.history-list { min-height: 0; flex: 1; overflow-y: auto; }

.history-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    margin: 2px 0;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 11px;
    text-align: left;
    background: transparent;
    transition: background .2s ease, border-color .2s ease;
}
.history-item:hover {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.045);
}
.history-item.active {
    border-color: rgba(214, 168, 79, 0.19);
    background: rgba(214, 168, 79, 0.07);
}

.history-icon {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    color: #898e99;
    background: rgba(255, 255, 255, 0.045);
}
.history-icon svg { width: 14px; }
.history-copy { min-width: 0; }
.history-copy strong,
.history-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-copy strong { color: #d9d9d6; font-size: 12px; font-weight: 550; }
.history-copy small  { margin-top: 2px; color: #656a75; font-size: 10px; }
.history-empty { padding: 12px 9px; color: #646974; font-size: 12px; line-height: 1.6; }

/* ── Sidebar footer ────────────────────────────────────────── */
.sidebar-footer { padding-top: 16px; border-top: 1px solid var(--line); }
.account-row    { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }

.avatar, .message-avatar {
    display: grid;
    place-items: center;
    border: 1px solid rgba(214, 168, 79, 0.24);
    border-radius: 10px;
    color: var(--gold-light);
    background: rgba(214, 168, 79, 0.08);
    font-size: 13px;
    font-weight: 700;
}
.avatar { width: 34px; height: 34px; }

.account-copy { min-width: 0; flex: 1; }
.account-copy strong,
.account-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-copy strong { font-size: 12px; }
.account-copy small  { color: var(--muted); font-size: 10px; }

/* ── Icon buttons ──────────────────────────────────────────── */
.icon-button, .mobile-menu-button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #a8acb4;
    background: rgba(255, 255, 255, 0.025);
    transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.icon-button:hover, .mobile-menu-button:hover {
    border-color: var(--line-strong);
    color: var(--gold-light);
    background: rgba(214, 168, 79, 0.06);
}
.icon-button svg  { width: 17px; }
.mobile-menu-button { display: none; }

/* ── Workspace (main content area) ────────────────────────── */
.workspace {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
}

.workspace-header {
    display: flex;
    height: 76px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--line);
    background: rgba(8, 10, 14, 0.7);
    backdrop-filter: blur(14px);
}

.header-title, .header-actions,
.assistant-badge, .private-label { display: flex; align-items: center; }
.header-title   { gap: 12px; }
.header-actions { gap: 10px; }
.assistant-badge { gap: 11px; }

.assistant-orb {
    width: 35px;
    height: 35px;
    border: 1px solid rgba(214, 168, 79, 0.32);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #f5d786, #a36d24 48%, #20160b 70%);
    box-shadow: inset 0 0 0 5px #11151c, 0 0 25px rgba(214, 168, 79, 0.12);
}

.assistant-badge strong,
.assistant-badge small { display: block; }
.assistant-badge strong { font-size: 14px; }
.assistant-badge small  { margin-top: 3px; color: var(--muted); font-size: 11px; }
.assistant-badge small i {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(111, 215, 161, 0.5);
}

.private-label { gap: 7px; color: #8f949e; font-size: 11px; }
.private-label svg { width: 14px; }

/* ── Messages area ─────────────────────────────────────────── */
.messages-area {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.conversation, .welcome-panel {
    width: min(850px, calc(100% - 40px));
    margin: 0 auto;
}
.conversation { padding: 36px 0 16px; }

.welcome-panel {
    display: flex;
    min-height: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 54px 0;
    text-align: center;
}
.welcome-panel[hidden] { display: none; }

.welcome-mark {
    display: grid;
    width: 72px;
    height: 72px;
    margin-bottom: 24px;
    place-items: center;
    border: 1px solid rgba(240, 205, 123, 0.42);
    border-radius: 22px;
    color: #17110a;
    background: linear-gradient(145deg, #f2d27e, #9d6922);
    box-shadow: 0 18px 55px rgba(188, 128, 36, 0.17);
    font: 700 38px Georgia, serif;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--gold);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .2em;
}

.welcome-panel h1 {
    max-width: 660px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(34px, 5vw, 56px);
    font-weight: 500;
    letter-spacing: -.035em;
    line-height: 1.06;
}
.welcome-panel > p:not(.eyebrow) {
    max-width: 610px;
    margin: 18px auto 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.75;
}

/* ── Prompt cards ──────────────────────────────────────────── */
.prompt-grid {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 36px;
}
.prompt-card {
    min-height: 104px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 14px;
    text-align: left;
    background: linear-gradient(145deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
    transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.prompt-card:hover {
    transform: translateY(-2px);
    border-color: rgba(214, 168, 79, 0.3);
    background: rgba(214, 168, 79, 0.045);
}
.prompt-card span,
.prompt-card small { display: block; }
.prompt-card span  { color: #e7e5df; font-size: 13px; font-weight: 650; }
.prompt-card small { margin-top: 8px; color: #777c86; font-size: 11px; line-height: 1.5; }

/* ── Message rows ──────────────────────────────────────────── */
.message-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 28px;
    animation: message-in .28s ease both;
}
@keyframes message-in {
    from { opacity: 0; transform: translateY(8px); }
}

.message-user      { margin-left: 11%; }
.message-assistant { margin-right: 7%; }
.message-avatar    { width: 34px; height: 34px; margin-top: 20px; }
.message-user .message-avatar {
    color: #c9cbd0;
    border-color: var(--line);
    background: var(--panel-raised);
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 7px;
}
.message-meta strong { font-size: 11px; }
.message-meta span   { color: #616670; font-size: 9px; }

.message-bubble {
    padding: 15px 17px;
    border: 1px solid var(--line);
    border-radius: 4px 15px 15px 15px;
    color: #d9d9d6;
    background: var(--panel-soft);
    font-size: 13px;
    line-height: 1.75;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.message-user .message-bubble {
    border-color: rgba(214, 168, 79, 0.18);
    border-radius: 15px 4px 15px 15px;
    background: linear-gradient(145deg, rgba(214,168,79,.11), rgba(214,168,79,.045));
}

/* ── Typing indicator ──────────────────────────────────────── */
.message-loading .message-bubble {
    display: flex;
    width: 68px;
    gap: 5px;
    padding: 16px;
}
.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    animation: pulse 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: .16s; }
.typing-dot:nth-child(3) { animation-delay: .32s; }
@keyframes pulse {
    0%, 60%, 100% { opacity: .25; transform: translateY(0); }
    30%            { opacity: 1;   transform: translateY(-3px); }
}

/* ── Composer (message input) ──────────────────────────────── */
.composer-wrap {
    width: min(890px, calc(100% - 40px));
    flex: 0 0 auto;
    margin: 0 auto;
    padding: 10px 0 20px;
}

.composer {
    padding: 14px 14px 10px 18px;
    border: 1px solid rgba(214, 168, 79, 0.24);
    border-radius: var(--radius);
    background: rgba(18, 22, 30, 0.95);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.25);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.composer:focus-within {
    border-color: rgba(240, 205, 123, 0.5);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34), 0 0 0 3px rgba(214, 168, 79, 0.06);
}
.composer textarea {
    display: block;
    width: 100%;
    max-height: 160px;
    min-height: 30px;
    padding: 3px 2px;
    resize: none;
    overflow-y: auto;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font-size: 14px;
    line-height: 1.55;
}
.composer textarea::placeholder { color: #6e737e; }

.composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
}
.composer-hint { color: #686d77; font-size: 9px; }
.composer-hint i {
    display: inline-block;
    width: 3px;
    height: 3px;
    margin: 0 6px 2px;
    border-radius: 50%;
    background: #50545d;
}

.send-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 0;
    border-radius: 10px;
    color: #17110a;
    background: linear-gradient(135deg, #edcb76, #b87d29);
    font-size: 12px;
    font-weight: 750;
    transition: opacity .2s ease, transform .2s ease;
}
.send-button:hover:not(:disabled) { transform: translateY(-1px); }
.send-button:disabled { cursor: not-allowed; opacity: .45; }
.send-button svg { width: 14px; }

.disclaimer {
    margin: 9px 0 0;
    color: #565b65;
    text-align: center;
    font-size: 9px;
}

/* ── Alert box ─────────────────────────────────────────────── */
.app-alert {
    margin: 0 0 10px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 127, 135, 0.25);
    border-radius: 10px;
    color: #ffc1c5;
    background: rgba(163, 48, 57, 0.15);
    font-size: 12px;
}
.app-alert--success {
    border-color: rgba(111, 215, 161, 0.25);
    color: #a3f0cb;
    background: rgba(40, 120, 80, 0.15);
}

/* ── Mobile sidebar backdrop ───────────────────────────────── */
.sidebar-backdrop { display: none; }

/* ── Auth pages ────────────────────────────────────────────── */
.auth-body    { min-height: 100vh; overflow: auto; }
.auth-shell   {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(360px, 1.05fr) minmax(420px, .95fr);
}

.auth-showcase {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 42px clamp(38px, 6vw, 90px);
    overflow: hidden;
    border-right: 1px solid var(--line);
    background:
        radial-gradient(circle at 25% 40%, rgba(214, 168, 79, 0.12), transparent 35%),
        linear-gradient(145deg, #0d1015, #07090c);
}
.auth-showcase::after {
    position: absolute;
    right: -20%;
    bottom: -25%;
    width: 70%;
    aspect-ratio: 1;
    border: 1px solid rgba(214, 168, 79, 0.1);
    border-radius: 50%;
    content: "";
    box-shadow: 0 0 0 80px rgba(214, 168, 79, 0.018),
                0 0 0 160px rgba(214, 168, 79, 0.012);
}

.auth-statement {
    position: relative;
    z-index: 1;
    max-width: 620px;
}
.auth-statement h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(44px, 5.5vw, 76px);
    font-weight: 500;
    letter-spacing: -.045em;
    line-height: 1.02;
}
.auth-statement > p:not(.eyebrow) {
    max-width: 550px;
    margin: 25px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}

.auth-proof {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    margin-top: 34px;
    color: #b7b8b6;
    font-size: 11px;
}
.auth-proof span { display: flex; align-items: center; gap: 7px; }
.auth-proof i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 8px rgba(214, 168, 79, 0.5);
}

.auth-copyright {
    position: relative;
    z-index: 1;
    margin: 0;
    color: #555a63;
    font-size: 10px;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 42px;
    background: #0a0c10;
}

.auth-card {
    width: min(100%, 430px);
    padding: 38px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
    box-shadow: var(--shadow);
}
.auth-card h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 34px;
    font-weight: 500;
    letter-spacing: -.025em;
}
.auth-intro {
    margin: 12px 0 28px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.auth-form   { display: grid; gap: 17px; }
.form-field label {
    display: block;
    margin-bottom: 7px;
    color: #c9c9c6;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .02em;
    text-transform: uppercase;
}

/* Bootstrap's form-control class, styled for our dark theme */
.form-field .form-control {
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.025);
    font-size: 13px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.form-field .form-control:focus {
    border-color: rgba(214, 168, 79, 0.5);
    color: var(--text);
    background: rgba(255, 255, 255, 0.035);
    box-shadow: 0 0 0 3px rgba(214, 168, 79, 0.07);
    outline: none;
}
.form-field .form-control::placeholder { color: #5e626c; }

.field-error {
    display: block;
    margin-top: 6px;
    color: var(--danger);
    font-size: 10px;
    line-height: 1.4;
}
.field-help {
    display: block;
    margin-top: 5px;
    color: #666b75;
    font-size: 10px;
    line-height: 1.5;
}

.auth-submit {
    width: 100%;
    margin-top: 4px;
    padding: 12px 18px;
    border: 0;
    border-radius: 10px;
    color: #17110a;
    background: linear-gradient(135deg, #edcb76, #b87d29);
    font-size: 13px;
    font-weight: 750;
    transition: transform .2s ease, box-shadow .2s ease;
}
.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(184, 126, 37, 0.25);
}

.auth-switch {
    margin: 24px 0 0;
    color: #767b85;
    text-align: center;
    font-size: 11px;
}
.auth-switch a {
    color: var(--gold-light);
    font-weight: 650;
    text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border-radius: 6px; background: #30343d; }

/* ── Responsive: tablet / mobile ──────────────────────────── */
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }

    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 292px);
        transform: translateX(-102%);
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.4);
        transition: transform .25s ease;
    }
    .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }

    .sidebar-backdrop {
        position: fixed;
        z-index: 20;
        inset: 0;
        display: block;
        visibility: hidden;
        opacity: 0;
        background: rgba(0, 0, 0, 0.62);
        transition: opacity .25s ease, visibility .25s;
    }
    .app-shell.sidebar-open .sidebar-backdrop { visibility: visible; opacity: 1; }

    .mobile-menu-button { display: grid; }

    .auth-shell       { grid-template-columns: 1fr; }
    .auth-showcase    {
        min-height: 430px;
        padding: 32px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .auth-statement   { margin: 72px 0; }
}

@media (max-width: 640px) {
    .workspace-header { height: 66px; padding: 0 14px; }
    .private-label    { display: none; }
    .assistant-badge strong { font-size: 12px; }
    .assistant-badge small  { font-size: 9px; }
    .assistant-orb    { width: 31px; height: 31px; }

    .conversation, .welcome-panel { width: calc(100% - 24px); }
    .welcome-panel { padding: 38px 0 24px; justify-content: flex-start; }
    .welcome-panel h1 { font-size: 37px; }
    .welcome-panel > p:not(.eyebrow) { font-size: 12px; }
    .prompt-grid { grid-template-columns: 1fr; margin-top: 26px; }
    .prompt-card { min-height: 82px; }

    .message-user, .message-assistant { margin-left: 0; margin-right: 0; }
    .message-row   { grid-template-columns: 28px minmax(0, 1fr); gap: 9px; margin-bottom: 22px; }
    .message-avatar { width: 28px; height: 28px; font-size: 10px; }
    .message-bubble { padding: 13px; font-size: 12px; }

    .composer-wrap  { width: calc(100% - 20px); padding-bottom: 10px; }
    .composer-hint  { display: none; }
    .composer-footer { justify-content: flex-end; }

    .auth-panel     { padding: 20px 14px 34px; }
    .auth-card      { padding: 28px 22px; }
    .auth-showcase  { min-height: 350px; padding: 26px 22px; }
    .auth-statement { margin: 50px 0; }
    .auth-statement h1 { font-size: 42px; }
    .auth-proof     { display: grid; gap: 10px; }
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
