 /* ===== CSS Custom Properties ===== */
:root {
  --bg-dark: #000;
  --sidebar-bg: #000;
  --sidebar-border: rgba(255,255,255,0.06);
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.08);
  --primary: #7c4dff;
  --primary-light: #9d7cff;
  --primary-glow: rgba(124, 77, 255, 0.3);
  --accent: #f43f5e;
  --success: #10b981;
  --warning: #f59e0b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: rgba(255,255,255,0.1);
  --paper: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-size: 14px;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 320px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #11131a 0%, #0d0f14 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
  position: relative;
}

/* Sidebar Scrollbar styling */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 77, 255, 0.3), transparent);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 20px;
  background: transparent; /* TRANSPARENT TO MATCH SIDEBAR */
}

.brand-icon {
  font-size: 32px;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(124, 77, 255, 0.4));
}

.brand-title {
  font-family: 'Nunito', sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #fff;
  opacity: 0.9;
}

.brand-source {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ===== Nav Tabs ===== */
.sidebar-nav {
  display: flex;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  margin: 0 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-tab svg { width: 20px; height: 20px; margin-bottom: 2px; opacity: 0.7; }

.nav-tab:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-tab.active { 
  background: linear-gradient(135deg, var(--primary), #6366f1); 
  color: white; 
  box-shadow: 0 8px 16px rgba(124, 77, 255, 0.25);
}
.nav-tab.active svg { opacity: 1; }

/* ===== Tab Content ===== */
.tab-content { display: none; padding: 0 16px 24px; }
.tab-content.active { display: flex; flex-direction: column; gap: 20px; }

/* Scrollbar styling */
.tab-content::-webkit-scrollbar { width: 4px; }
.tab-content::-webkit-scrollbar-track { background: transparent; }
.tab-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

/* ===== Sidebar Sections ===== */
.sidebar-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 18px;
  transition: border-color 0.2s;
}
.sidebar-section:hover { border-color: rgba(124, 77, 255, 0.2); }

.sidebar-section-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.1), transparent);
  margin-left: 10px;
}

/* ===== Config Sections & Labels ===== */
.config-section { margin-bottom: 16px; }
.config-section:last-child { margin-bottom: 0; }

.config-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  opacity: 0.9;
}

.stepper {
  display: flex;
  align-items: center;
  background: #1a1c24;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
}

.stepper-btn {
  flex: 1;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--primary-light);
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}
.stepper-btn:hover { background: rgba(255,255,255,0.05); }

.stepper-val {
  flex: 1.2;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  border-left: 1px solid rgba(255,255,255,0.1);
  border-right: 1px solid rgba(255,255,255,0.1);
  line-height: 44px;
}

/* ===== Difficulty Grid ===== */
.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.diff-btn {
  padding: 10px 2px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
}

.diff-btn:hover { border-color: var(--primary); color: #fff; }
.diff-btn.active {
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.2), rgba(99, 102, 241, 0.2));
  border-color: var(--primary);
  color: #fff;
  box-shadow: inset 0 0 12px rgba(124, 77, 255, 0.1);
}

/* ===== Apply Button ===== */
.btn-apply {
  background: rgba(124, 77, 255, 0.1);
  border: 1px solid rgba(124, 77, 255, 0.3);
  color: var(--primary-light);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-apply:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* ===== Exercise Type Toggles ===== */
.exercise-types { display: flex; flex-direction: column; gap: 6px; }

.type-toggle {
  cursor: pointer;
  user-select: none;
}

.type-toggle input { display: none; }

.toggle-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s;
  color: var(--text-muted);
  font-size: 13px;
}

.toggle-icon { font-size: 16px; }

.type-toggle input:checked + .toggle-body {
  border-color: var(--primary);
  color: var(--text);
  background: rgba(108,99,255,0.08);
}

.toggle-body:hover { background: var(--surface-hover); color: var(--text); }

/* ===== Generate Button ===== */
.btn-generate {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  box-shadow: 0 4px 15px rgba(124, 77, 255, 0.4);
  position: relative;
  overflow: hidden;
}

.btn-generate::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-generate:hover::before {
  left: 100%;
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 77, 255, 0.6);
  filter: brightness(1.1);
}

.btn-generate:active { transform: translateY(0); scale: 0.98; }

