/* ============================================================
   TILORA Dizayn Tizimi — Professional Typography & Styling
   Palitra: Ink, Paper, Teal (ijobiy/ochiq), Clay (AI-lock/yopiq), Amber (sabab/ogohlantirish)
   ============================================================ */

:root {
  --ink: #16202E;
  --ink-2: #243449;
  --ink-3: #5E6A79;
  --paper: #FAF8F4;
  --card: #FFFFFF;
  --surface-2: #F2F0EB;
  --line: #DCD8D0;
  --line-2: #EDEAE4;
  
  --teal: #1F6F63;
  --teal-deep: #14544A;
  --teal-soft: #E8F2F0;
  
  --clay: #A8503A;
  --clay-soft: #F9EEEA;
  
  --amber: #8A6A17;
  --amber-soft: #FBF4E2;
  
  --muted: #6E7681;
  --shadow: 0 2px 8px rgba(22, 32, 46, 0.06), 0 12px 28px rgba(22, 32, 46, 0.04);
  
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}

[data-theme="dark"] {
  --ink: #E8ECF2;
  --ink-2: #C2CBD6;
  --ink-3: #97A3B1;
  --paper: #101419;
  --card: #181D24;
  --surface-2: #1F252D;
  --line: #2B333D;
  --line-2: #3A4450;
  --teal: #6FB9A9;
  --teal-deep: #93D0C2;
  --teal-soft: #12302B;
  --clay: #D68F78;
  --clay-soft: #331F19;
  --amber: #D6B869;
  --amber-soft: #2E2716;
  --muted: #8B95A1;
  --shadow: 0 4px 16px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; transition: all 0.2s ease; }
a { color: var(--teal); text-decoration: none; }

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: #121924;
  color: #E8ECF2;
  padding: 28px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.brand {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.5px;
  padding: 0 24px 4px;
}
.brand em { font-style: normal; color: #7FB3A8; }
.tagline {
  padding: 0 24px 20px;
  font-size: 11.5px;
  color: #8C9AAC;
  line-height: 1.4;
  border-bottom: 1px solid #1E2B3C;
}

.nav-section-title {
  padding: 18px 24px 8px;
  font-size: 10.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #6C7A8C;
  font-weight: 700;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: #C6D0DC;
  padding: 10px 24px;
  font-size: 13.5px;
  border-left: 3px solid transparent;
}
.nav-btn:hover { background: #1C2736; color: #fff; }
.nav-btn.active {
  background: #1C2736;
  color: #fff;
  border-left-color: #7FB3A8;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 20px 24px;
  border-top: 1px solid #1E2B3C;
  font-size: 11px;
  color: #7E8B9C;
  line-height: 1.6;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 36px 44px 80px;
  max-width: 1200px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.page-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--ink);
}
.page-subtitle {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 3px;
}

/* Grid & Cards */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h3 {
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 16px;
  font-weight: 700;
}

/* Rows and indicators */
.row { margin-bottom: 14px; }
.row-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.row-top b { font-size: 13.5px; font-weight: 600; }
.track { height: 7px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.fill { height: 100%; background: var(--teal); border-radius: 4px; transition: width 0.7s ease; }
.fill.warn { background: var(--clay); }
.lvl-badge { font-family: var(--serif); font-size: 16px; font-weight: 700; color: var(--teal); }

/* Rationale box */
.why-box {
  background: var(--amber-soft);
  border: 1px solid #E7D9AE;
  border-radius: 7px;
  padding: 16px 20px;
  margin-top: 20px;
  color: #5F4A0F;
  font-size: 13.5px;
  line-height: 1.6;
}
.why-box b {
  display: block;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* Path items */
.path-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 10px;
}
.path-row.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal);
}
.path-row[data-topic] { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.path-row[data-topic]:hover, .path-row[data-topic]:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 2px 10px rgba(13, 110, 110, 0.15);
  transform: translateY(-1px);
  outline: none;
}
.path-row .path-go { font-size: 12px; color: var(--teal); font-weight: 700; white-space: nowrap; opacity: .75; }
.path-row:hover .path-go { opacity: 1; }
.path-row.selected { border-color: var(--teal); background: var(--teal-soft); }
.path-row.done { background: rgba(31, 111, 99, 0.03); }
.path-week { font-family: var(--serif); font-size: 14px; width: 90px; flex: 0 0 90px; font-weight: 600; }
.path-name { flex: 1; font-size: 14px; }
.chip {
  font-size: 11px;
  padding: 3px 11px;
  border-radius: 12px;
  font-weight: 500;
  border: 1px solid transparent;
}
.chip.full { background: var(--clay-soft); color: var(--clay); border-color: #E4C6BC; }
.chip.part { background: var(--amber-soft); color: var(--amber); border-color: #E7D9AE; }
.chip.none { background: var(--teal-soft); color: var(--teal); border-color: #BCD9D3; }

/* Lesson flow steps */
.steps-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.step-tab {
  flex: 1;
  padding: 12px 10px;
  text-align: center;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}
.step-tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  font-weight: 600;
}
.step-tab.passed {
  background: var(--teal-soft);
  color: var(--teal);
  border-color: #BCD9D3;
}

/* AI Lock Panel */
.lock-panel {
  background: var(--clay-soft);
  border: 1px solid #E4C6BC;
  border-radius: 8px;
  padding: 20px;
}
.lock-title {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--clay);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--clay);
  animation: pulseAnim 2s infinite ease-in-out;
}
@keyframes pulseAnim { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.85); } }

