/* ============================================================
   CPC Obuka — Kategorija C
   Dizajn: granitno-plava + ćilibar akcent + suptilan grid
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
  /* Paleta */
  --bg-deep: #0a1628;
  --bg-elev: #122035;
  --bg-card: #1a2942;
  --bg-card-hover: #213353;
  --border: #28395a;
  --border-bright: #3a4d72;
  
  --text-primary: #f0f4fa;
  --text-secondary: #a8b5cd;
  --text-tertiary: #6b7a96;
  --text-muted: #4a5a78;
  
  --accent: #f59e0b;
  --accent-bright: #fbbf24;
  --accent-soft: #fef3c7;
  
  --success: #34d399;
  --danger: #f87171;
  --info: #60a5fa;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 32px rgba(245, 158, 11, 0.15);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --maxw: 720px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: 
    radial-gradient(ellipse at top, #142340 0%, transparent 60%),
    radial-gradient(ellipse at bottom, #0d1b30 0%, transparent 60%),
    var(--bg-deep);
  background-attachment: fixed;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Suptilan grid pattern u pozadini */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(40, 57, 90, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(40, 57, 90, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   PROTECTION OVERLAYS
   ============================================================ */

.capture-protection-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
}
.capture-protection-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.watermark-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  display: none;
  overflow: hidden;
}
.watermark-layer.active { display: block; }

.watermark-tile {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.05);
  white-space: nowrap;
  transform: rotate(-30deg);
  user-select: none;
}

/* ============================================================
   ANTI-COPY
   ============================================================ */

.quiz-question, .quiz-options, .quiz-explanation, .quiz-image {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ============================================================
   SCREENS / LAYOUT
   ============================================================ */

.screen[hidden] { display: none !important; }
[hidden] { display: none !important; }

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.app-header {
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-brand-mark {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent);
  color: var(--bg-deep);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}
.app-brand-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.app-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-name {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.app-main {
  flex: 1;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ============================================================
   LOGIN
   ============================================================ */

#screen-login,
#admin-recovery {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 20px;
}

.login-container {
  width: 100%;
  max-width: 440px;
  animation: fadeUp 0.6s ease-out;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
  color: var(--accent);
}

.brand-mark {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-deep);
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
}
.brand-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-weight: 500;
}

.login-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab:hover {
  color: var(--text-primary);
}
.auth-tab.active {
  background: var(--accent);
  color: var(--bg-deep);
}

.auth-form[hidden] {
  display: none;
}

.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.success-msg {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 13px;
  line-height: 1.5;
}

.login-form h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.login-hint {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.field {
  display: block;
  margin-bottom: 16px;
}
.field span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.btn {
  appearance: none;
  border: none;
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: var(--bg-deep);
  font-weight: 700;
}
.btn-primary:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.btn-block { width: 100%; margin-top: 8px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.error-msg {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
}

.login-footer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.6;
}
.login-footer strong { color: var(--text-secondary); }

.btn-back {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  margin-left: -12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
}
.btn-back:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ============================================================
   HOME
   ============================================================ */

.welcome {
  margin-bottom: 24px;
}
.welcome h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.welcome h1 span {
  color: var(--accent);
}
.welcome-sub {
  color: var(--text-secondary);
  font-size: 15px;
  margin-top: 4px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mode-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-family: inherit;
  color: inherit;
  width: 100%;
}
.mode-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  transform: translateX(2px);
}
.mode-card:active { transform: scale(0.99); }

.mode-icon {
  width: 56px;
  height: 56px;
  background: var(--bg-elev);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.mode-content {
  flex: 1;
  min-width: 0;
}
.mode-content h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.mode-content p {
  font-size: 13px;
  color: var(--text-tertiary);
}

.mode-badge {
  background: var(--bg-elev);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ============================================================
   THEMES PICKER
   ============================================================ */

.theme-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
}
.theme-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}
.theme-row-name {
  font-weight: 600;
  font-size: 15px;
}
.theme-row-count {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.theme-row-all {
  background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(245,158,11,0.04));
  border-color: rgba(245,158,11,0.3);
}

/* ============================================================
   QUIZ
   ============================================================ */

.quiz-progress {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.quiz-progress span:first-child {
  color: var(--accent);
  font-size: 18px;
}

.quiz-mode {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.progress-bar {
  height: 3px;
  background: var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  width: 0;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-main {
  padding-top: 20px;
}

.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.quiz-theme {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: rgba(245, 158, 11, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.quiz-question {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-bottom: 20px;
}

.quiz-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  background: white;
  padding: 12px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg-elev);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
  color: inherit;
  font-size: 15px;
  line-height: 1.45;
  width: 100%;
}
.option:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}

.option-letter {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.option.correct {
  border-color: var(--success);
  background: rgba(52, 211, 153, 0.08);
}
.option.correct .option-letter {
  background: var(--success);
  color: var(--bg-deep);
  border-color: var(--success);
}

.option.wrong {
  border-color: var(--danger);
  background: rgba(248, 113, 113, 0.08);
}
.option.wrong .option-letter {
  background: var(--danger);
  color: var(--bg-deep);
  border-color: var(--danger);
}

.option:disabled { cursor: default; }

.quiz-explanation {
  margin-top: 20px;
  padding: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  animation: fadeIn 0.3s ease-out;
}
.explanation-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.explanation-icon { font-size: 18px; }
.explanation-title {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}
.quiz-explanation p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ============================================================
   RESULT
   ============================================================ */

.result-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 100px);
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.5s ease-out;
}
.result-emoji { font-size: 64px; margin-bottom: 16px; }
.result-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}
.result-score {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}
.result-score-big {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}
.result-score-pct {
  font-size: 18px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 8px;
  font-family: var(--font-mono);
}
.result-message {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 24px;
}
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================================
   PROGRESS
   ============================================================ */

.section-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--text-secondary);
}

