﻿/* --- Common layout and typography --- */
body {
    margin: 0;
    padding: 0;
    font-family: Monrope, "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    height: 100vh;
}

.status-line {
    margin-top: 4px;
    margin-left: 5px;
    font-size: 12px;
    opacity: 0.9;
}

.bot {
    align-self: flex-start;
    border-radius: 12px 12px 12px 0;
}

#scroll-anchor {
    height: 1px;
}

/* UI BUTTONS */
#send,
#stop {
    margin-left: 10px;
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid #a0a2a5; /* neutral border */
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

#clear {
    position: relative;
    background: #2a1212; /* slightly tinted */
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500; /* stronger */
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

#clear:hover {
    background: #3a1616; /* stronger hover */
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.25);
    border: 1px solid red;
    color: red
}

#clear:active {
    transform: translateY(1px);
}

#clear::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: #111;
    color: #f5f5f5;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 1000;
}

#clear::before {
    content: "";
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #111 transparent transparent transparent;
    opacity: 0;
    transition: opacity 0.15s ease;
}

#clear:hover::after,
#clear:hover::before {
    opacity: 1;
}


/* STOP: neutral until active */
#stop {
    color: #e5e7eb;
}

#stop:hover {
    border-color: #64748b;
    box-shadow: 0 0 0 2px rgba(148,163,184,0.25);
}

/* STOP when actively stopping generation */
#stop.active {
    border-color: #ef4444;
    color: #fecaca;
    box-shadow: 0 0 0 2px rgba(239,68,68,0.25);
}

/* Disabled state */
#stop:disabled,
#send:disabled,
#clear:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}


/* --- Theme switch button --- */
.theme-btn {
    /*margin-left: 8px;*/
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.theme-btn:hover {
    opacity: 1;
}

/* --- Typing indicator --- */
.typing {
    font-style: italic;
    color: #aaa;
}

/* --- Code styling --- */
.message pre {
    margin: 12px 0;
    border-radius: 8px;
    overflow-x: auto;
    position: relative;
}

.message pre code.hljs {
    display: block;
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.message code:not(.hljs) {
    font-family: ui-monospace, monospace;
    font-size: 13px;
    background: #2b76ad99;
    padding: 2px 4px;
    border-radius: 4px;
}

/* --- Markdown --- */
/*.bot h1, .bot h2, .bot h3, .bot h4 {
    font-weight: 400;
    margin: 0.6em 0 0.3em;*/
/*}*/

.message.bot h1 {
    font-size: 1.4rem;
}

.message.bot h2 {
    font-size: 1.25rem;
}

.message.bot h3 {
    font-size: 1.1rem;
}

.message.bot h4 {
    font-size: 1.05rem;
}


.bot p, .bot ul, .bot ol {
    margin: 0.4em 0;
}

.bot ul, .bot ol {
    padding-left: 1.4rem;
}

/* Animated typing dots */
.typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    border-radius: 12px;
    font-style: normal;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
    animation: blink 1s infinite ease-in-out;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 80%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }

    40% {
        opacity: 1;
        transform: scale(1.3);
    }
}

.bot.help {
    background: #222;
    color: #eee;
    border: 1px solid #444;
    padding: 12px;
    border-radius: 8px;
    line-height: 1.5;
}

    .bot.help code {
        color: #00ff90;
        background: #111;
        padding: 2px 4px;
        border-radius: 4px;
    }

.hljs-keyword, .hljs-selector-tag, .hljs-literal {
    color: #7aa2f7 !important;
}

.hljs-comment {
    color: #10e3d2 !important;
    font-style: italic;
}

.hljs-number {
    color: #e0af68 !important;
}


/* Keep literal spacing inside code blocks */
.message.bot pre {
    background: #151414;
    border-radius: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    white-space: pre;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.45;
    border: 1px dashed #aa9e9e;
}

