/* =========================================================
   Sahayak — modern-classic theme
   Dark elegant sidebar · warm ivory canvas · gold accents
   Playfair Display (classic serif) + Inter (modern sans)
   NOTE: all element IDs / state classes are preserved for JS.
   ========================================================= */

:root {
  /* Canvas */
  --paper:        #F3EFE7;
  --paper-2:      #FBF9F4;
  --card:         #FFFFFF;

  /* Ink / text */
  --ink:          #20242F;
  --ink-soft:     #4B505E;
  --muted:        #8B8F9C;

  /* Lines & shadow */
  --line:         rgba(32, 36, 47, 0.10);
  --line-strong:  rgba(32, 36, 47, 0.18);
  --shadow-sm:    0 1px 2px rgba(20, 22, 30, 0.06), 0 4px 14px -6px rgba(20, 22, 30, 0.12);
  --shadow-md:    0 10px 40px -12px rgba(20, 22, 30, 0.28);

  /* Sidebar (deep ink) */
  --side-1:       #191D2C;
  --side-2:       #10131E;
  --side-line:    rgba(212, 178, 106, 0.16);

  /* Accents */
  --gold:         #B4862C;
  --gold-bright:  #D9AE52;
  --gold-soft:    rgba(180, 134, 44, 0.12);
  --terracotta:   #C05A3C;
  --sage:         #3E8E6E;
  --ring:         rgba(180, 134, 44, 0.30);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* subtle paper grain / vignette */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 600px at 78% -10%, rgba(217, 174, 82, 0.10), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(32, 36, 47, 0.05), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* ---------------- Layout ---------------- */
.layout {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.content { flex: 1; min-width: 0; margin-left: 264px; }
.content .page { min-height: 100vh; justify-content: center; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: 264px;
  background: linear-gradient(180deg, var(--side-1), var(--side-2));
  border-right: 1px solid var(--side-line);
  padding: 34px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Pinned to the viewport: stays full-height and never scrolls with content. */
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 10;
}

.sidebar .side-logo {
  width: 150px;
  height: auto;
  background: #FBF9F4;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.55);
  margin: 2px 6px 22px;
}

.sidebar .brand {
  font-family: 'Playfair Display', 'Noto Serif Oriya', serif;
  font-size: 26px;
  font-weight: 700;
  color: #F4EEDD;
  letter-spacing: 0.01em;
  margin: 0 6px 6px;
}
.sidebar .brand::after {
  content: "Sahayak";
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin-top: 6px;
}

.sidebar .nav-label {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(244, 238, 221, 0.35);
  margin: 26px 10px 8px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: rgba(244, 238, 221, 0.72);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 14px;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav-item:hover { background: rgba(244, 238, 221, 0.06); color: #F4EEDD; }
.nav-item.active {
  background: linear-gradient(90deg, var(--gold-soft), transparent 80%);
  color: #F6ECD2;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px;
  border-radius: 3px;
  background: var(--gold-bright);
}

.sidebar .side-foot {
  margin-top: auto;
  padding: 16px 8px 4px;
  border-top: 1px solid rgba(244, 238, 221, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar .side-foot .foot-label {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(244, 238, 221, 0.4);
}
.sidebar .side-foot .foot-logo {
  width: 132px;
  height: auto;
  align-self: flex-start;
  background: #FBF9F4;
  padding: 9px 13px;
  border-radius: 10px;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.55);
}

/* ---------------- Chat page ---------------- */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 24px;
}

header { text-align: center; margin-top: 4px; }

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 10px;
}

h1 {
  font-family: 'Playfair Display', 'Noto Serif Oriya', serif;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.005em;
}

.subtitle {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-soft);
  margin-top: 8px;
  max-width: 440px;
  line-height: 1.45;
}

/* Mic orb + rings */
.wheel-zone {
  position: relative;
  width: min(230px, 56vw);
  height: min(230px, 56vw);
  display: flex; align-items: center; justify-content: center;
  margin: 26px 0 22px;
}

.ripple {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid var(--ring);
  opacity: 0;
}
.ripple.active { animation: ripple-out 2.4s ease-out infinite; }
.ripple.active.delay { animation-delay: 0.8s; }
.ripple.active.delay2 { animation-delay: 1.6s; }
@keyframes ripple-out {
  0%   { transform: scale(0.68); opacity: 0.8; }
  100% { transform: scale(1.4);  opacity: 0; }
}

/* faint classic concentric ring behind the orb (subtle wheel nod) */
.wheel-outer { position: relative; width: 66%; height: 66%; border-radius: 50%; z-index: 2; }
.wheel-spokes {
  position: absolute; inset: -10%;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 60%, rgba(180,134,44,0.14) 61% 62%, transparent 63%),
    radial-gradient(circle, transparent 72%, rgba(180,134,44,0.08) 73% 74%, transparent 75%);
  animation: slow-spin 120s linear infinite;
}
@keyframes slow-spin { to { transform: rotate(360deg); } }

button#mic {
  position: relative; z-index: 3;
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  background:
    radial-gradient(circle at 34% 28%, #FFFFFF 0%, #FBF7EE 42%, #F0E7D3 100%);
  color: var(--ink);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  box-shadow:
    0 0 0 10px rgba(180, 134, 44, 0.05),
    0 26px 60px -20px rgba(20, 22, 30, 0.45),
    inset 0 2px 10px rgba(255, 255, 255, 0.8),
    inset 0 -14px 34px rgba(180, 134, 44, 0.10);
  transition: transform 0.16s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}
button#mic:hover { transform: scale(1.025); }
button#mic:active { transform: scale(0.975); }
button#mic:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 8px; }

button#mic.listening {
  border-color: var(--terracotta);
  box-shadow:
    0 0 0 12px rgba(192, 90, 60, 0.10),
    0 26px 60px -20px rgba(20, 22, 30, 0.5),
    inset 0 -14px 34px rgba(192, 90, 60, 0.14);
}
button#mic.vad-speech {
  border-color: var(--sage);
  box-shadow:
    0 0 0 12px rgba(62, 142, 110, 0.12),
    0 26px 60px -20px rgba(20, 22, 30, 0.5),
    inset 0 -14px 34px rgba(62, 142, 110, 0.14);
}
button#mic.speaking {
  border-color: var(--gold-bright);
  box-shadow:
    0 0 0 12px rgba(217, 174, 82, 0.14),
    0 26px 60px -20px rgba(20, 22, 30, 0.5),
    inset 0 -14px 34px rgba(217, 174, 82, 0.16);
}