.progress-overview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}
.progress-overview .big-pct {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1;
}
.progress-overview .label {
  color: var(--text-tertiary);
  font-size: 13px;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-progress-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.theme-progress-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.theme-progress-row .name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}
.theme-progress-row .name .pct {
  font-family: var(--font-mono);
  color: var(--accent);
}
.theme-progress-bar {
  height: 6px;
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: hidden;
}
.theme-progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 999px;
}

.mistakes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mistake-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.mistake-row .title {
  font-size: 13px;
  flex: 1;
}
.mistake-row .count {
  color: var(--danger);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

/* ============================================================
   BOTTOM NAVIGATION (mobile-first)
   ============================================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav[hidden] { display: none; }

.nav-item {
  flex: 1;
  appearance: none;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  min-height: 56px;
  transition: color 0.15s, transform 0.1s;
}
.nav-item .nav-icon {
  font-size: 22px;
  line-height: 1;
  filter: grayscale(0.4);
  transition: filter 0.15s, transform 0.15s;
}
.nav-item .nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.nav-item:active { transform: scale(0.94); }
.nav-item.active { color: var(--accent); }
.nav-item.active .nav-icon {
  filter: grayscale(0);
  transform: translateY(-1px) scale(1.08);
}

/* Make room for the fixed nav so content isn't hidden behind it */
body.has-bottom-nav .app-main {
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* ============================================================
   VIEW CARDS (Испит / Грешке prikazi)
   ============================================================ */

.view-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  text-align: center;
  max-width: 440px;
  margin: 24px auto;
  box-shadow: var(--shadow-md);
}
.view-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 14px;
}
.view-card h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.view-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}
.view-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 14px;
  margin-bottom: 20px;
}

/* ============================================================
   SIDE NAVIGATION (desktop ≥768px)
   ============================================================ */

.side-nav { display: none; }

@media (min-width: 768px) {
  /* Na desktopu: sakrij donju traku, prikaži bočnu */
  .bottom-nav { display: none; }
  body.has-bottom-nav .app-main {
    padding-bottom: 48px;
  }

  .side-nav:not([hidden]) {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    z-index: 200;
    background: rgba(10, 22, 40, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    gap: 4px;
  }

  .side-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
  }

  .side-nav .nav-item {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    min-height: 48px;
    border-radius: var(--radius-md);
    transition: color 0.15s, background 0.15s;
  }
  .side-nav .nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
  }
  .side-nav .nav-item.active {
    background: var(--bg-card);
    color: var(--accent);
  }
  .side-nav .nav-item .nav-icon { font-size: 20px; }
  .side-nav .nav-item .nav-label { font-size: 14px; }
  .side-nav .nav-item.active .nav-icon { transform: none; }

  /* Pomeri sadržaj ekrana udesno kad je bočna navigacija vidljiva */
  body.has-bottom-nav .screen {
    padding-left: 220px;
  }
}

/* ============================================================
   TOAST
   ============================================================ */

.toast {
  position: fixed;
  bottom: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  animation: toastUp 0.2s ease-out;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--success); color: var(--success); }

@keyframes toastUp {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Touch-friendly targets across the board */
.option { min-height: 48px; }
.mode-card, .theme-row { min-height: 56px; }
.btn { min-height: 44px; }

@media (max-width: 600px) {
  /* No horizontal scroll, ever */
  html, body { overflow-x: hidden; }

  .app-header-inner { padding: 12px 16px; }
  .app-main { padding: 20px 16px 40px; }
  .login-form { padding: 24px 20px; }
  .welcome h1 { font-size: 26px; }
  .result-card { padding: 32px 24px; }
  .result-score-big { font-size: 40px; }
  .stat-value { font-size: 24px; }

  /* ---------- FULL-SCREEN QUIZ ----------
     Goal: question + image + 4 options fit on one screen without scrolling.
     The card is a flex column: theme/question/options keep their size,
     the image is the flexible element that shrinks to fit. Scrolling is a
     last-resort safety net (e.g. very long questions or the explanation). */
  #screen-quiz { height: 100vh; height: 100dvh; overflow: hidden; }

  .quiz-main {
    flex: 1;
    display: flex;
    padding: 10px 12px 14px;
    min-height: 0;
  }
  .quiz-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 14px 14px 16px;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .quiz-theme { margin-bottom: 8px; flex: 0 0 auto; }
  .quiz-question {
    font-size: 17px;
    line-height: 1.28;
    margin-bottom: 10px;
    flex: 0 0 auto;
  }
  /* Image shrinks to keep options visible; never grows past ~30vh */
  .quiz-image {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 30vh;
    width: auto;
    margin: 0 auto 10px;
    display: block;
    object-fit: contain;
    padding: 6px;
  }
  /* Options must always stay fully visible — never shrink */
  .quiz-options {
    gap: 8px;
    flex: 0 0 auto;
    margin-top: auto;
  }
  .option {
    padding: 10px 12px;
    font-size: 14px;
    gap: 10px;
    align-items: center;
    min-height: 48px;
  }
  .option-letter { width: 26px; height: 26px; }
  .quiz-explanation {
    margin-top: 12px;
    padding: 14px;
    flex: 0 0 auto;
  }

  /* Touch buttons get bigger tap area */
  .btn { min-height: 48px; }
}

/* Print disabled */
@media print {
  body * { visibility: hidden !important; }
  body::after {
    content: 'Štampanje sadržaja kursa nije dozvoljeno.';
    visibility: visible;
    display: block;
    text-align: center;
    padding: 40px;
    color: black;
  }
}