/* Structure only, no colors */
.message pre {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre;                 /* keep line breaks */
  font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
  background: transparent;          /* no theme color here */
  color: inherit;                   /* inherit from theme */
  border: none;
}
.message pre code.hljs {
  display: block;
  padding: 0;
  white-space: pre;
  background: transparent;
  color: inherit;
}

.hljs {
    white-space: pre !important;
    display: block !important;
    border-radius: 12px;
}

/* language toggle button */
.lang-toggle {
    display: inline-flex;
    border: 1px solid #555;
    border-radius: 8px;
    overflow: hidden;
    font-family: sans-serif;
    font-size: 14px;
    margin-left: 10px;
}

.lang-toggle input[type="radio"] {
    display: none;
}

.lang-toggle label {
    padding: 6px 14px;
    cursor: pointer;
    background: #2b2b2b;
    color: #ccc;
    transition: background 0.2s, color 0.2s;
}

.lang-toggle input[type="radio"]:checked + label {
    background: #0078d7;
    color: #fff;
}

.lang-toggle label:first-of-type {
    border-right: 1px solid #555;
}

.lang-hidden {
    display: none !important;
}

.token-usage {
    font-size: 11px;
    opacity: 0.6;
    margin-bottom: 4px;
    text-align: right;
    margin-top:10px;
}

/* Usage summary (Cost · Balance) */
.usage-summary {
    margin-top: 8px;
    padding-top: 6px;
    font-size: 12px;
    line-height: 1.4;
    color: #6b7280; 
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 6px;
    /*padding-bottom: 80px;*/
}

/* Emphasis */
.usage-cost {
    /*font-weight: 500;*/
}

.usage-balance {
    font-weight: 500;
}

/* Separator dot */
.usage-sep {
    opacity: 0.6;
}

.low-balance-warning {
    margin-top: 6px;
    font-size: 13px;
    color: #f90834;
}

.low-balance-warning .topup-link {
    font-weight: 600;
    color: #68ff00;
    text-decoration: none;
}

.low-balance-warning .topup-link:hover {
    text-decoration: underline;
}

input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* ================================
   Top Header Bar
   ================================ */

.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    padding: 12px 24px;
    box-sizing: border-box;
    background: #0f172a;
    box-shadow: inset 0 -1px 0 rgb(138 136 136 / 27%);
}