.mic-icon {
  width: 42px; height: 42px;
  stroke: var(--gold);
  fill: none; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
  transition: stroke 0.3s ease;
}
button#mic.listening .mic-icon { stroke: var(--terracotta); }
button#mic.vad-speech .mic-icon { stroke: var(--sage); }
button#mic.speaking  .mic-icon { stroke: var(--gold-bright); }

.mic-label {
  font-family: 'Inter', 'Noto Sans Oriya', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.status {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  min-height: 18px;
  margin-bottom: 20px;
}

/* Response card */
.panel {
  width: min(600px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 26px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.panel::before {
  content: "";
  position: absolute; left: 0; top: 22px; bottom: 22px;
  width: 3px; border-radius: 3px;
  background: linear-gradient(var(--gold-bright), var(--gold));
}
.panel .label {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.panel #answer {
  font-family: 'Noto Sans Oriya', 'Inter', sans-serif;
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--ink);
  margin: 0;
  white-space: pre-wrap;
}
.panel #answer:empty::after {
  content: "ଏଠାରେ ଉତ୍ତର ଦେଖାଯିବ...";
  color: var(--muted);
  font-style: italic;
}

/* ---------------- Documents page ---------------- */
.docs-view { max-width: 820px; margin: 0 auto; padding: 64px 32px 56px; }
.docs-view h2 {
  font-family: 'Playfair Display', 'Noto Serif Oriya', serif;
  color: var(--ink);
  font-size: 34px;
  font-weight: 700;
  margin: 0 0 8px;
}
.docs-view .hint { color: var(--ink-soft); font-size: 15px; line-height: 1.6; margin: 0 0 30px; max-width: 620px; }

.upload-box {
  border: 1.5px dashed var(--line-strong);
  border-radius: 18px;
  padding: 34px 28px;
  text-align: center;
  background: var(--paper-2);
  margin-bottom: 34px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.upload-box:hover { border-color: var(--gold); background: #FFFDF8; }
.upload-box input[type="file"] { display: none; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #241B08;
  border: none; border-radius: 11px;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 14px;
  padding: 12px 22px;
  box-shadow: 0 6px 18px -8px rgba(180, 134, 44, 0.7);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px -8px rgba(180, 134, 44, 0.75); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }
.btn.ghost {
  background: transparent; color: var(--gold);
  border: 1.5px solid var(--gold); box-shadow: none;
}
.btn.ghost:hover { background: var(--gold-soft); }

.upload-status { margin-top: 16px; font-size: 13px; color: var(--gold); min-height: 18px; }

.doc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.doc-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.doc-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.doc-item .doc-view {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px;
  background: var(--gold-soft); color: var(--gold);
  border: 1px solid rgba(180, 134, 44, 0.35);
  font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}
.doc-item .doc-view:hover { background: var(--gold); color: #241B08; }
.doc-item .doc-icon {
  font-size: 18px;
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold-soft); color: var(--gold);
  border-radius: 10px;
}
.doc-item .doc-name { flex: 1; color: var(--ink); font-size: 14.5px; font-weight: 500; text-decoration: none; word-break: break-all; }
.doc-item .doc-name:hover { color: var(--gold); text-decoration: underline; }
.doc-item .doc-size { color: var(--muted); font-size: 12px; white-space: nowrap; }
.doc-empty {
  color: var(--muted); font-style: italic; font-size: 14px;
  padding: 22px; text-align: center;
  border: 1px dashed var(--line); border-radius: 14px;
}

/* ---------------- Motion / responsive ---------------- */
@media (prefers-reduced-motion: reduce) {
  .wheel-spokes { animation: none; }
  .ripple.active { animation: none; opacity: 0; }
}

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .content { margin-left: 0; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 6px;
    padding: 14px 16px; overflow-y: visible;
  }
  .sidebar .brand { margin: 0 14px 0 0; font-size: 20px; }
  .sidebar .brand::after { display: none; }
  .sidebar .side-logo { width: 96px; margin: 0 12px 0 0; padding: 6px 9px; }
  .sidebar .nav-label, .sidebar .side-foot { display: none; }
  .nav-item { width: auto; padding: 10px 14px; }
  .nav-item.active::before { display: none; }
  .docs-view { padding: 40px 20px; }
}
