/* ===== MongolGPT брэнд (navy / gold / cream) ===== */
/* Мэскотын тогтмол өнгө (theme-ээс үл хамаарна) */
:root { --gold:#D4A017; --navy:#0A1E3F; --cream:#F8F9FB; }

:root, .light {
  --background:248 249 251; --surface:248 249 251; --surface-low:238 241 246;
  --surface-c:227 232 240; --surface-high:215 222 234; --card:255 255 255;
  --on-surface:17 24 39; --on-surface-variant:75 85 99; --outline:205 213 224;
  --primary:10 30 63; --on-primary:255 255 255; --primary-container:10 30 63;
  --secondary:0 60 143; --on-secondary:255 255 255; --accent:212 160 23;
  --success:16 150 110; --error:186 26 26;
  --user-bg:10 30 63; --user-fg:255 255 255;
  --ai-bg:255 255 255; --ai-fg:17 24 39; --ai-border:205 213 224;
}
.dark {
  --background:10 30 63; --surface:10 30 63; --surface-low:14 36 68;
  --surface-c:18 42 79; --surface-high:28 58 99; --card:14 36 68;
  --on-surface:248 249 251; --on-surface-variant:174 189 212; --outline:42 70 112;
  --primary:212 160 23; --on-primary:10 30 63; --primary-container:0 60 143;
  --secondary:79 127 212; --on-secondary:255 255 255; --accent:212 160 23;
  --success:78 210 150; --error:255 180 171;
  --user-bg:0 60 143; --user-fg:255 255 255;
  --ai-bg:18 42 79; --ai-fg:248 249 251; --ai-border:42 70 112;
}

/* .hidden нь .modal{display:flex}-ийг үргэлж дарж хаана (эс бөгөөс modal гацна) */
.hidden { display: none !important; }

#msg:focus, #msg:focus-visible { outline: none !important; box-shadow: none !important; }

/* Брэндийн фонт (логотой ижил төрх) */
.brand { font-family: "Poppins", "Inter", sans-serif; font-weight: 700; letter-spacing: -0.01em; }
.brand-gpt { color: #1fa9b8; }

html, body { height: 100%; }
html { background: rgb(var(--background)); }
body { background: rgb(var(--background)); color: rgb(var(--on-surface)); transition: background-color .25s, color .25s; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  line-height: 1; user-select: none;
}

/* ===== Components ===== */
.field {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  background: rgb(var(--card)); border: 1px solid rgb(var(--outline));
  color: rgb(var(--on-surface)); font-size: 15px;
}
.dark .field { background: rgb(var(--background)); }
.field:focus { outline: none; border-color: rgb(var(--primary)); box-shadow: 0 0 0 3px rgb(var(--primary) / .18); }

.btn-primary { background: rgb(var(--primary)); color: rgb(var(--on-primary)); border-radius: 10px; font-weight: 600; transition: .15s; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(.98); }

.btn-ghost { background: rgb(var(--surface-c)); color: rgb(var(--on-surface)); border-radius: 10px; border: 1px solid rgb(var(--outline)); transition: .15s; }
.btn-ghost:hover { filter: brightness(.97); }

.card { background: rgb(var(--card)); border: 1px solid rgb(var(--outline) / .55); }
.shadow-soft { box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.dark .shadow-soft { box-shadow: 0 8px 30px rgba(0,0,0,.5); }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 500;
  color: rgb(var(--on-surface-variant)); transition: .15s; text-align: left;
}
.nav-item:hover { background: rgb(var(--surface-c)); color: rgb(var(--on-surface)); }
.nav-item.active { background: rgb(var(--surface-high)); color: rgb(var(--primary)); }

.chip {
  white-space: nowrap; padding: 6px 14px; border-radius: 999px;
  background: rgb(var(--surface-low)); border: 1px solid rgb(var(--outline) / .4);
  font-size: 12px; font-weight: 500; color: rgb(var(--on-surface-variant)); transition: .15s;
}
.chip:hover { background: rgb(var(--secondary) / .12); color: rgb(var(--secondary)); }

/* Chat bubbles */
.bubble-user {
  align-self: flex-end; max-width: 85%;
  background: rgb(var(--user-bg)); color: rgb(var(--user-fg));
  padding: 12px 16px; border-radius: 18px; border-top-right-radius: 5px;
  line-height: 1.6; white-space: pre-wrap; word-wrap: break-word;
}
.bubble-ai {
  align-self: flex-start; max-width: 85%;
  background: rgb(var(--ai-bg)); color: rgb(var(--ai-fg)); border: 1px solid rgb(var(--ai-border));
  padding: 12px 16px; border-radius: 18px; border-top-left-radius: 5px;
  line-height: 1.6; white-space: pre-wrap; word-wrap: break-word;
}
.file-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 9px;
  padding: 8px 12px; background: rgb(var(--surface-low)); border: 1px solid rgb(var(--outline));
  border-radius: 10px; color: rgb(var(--primary)); text-decoration: none; font-size: 13px;
}
.chat-img {
  display: block; max-width: min(420px, 100%); width: 100%; height: auto;
  border-radius: 14px; border: 1px solid rgb(var(--outline)); cursor: zoom-in;
}
.file-card {
  display: flex; align-items: center; gap: 10px; margin-top: 9px; cursor: pointer;
  padding: 10px 12px; background: rgb(var(--surface-low)); border: 1px solid rgb(var(--outline));
  border-radius: 12px; transition: border-color .15s, background .15s;
}
.file-card:hover { border-color: rgb(var(--primary) / .5); background: rgb(var(--surface-c)); }
.fp-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.fp-table th, .fp-table td {
  border: 1px solid rgb(var(--outline)); padding: 5px 8px; text-align: left;
  white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.fp-table th { background: rgb(var(--surface-low)); font-weight: 700; }
.think-status { display: flex; align-items: center; gap: 8px; color: rgb(var(--on-surface-variant)); font-size: 13px; }
.think-status .think-txt { flex: 1; }
.think-timer { font-size: 11px; opacity: .55; font-variant-numeric: tabular-nums; }
.src-box { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.src-title { font-size: 11px; font-weight: 700; color: rgb(var(--on-surface-variant)); width: 100%; }
.src-chip {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 3px 9px;
  border-radius: 999px; background: rgb(var(--surface-low)); border: 1px solid rgb(var(--outline));
  color: rgb(var(--primary)); text-decoration: none; max-width: 220px; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
}
.src-chip:hover { border-color: rgb(var(--primary) / .5); }
/* Зураг үүсгэж байх үеийн робот гүйх цонх */
.img-gen-box {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 240px; max-width: 100%; padding: 22px 12px; margin-top: 4px;
  border-radius: 16px; background: rgb(var(--surface-low));
  border: 1px solid rgb(var(--outline)); overflow: hidden;
}
.bot-run { width: 56px; height: 56px; object-fit: contain; animation: botrun 1.05s ease-in-out infinite; }
@keyframes botrun {
  0% { transform: translateX(-48px) rotate(-8deg); }
  50% { transform: translateX(48px) rotate(8deg) translateY(-8px); }
  100% { transform: translateX(-48px) rotate(-8deg); }
}
.img-gen-text { font-size: 13px; color: rgb(var(--on-surface-variant)); font-weight: 500; }
.img-gen-text .think-timer { opacity: .6; font-size: 11px; }
.img-mode-tag {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px 4px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgb(var(--primary) / .12); color: rgb(var(--primary));
}

/* Voice */
.voice-bar { width: 5px; border-radius: 3px; background: linear-gradient(rgb(var(--secondary)), rgb(var(--accent))); }
.voice-bar.anim { animation: vpulse 1s ease-in-out infinite alternate; }
@keyframes vpulse { from { height: 8px; } to { height: 100%; } }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }

/* Sidebar — desktop тогтмол, mobile drawer */
.sidebar {
  position: fixed; left: 0; top: 0; height: 100dvh; width: 280px;
  background: rgb(var(--surface-low)); border-right: 1px solid rgb(var(--outline) / .4);
  display: flex; flex-direction: column; padding: 16px; z-index: 50;
  transform: translateX(-100%); transition: transform .25s ease;
}
.sidebar.open { transform: none; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
@media (min-width: 768px) { .sidebar { transform: none; box-shadow: none; } }

/* Ярианы мөр */
.conv-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; border-radius: 10px; font-size: 14px; text-align: left;
  color: rgb(var(--on-surface-variant)); transition: .12s; cursor: pointer;
}
.conv-item:hover { background: rgb(var(--surface-c)); color: rgb(var(--on-surface)); }
.conv-item.active { background: rgb(var(--surface-high)); color: rgb(var(--on-surface)); font-weight: 500; }
.conv-item .conv-more { font-size: 18px; opacity: 0; transition: .12s; padding: 2px; border-radius: 6px; }
.conv-item:hover .conv-more { opacity: .7; }
.conv-item .conv-more:hover { opacity: 1; background: rgb(var(--outline)); }

/* ===== MongolGPT мэскот робот (бодит зураг) ===== */
.bot { display: block; }
.bot-badge { background: #05101E; overflow: hidden; box-shadow: 0 8px 22px rgba(5,16,30,.28); }
.bot-badge img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; display: block; }
.bot-float { animation: botfloat 3.4s ease-in-out infinite; }
@keyframes botfloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.bot-think { animation: botpulse 1s ease-in-out infinite; }
@keyframes botpulse { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-3px) scale(1.05); } }

.think-dots i { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: rgb(var(--on-surface-variant)); margin: 0 2px; animation: dotb 1.2s infinite; }
.think-dots i:nth-child(2) { animation-delay: .2s; }
.think-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dotb { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* Toggle switch */
.switch { width: 46px; height: 26px; border-radius: 999px; background: rgb(var(--outline)); position: relative; transition: .2s; cursor: pointer; flex-shrink: 0; border: none; }
.switch.on { background: rgb(var(--primary)); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch.on::after { left: 23px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid rgb(var(--outline) / .4); }
.set-row:last-child { border-bottom: none; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: rgb(var(--outline)); border-radius: 10px; }