.top-bar-center {
    position: static;
    transform: none;
    margin: 0 auto;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.top-bar-center img {
    height: 26px; /* keep subtle */
    opacity: 0.85;
}

/*@media (max-width: 1200px) {
    .top-bar-center {
        display: none;
    }
}*/

.top-bar-left {
    display: flex;
    align-items: center;
    min-height: 32px;
    gap: 16px;
    flex-shrink: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

.top-bar-inner {
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
}

.topup-banner {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid #22c55e;
    color: #dcfce7;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* ================================
   Base Button Style
   ================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none; /* critical: removes link look */
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* ================================
   Top up Button (Primary Action)
   ================================ */

.btn-topup {
    background-color: #16a34a; /* modern financial green */
    border-color: #fafafa;
    color: #ffffff !important;
}

    .btn-topup:hover {
        background-color: #15803d;
        border-color: #fafafa;
        color: #ffffff !important;
        ;
    }

/* ================================
   Logout Button (Secondary)
   ================================ */

.btn-logout {
    margin-left: 10px;
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    background: #020617; /* dark base */
    color: #e5e7eb; /* light text */
    border: 1px solid #a0a2a5; /* neutral border */
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.btn-logout:hover {
    background: linear-gradient(135deg, #8c1be0, #6263f0);
    box-shadow: 0 0 0 2px rgba(120, 7, 205, 0.25);
    color: #ffffff
}

.btn-logout:active {
    background-color: rgba(255, 255, 255, 0.12);
}

/* ================================
   Mobile Refinement
   ================================ */

@media (max-width: 600px) {
    .btn {
        padding: 5px 10px;
        font-size: 12px;
        border-radius: 6px;
    }
}

/* ================================
   Credit Badge Styles
   ================================ */
.credit-badge {
    margin-right: 12px;
    padding: 6px 10px;
    font-weight: 600;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid #519e6e;
    white-space: nowrap;
}

.credit-badge.low {
    color: #f59e0b;
    border-color: #f59e0b;
}

.credit-badge.zero {
    color: #e20606;
    border-color: #d2cecf;
}

.credit-warning {
    font-size: 13px;
    font-weight: 500;
    margin-right: 6px;
    white-space: nowrap;
}

.credit-warning.low {
    color: #f59e0b; /* amber */
}

.credit-warning.critical {
    color: #ef4444; /* red */
}

.credit-warning.hidden {
    display: none;
}

.ai-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    display: inline-block;
}

.ai-status.ok {
    background: #22c55e;
}

.ai-status.down {
    background: #ef4444;
}

.ai-status.hidden {
    display: none;
}

/* -------------------------------------------------
   Disclaimer Box (Light + Dark Theme Safe)
-------------------------------------------------- */

.disclaimer-msg {
    background: transparent;
    border: none;
    padding: 0;
}

.disclaimer-box {
    max-width: 720px;
    margin: 12px auto;
    padding: 18px 20px;
    border-radius: 10px;
    border: 1px solid var(--border, #334155);
    background: #354354;
    color: var(--text, #e5e7eb);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.disclaimer-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.2px;
}

.disclaimer-body p {
    font-size: 13.5px;
    line-height: 1.55;
    margin: 0 0 10px;
    color: var(--text, #e5e7eb);
}

.disclaimer-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.disclaimer-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #13e903;
}

.disclaimer-check input {
    accent-color: #22c55e;
}

.disclaimer-btn {
    align-self: flex-start;
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    background: #22c55e;
    color: #052e16;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.disclaimer-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.top-bar-center-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 16px;
    opacity: 0.8;
    white-space: nowrap;
    pointer-events: none;
    color: #61fe03;
}

/* Responsive input area, places input area above controls for small widths. */
#input-area {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 20px; /* vertical + horizontal */
    box-sizing: border-box;
    background: #0f172a;
    box-shadow: inset 0 1px 0 rgba(156,154,154,0.27);
}

/* Controls are a ROW, not a column */
.input-controls {
    width: 100%;
    max-width: 1000px; /* MATCH PROMPT */
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    box-sizing: border-box;
}

@media (max-width: 400px) {

    .input-controls {
        row-gap: 8px;
        column-gap: 0; 
        flex-direction: column;
    }

    .input-controls > * {
        width: 90%;
    }
}

.elfsight-app-15acb475-6292-4488-9341-32c5113c89a0 {
    position: fixed !important;
    bottom: 96px;
    right: 16px;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 9999;
}

@font-face {
    font-family: Manrope;
    font-display: swap;
    src: url(../fonts/Manrope-Medium.woff2) format("woff2"), url(../fonts/Manrope-Medium.woff) format("woff");
    font-weight: 500;
    font-style: normal
}

@font-face {
    font-family: Manrope;
    font-display: swap;
    src: url(../fonts/Manrope-Regular.woff2) format("woff2"), url(../fonts/Manrope-Regular.woff) format("woff");
    font-weight: 400;
    font-style: normal
}

@font-face {
    font-family: Unbounded;
    font-display: swap;
    src: url(../fonts/Unbounded-Regular.woff2) format("woff2"), url(../fonts/Unbounded-Regular.woff) format("woff");
    font-weight: 400;
    font-style: normal
}

@font-face {
    font-family: Unbounded;
    font-display: swap;
    src: url(../fonts/Unbounded-Medium.woff2) format("woff2"), url(../fonts/Unbounded-Medium.woff) format("woff");
    font-weight: 500;
    font-style: normal
}

@font-face {
    font-family: Manrope;
    font-display: swap;
    src: url(../fonts/Manrope-SemiBold.woff2) format("woff2"), url(../fonts/Manrope-SemiBold.woff) format("woff");
    font-weight: 600;
    font-style: normal
}