.ai-locked-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid #E4C6BC;
  background: #FCF6F4;
  color: #9A6552;
  cursor: not-allowed;
  position: relative;
}
.ai-locked-btn::after {
  content: 'YOPIQ (403)';
  position: absolute;
  right: 12px;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--clay);
  font-weight: 700;
}

.allowed-tool-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}
.allowed-tool-btn:hover { border-color: var(--teal); background: var(--teal-soft); }

/* Textarea & Buttons */
textarea.task-editor {
  width: 100%;
  min-height: 220px;
  padding: 16px;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.7;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  resize: vertical;
}
textarea.task-editor:focus { outline: 2px solid var(--teal); outline-offset: 1px; }

.btn-primary {
  display: inline-block;
  padding: 12px 24px;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}
.btn-primary:hover { background: var(--ink-2); }
.btn-primary:disabled { background: var(--muted); cursor: not-allowed; }

/* Feedback cards */
.fb-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 12px;
}
.fb-item.grammar { border-left-color: var(--clay); }
.fb-item.lexis { border-left-color: var(--amber); }
.fb-badge {
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 4px;
}
.fb-item.grammar .fb-badge { color: var(--clay); }
.fb-item.lexis .fb-badge { color: var(--amber); }

/* Metacognitive scales */
.scale-group { display: flex; gap: 8px; }
.scale-btn {
  width: 36px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 4px;
  font-size: 13px;
}
.scale-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Modals & Screens */
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .app-container { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .main-content { padding: 20px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* Audio Sound Wave Visualizer */
@keyframes waveAnim {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}
.sound-wave-bar {
  display: inline-block;
  width: 3px;
  height: 6px;
  background: var(--teal);
  border-radius: 2px;
  animation: waveAnim 0.8s ease-in-out infinite;
}
.sound-wave-bar:nth-child(2) { animation-delay: 0.15s; }
.sound-wave-bar:nth-child(3) { animation-delay: 0.3s; }
.sound-wave-bar:nth-child(4) { animation-delay: 0.45s; }
.sound-wave-bar:nth-child(5) { animation-delay: 0.6s; }

/* Audio pleyerlardan yuklab olish (download) tugmasini butunlay yashirish */
audio::-internal-media-controls-download-button {
  display: none !important;
}
audio::-webkit-media-controls-enclosure {
  overflow: hidden;
}