.btn-generate.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* ===== Static Tab – Worksheet List ===== */
.static-actions {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-light);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
}

.btn-link:hover { color: var(--primary); text-decoration: underline; }

.worksheet-list { display: flex; flex-direction: column; gap: 4px; }

.worksheet-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.worksheet-item:hover { background: var(--surface); }
.worksheet-item.selected { background: rgba(108,99,255,0.1); border-color: var(--primary); }

.worksheet-item input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--primary);
}

.worksheet-info h4 { font-size: 12px; font-weight: 600; color: var(--text); }
.worksheet-info p { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== Sidebar Footer ===== */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.btn-print {
  width: 100%;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-print:hover { background: var(--surface-hover); border-color: var(--primary); color: var(--primary-light); }

/* ===== Main Area ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #12141a;
}

.main-header {
  display: flex !important;
  flex-direction: column !important;
  gap: 15px !important;
  padding: 16px 20px !important;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.main-header-top {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  gap: 15px !important;
}

.main-header-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

#preview-title {
  margin: 0 !important;
  font-size: 1.35rem !important;
  font-weight: 750 !important;
  color: var(--text-primary);
}

.main-header-right {
  display: flex !important;
  align-items: center !important;
}

#header-generate-btn {
  background: linear-gradient(135deg, var(--primary), #a855f7) !important;
  color: white !important;
  border: none !important;
  padding: 10px 18px !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  transition: all 0.2s ease !important;
}

#header-generate-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(124, 77, 255, 0.3) !important;
}

/* Ensure buttons in header look consistent and don't take 100% width */
.action-bar-header button {
  white-space: nowrap !important;
  padding: 8px 14px !important;
  font-size: 13px !important;
  margin: 0 !important;
  width: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.page-count {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
}

.print-hint {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface);
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

/* ===== Paper Container ===== */
.paper-container {
  flex: 1;
  overflow-y: auto;
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 60px;
  background: radial-gradient(circle at center, #1a1c24 0%, var(--bg-dark) 100%);
  scroll-behavior: smooth;
  min-height: 100%;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 40px;
}

.empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--text-dim); line-height: 1.6; }

/* ===== Page Wrapper in Preview ===== */
.page-preview-wrapper {
  width: 210mm;
  flex-shrink: 0;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  transform-origin: top center;
  filter: drop-shadow(0 30px 60px rgba(0,0,0,0.5));
}

.page-preview-wrapper:hover { 
  transform: translateY(-8px) scale(1.02);
  filter: drop-shadow(0 40px 80px rgba(0,0,0,0.7));
}

/* ===== Worksheet Page (A4) ===== */
.worksheet-page {
  width: 210mm;
  height: 297mm;
  overflow: hidden;
  box-sizing: border-box;
  background: var(--paper);
  box-shadow: var(--shadow-xl);
  border-radius: 4px;
  padding: 18mm 16mm;
  color: #000; /* Pure black */
  font-family: 'Nunito', 'Inter', sans-serif;
  position: relative;
  break-after: page;
  page-break-after: always;
  display: block;
  margin: 0 auto;
}

/* Font Variations */
.worksheet-page.font-nunito { font-family: 'Nunito', sans-serif; }
.worksheet-page.font-outfit { font-family: 'Outfit', sans-serif; }
.worksheet-page.font-roboto { font-family: 'Roboto', sans-serif; }
.worksheet-page.font-opensans { font-family: 'Open Sans', sans-serif; }
.worksheet-page.font-inter { font-family: 'Inter', sans-serif; }

/* Clinic Name Font Variations */
.ws-clinic-name.font-inter { font-family: 'Inter', sans-serif; font-size: 14pt; }
.ws-clinic-name.font-nunito { font-family: 'Nunito', sans-serif; font-size: 14pt; }
.ws-clinic-name.font-outfit { font-family: 'Outfit', sans-serif; font-size: 14pt; }
.ws-clinic-name.font-roboto { font-family: 'Roboto', sans-serif; font-size: 14pt; }
.ws-clinic-name.font-opensans { font-family: 'Open Sans', sans-serif; font-size: 14pt; }
.ws-clinic-name.font-pacifico { font-family: 'Pacifico', cursive; font-size: 16pt; line-height: 1.2; margin-top: -5pt; }
.ws-clinic-name.font-dancing { font-family: 'Dancing Script', cursive; font-size: 18pt; line-height: 1; }
.ws-clinic-name.font-playfair { font-family: 'Playfair Display', serif; font-size: 15pt; font-weight: 700; }
.ws-clinic-name.font-montserrat { font-family: 'Montserrat', sans-serif; font-size: 13pt; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5pt; }
.ws-clinic-name.font-caveat { font-family: 'Caveat', cursive; font-size: 20pt; line-height: 0.9; }

/* ===== Worksheet Internal Styles ===== */
.ws-header {
  text-align: center;
  border-bottom: 2pt solid #333;
  padding-bottom: 8pt;
  margin-bottom: 18pt;
}

.ws-title {
  font-size: 11pt;
  color: #000;
}

.ws-subtitle {
  font-size: 16pt;
  font-weight: 800;
  text-transform: uppercase;
  margin-top: 4pt;
  color: #111;
}

.ws-clinic-name {
  font-size: 11pt;
  font-weight: 700;
  color: #000;
  margin-bottom: 4pt;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ws-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  font-size: 60pt;
  color: rgba(0,0,0,0.03);
  font-weight: 900;
  white-space: nowrap;
  pointer-events: auto; /* clickable for links */
  z-index: 10;
  user-select: none;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(0,0,0,0.04);
  transition: color 0.3s, text-decoration-color 0.3s;
}

@media screen {
  .ws-watermark:hover, .ws-watermark:active {
    color: rgba(0,0,0,0.12);
    text-decoration-color: rgba(0,0,0,0.12);
  }
}

@media print {
  .ws-watermark {
    text-decoration: none !important;
  }
}

.ws-instruction {
  color: #000;
  font-style: italic;
  margin-bottom: 14pt;
  line-height: 1.5;
  padding: 8pt 10pt;
  background: #f8f8f8;
  border-left: 3pt solid #ccc;
  border-radius: 0 4pt 4pt 0;
}

/* Exercise list */
.ws-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10pt;
}

.ws-list li {
  font-size: 12pt;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10pt;
}

.ws-list-bullet {
  width: 8pt; height: 8pt;
  border-radius: 50%;
  background: #333;
  flex-shrink: 0;
}

/* Copy words list */
.ws-copy-list { list-style: none; display: flex; flex-direction: column; gap: 10pt; }
.ws-copy-list.grid-2-col {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  column-gap: 25pt !important;
  row-gap: 6pt !important;
}

.ws-copy-row {
  display: flex;
  align-items: center;
  gap: 10pt;
  font-size: 14pt;
  font-weight: 800;
}

.ws-copy-row .dash { color: #888; font-weight: 400; }

.ws-dotted-line {
  flex: 1;
  border-bottom: 1.5pt dotted #999;
  height: 16pt;
}

/* Letter grid copy */
.ws-letter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12pt;
  margin-top: 10pt;
}

.ws-letter-item {
  display: flex;
  align-items: center;
  gap: 8pt;
}

.ws-letter-big {
  font-size: 20pt;
  font-weight: 800;
  min-width: 24pt;
}

.ws-letter-line {
  flex: 1;
  border-bottom: 1.5pt dotted #999;
  height: 18pt;
}

/* Icons list */
.ws-icons-list { display: flex; flex-direction: column; gap: 26pt; margin-top: 10pt; }

.ws-icon-row {
  display: flex;
  align-items: center;
  gap: 16pt;
}

.ws-icon-svg {
  width: 52pt; height: 52pt;
  border: 1.5pt solid #ddd;
  border-radius: 8pt;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #fafafa;
}

.ws-icon-svg svg {
  width: 36pt; height: 36pt;
}

.ws-icon-word { font-size: 16pt; font-weight: 800; min-width: 80pt; }

/* Syllable reading */
.ws-syllable-block { display: flex; flex-direction: column; gap: 8pt; margin-top: 8pt; }

.ws-syllable-row {
  font-size: 14pt;
  font-weight: 700;
  letter-spacing: 4pt;
  color: #111;
  text-align: center;
  font-family: 'Courier New', monospace;
}

.ws-syllable-sep { height: 10pt; }

/* Identify letter */
.ws-identify-title {
  font-size: 12pt;
  font-weight: 800;
  margin-bottom: 14pt;
}

.ws-identify-title .target {
  display: inline-block;
  background: #111;
  color: white;
  padding: 2pt 8pt;
  border-radius: 4pt;
  margin: 0 4pt;
}

.ws-identify-grid {
  font-size: 14pt;
  font-weight: 600;
  letter-spacing: 6pt;
  line-height: 2.4;
  font-family: 'Courier New', monospace;
}

.ws-identify-grid .highlight { font-weight: 900; text-decoration: underline; }

.ws-identify-words {
  font-size: 12pt;
  font-weight: 600;
  word-spacing: 12pt;
  line-height: 2.2;
}

.ws-identify-words .highlight { font-weight: 900; text-decoration: underline; }

/* Pattern exercise */
.ws-patterns { display: flex; flex-direction: column; gap: 24pt; margin-top: 10pt; }

.ws-pattern-title {
  font-size: 10pt;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1pt;
  margin-bottom: 6pt;
}

.ws-pattern-row {
  font-size: 14pt;
  font-weight: 700;
  letter-spacing: 3pt;
  font-family: 'Courier New', monospace;
}

.ws-pattern-blank { color: #bbb; }

/* Paronime */
.ws-paronime-list { display: flex; flex-direction: column; gap: 16pt; margin-top: 8pt; }

.ws-paronime-row {
  display: flex;
  align-items: center;
  gap: 10pt;
  font-size: 14pt;
  font-weight: 800;
}

.ws-par-word {
  min-width: 90pt;
  color: #111;
}

.ws-par-sep {
  color: #aaa;
  font-weight: 400;
  font-size: 12pt;
}

/* Propoziții */
.ws-sentences-list { display: flex; flex-direction: column; gap: 7pt; margin-top: 6pt; }

.ws-sentence-row { display: flex; flex-direction: column; gap: 2pt; }

.ws-sentence-text {
  font-size: 11pt;
  font-weight: 700;
  color: #111;
  line-height: 1.2;
}

.ws-sentence-row .ws-dotted-line {
  height: 10pt;
}

/* Numărare silabe */
.ws-count-list { display: flex; flex-direction: column; gap: 14pt; margin-top: 8pt; }

.ws-count-row {
  display: flex;
  align-items: center;
  gap: 12pt;
}

.ws-count-word {
  font-size: 14pt;
  font-weight: 800;
  min-width: 110pt;
  color: #111;
}

.ws-count-boxes {
  display: flex;
  gap: 5pt;
}

.ws-count-box {
  width: 20pt;
  height: 20pt;
  border: 1.5pt solid #555;
  border-radius: 3pt;
}

.ws-count-label {
  font-size: 11pt;
  color: #555;
  font-weight: 600;
  white-space: nowrap;
}

/* Litere Lipsa */
.ws-missing-list { display: flex; flex-direction: column; gap: 14pt; margin-top: 8pt; }
.ws-missing-row { display: flex; align-items: center; gap: 12pt; }
.main-header-left { display: flex; align-items: center; gap: 12px; }
.main-header h2 { font-size: 16px; font-weight: 700; margin: 0; }
.ws-missing-display { font-size: 16pt; font-weight: 800; min-width: 140pt; letter-spacing: 4px; color: #111; }

/* Silabe amestecate */
.ws-unscramble-list { display: flex; flex-direction: column; gap: 16pt; margin-top: 8pt; }
.ws-unscramble-row { display: flex; align-items: center; gap: 12pt; }
.ws-unscramble-display { font-size: 16pt; font-weight: 700; min-width: 180pt; color: #111; }

/* Antonime */
.ws-opposites-list { display: flex; flex-direction: column; gap: 14pt; margin-top: 8pt; }
.ws-opposites-row { display: flex; align-items: center; gap: 14pt; }
.ws-opposites-word { font-size: 15pt; font-weight: 800; min-width: 100pt; color: #111; }
.ws-opposites-arrow { font-size: 14pt; color: #666; font-weight: bold; }

/* Sinonime */
.ws-synonyms-list { display: flex; flex-direction: column; gap: 14pt; margin-top: 8pt; }
.ws-synonyms-row { display: flex; align-items: center; gap: 14pt; }
.ws-synonyms-word { font-size: 15pt; font-weight: 800; min-width: 100pt; color: #111; }
.ws-synonyms-arrow { font-size: 14pt; color: #666; font-weight: bold; }

/* Element Infiltrat */
.ws-odd-list { display: flex; flex-direction: column; gap: 14pt; margin-top: 12pt; }
.ws-odd-row { 
  display: grid; 
  grid-template-columns: repeat(4, 1fr); 
  gap: 12pt;
  padding: 12pt; 
  background: #fdfdfd; 
  border: 1pt solid #eee;
  border-radius: 8pt; 
}
.ws-odd-word { 
  font-size: 13pt; 
  font-weight: 800; 
  color: #111; 
  text-align: center;
  padding: 4pt;
  border: 1pt solid transparent;
}

/* Silaba Lipsa */
.ws-missing-syll-list { display: flex; flex-direction: column; gap: 14pt; margin-top: 8pt; }
.ws-missing-syll-row { display: flex; align-items: center; gap: 12pt; }
.ws-missing-syll-display { font-size: 16pt; font-weight: 800; min-width: 180pt; letter-spacing: 4px; color: #111; }

.ws-error {
  padding: 20pt;
  border: 2pt dashed var(--rose);
  border-radius: 8pt;
  color: var(--rose);
  font-family: inherit;
  text-align: center;
}

.ws-error-title { font-weight: 800; font-size: 14pt; margin-bottom: 8pt; }
.ws-error-msg { font-size: 10pt; opacity: 0.8; }


/* Page number */
.ws-footer {
  position: absolute;
  bottom: 10mm;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12pt;
}

.ws-page-num {
  font-size: 9pt;
  color: #aaa;
}

.ws-source {
  font-size: 7pt;
  color: #ccc;
  font-style: italic;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== Interactive Games ===== */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
}

.game-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
}

.game-score {
  font-size: 18px;
  font-weight: 700;
  color: var(--amber);
}

.game-score-val { color: white; }

.game-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  overflow-y: auto;
}

/* Match Word Game Styles */
.game-match-image {
  width: 180px; height: 180px;
  background: white;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-match-image svg { width: 120px; height: 120px; }

.game-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 500px;
}

.game-option-btn {
  padding: 20px;
  font-size: 24px;
  font-weight: 800;
  background: var(--sidebar-bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.game-option-btn:hover {
  background: var(--primary-glow);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.game-option-btn.correct {
  background: var(--green);
  border-color: var(--green);
  color: #000;
  animation: successPulse 0.5s;
}

.game-option-btn.wrong {
  background: var(--rose);
  border-color: var(--rose);
  color: #fff;
  animation: shake 0.4s;
}

/* Find Letter Game Styles */
.game-find-target {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 30px;
  text-align: center;
}

.game-find-target span {
  display: inline-block;
  padding: 4px 16px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  margin-left: 10px;
}

.game-find-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-width: 800px;
}

.game-letter-btn {
  width: 60px; height: 60px;
  font-size: 28px;
  font-weight: 700;
  background: var(--sidebar-bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.game-letter-btn:hover { border-color: var(--primary-light); }
.game-letter-btn.correct { background: var(--green); border-color: var(--green); color: #000; pointer-events: none; }
.game-letter-btn.wrong { background: var(--rose); border-color: var(--rose); color: #fff; pointer-events: none; opacity: 0.5; }

/* Animations */
@keyframes popIn { 0% { opacity: 0; transform: scale(0.5); } 100% { opacity: 1; transform: scale(1); } }
@keyframes successPulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ===== Responsive Styles ===== */
@media (max-width: 1024px) {
  .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: white;
  z-index: 1000;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* ENTIRE SIDEBAR SCROLLS */
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
}

  .sidebar.collapsed {
    transform: translateX(-100%);
  }
}

/* Mobile specific fixes (v15) */
@media (max-width: 768px) {
  body {
    flex-direction: column;
    overflow-y: auto !important;
  }

  /* The sidebar falls back to the 1024px fixed-drawer styles. */
  /* Remove the static/relative overrides that made it an accordion. */
  .sidebar {
    width: 85vw !important; /* Slightly wider on mobile */
  }

  .main {
    flex: 1;
    overflow-y: auto !important;
  }

  /* Keep overlay visible when active */
  .sidebar-overlay {
    display: block;
  }

  #sidebar-toggle {
    display: flex !important;
    position: absolute !important;
    top: 10px !important;
    left: 15px !important;
    z-index: 1001 !important;
    width: 44px !important;
    height: 44px !important;
    background: #333 !important; /* DARK BACKGROUND */
    color: #fff !important; /* WHITE ICON */
    border: none !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3) !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .sidebar-brand-wrapper {
    padding-left: 65px !important; /* CLEAR SPACE FOR TOGGLE */
    min-height: 64px !important;
    display: flex !important;
    align-items: center !important;
    background: transparent !important;
  }

  .brand-title {
    font-size: 1.25rem !important;
    margin: 0 !important;
  }

  #preview-title {
    margin-left: 52px !important; /* MAKE ROOM FOR TOGGLE IN HEADER */
    font-size: 1.1rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 140px !important;
  }

  .main-header-top {
    min-height: 64px !important;
    display: flex !important;
    align-items: center !important;
  }

  .action-bar-header {
    gap: 8px !important;
    width: 100% !important;
  }

  .action-bar-header button {
    flex: 1 1 auto !important;
    min-width: 100px !important;
    padding: 10px !important;
    font-size: 12px !important;
  }
  
  #btn-clear {
     flex: 1 1 100% !important;
  }

  /* Paper scaling on mobile */
  .paper-container {
    padding: 20px 10px !important;
    gap: 20px !important;
  }

  .page-preview-wrapper {
    width: 95vw !important;
    margin: 0 auto !important;
    --paper-scale: calc(95vw / 210mm) !important;
    transform: scale(var(--paper-scale)) !important;
    transform-origin: top center !important;
    height: calc(296mm * var(--paper-scale)) !important;
  }

  .page-preview-wrapper:hover {
    transform: scale(var(--paper-scale)) !important;
  }

  .sidebar {
    width: 85% !important;
  }
}

/* Ensure generate button looks like before (Simple & Powerful) */
#btn-generate-top {
  /* Inherits most from inlined, but let's ensure text-align */
  text-align: center !important;
  transition: all 0.2s ease !important;
}
#btn-generate-top:hover {
  filter: brightness(1.1) !important;
  transform: translateY(-1px) !important;
}

/* Mobile Nav Overrides */
@media (max-width: 1024px) {
  .sidebar-nav {
    display: none !important;
  }
  .bottom-nav {
    display: flex !important;
  }
  .main {
    padding-bottom: 70px !important; /* Space for bottom nav */
  }
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 70px;
  background: rgba(13, 15, 20, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 100;
  padding: 0 10px;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 0;
  cursor: pointer;
  transition: all 0.2s;
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
  opacity: 0.7;
}

.bottom-nav-item.active {
  color: var(--primary-light);
}

.bottom-nav-item.active svg {
  opacity: 1;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 5;
}

.sidebar-overlay.active {
  display: block;
}

/* Hamburger button in header */
#sidebar-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: #fff;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ===== Print ===== */
.print-container { display: none; }

@media print {
  /* Hide ALL UI elements */
  .no-print,
  .sidebar,
  .main-header,
  .bottom-nav,
  .modal-overlay,
  .sidebar-overlay,
  .confirm-bar,
  .page-preview-wrapper,
  .paper-container,
  .game-container,
  #sidebar-toggle,
  .btn-clear,
  .btn-print,
  .btn-generate,
  .action-bar-header,
  .tier-badge,
  .page-count,
  .empty-state { 
    display: none !important; 
    visibility: hidden !important;
  }
  
  html, body { 
    margin: 0 !important; 
    padding: 0 !important; 
    background: white !important; 
    height: auto !important; 
    min-height: auto !important;
    overflow: visible !important; 
    position: static !important;
    display: block !important;
    width: 100% !important;
  }

  body > * {
    display: none !important;
  }

  .print-container {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    width: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .print-container * { 
    visibility: visible !important; 
  }

  .worksheet-page {
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    margin: 0 !important;
    padding: 18mm 16mm !important;
    position: relative !important;
    box-sizing: border-box !important;
    page-break-after: always !important;
    break-after: page !important;
    overflow: hidden !important;
    display: block !important;
    background: white !important;
  }

  .worksheet-page:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  @page { 
    size: A4; 
    margin: 0mm !important; 
  }
}

