:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --secondary: #F59E0B;
  --accent: #EC4899;
  --bg: #EFF6FF;
  --fg: #0F172A;
  --card: #FFFFFF;
  --success: #22C55E;
  --danger: #DC2626;
  --muted: #475569;
  --radius: 20px;
  --border: 3px solid #0F172A;
  --shadow: 4px 4px 8px rgba(15, 23, 42, .12), inset -2px -2px 8px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--fg);
}

h1, h2, h3 { font-family: 'Baloo 2', cursive; margin: 0 0 .5rem; }

a { color: var(--primary); text-decoration: none; }

.nav {
  display: flex; align-items: center; gap: 1rem;
  background: var(--card); padding: .75rem 1.5rem;
  border-bottom: var(--border); flex-wrap: wrap;
}
.brand { font-family: 'Baloo 2', cursive; font-size: 1.3rem; font-weight: 700; color: var(--fg); }
.nav-links { display: flex; gap: .75rem; flex-wrap: wrap; }
.nav-links a { color: var(--fg); font-weight: 600; }
.nav-links a:hover { color: var(--primary); }
.child-switch select {
  border: 2px solid var(--fg); border-radius: 12px; padding: .35rem .5rem;
  font-family: inherit; background: var(--card);
}
.logout { margin-left: auto; font-weight: 700; color: var(--danger); }

main { max-width: 1000px; margin: 0 auto; padding: 1.5rem; }

.hero {
  background: var(--card); border: var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.5rem;
}

.card {
  background: var(--card); border: var(--border); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.subject-card { display: block; color: var(--fg); font-weight: 700; transition: transform .2s; }
.subject-card:hover { transform: translateY(-3px); background: #F1F5FD; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-weight: 700; font-size: .85rem; }
.badge-odlican, .badge-odličan { background: var(--success); color: #fff; }
.badge-vrlodobar { background: #3B82F6; color: #fff; }
.badge-dobar { background: var(--secondary); color: #fff; }
.badge-dovoljan { background: var(--accent); color: #fff; }
.badge-nedovoljan { background: var(--danger); color: #fff; }

button, .btn {
  font-family: inherit; font-weight: 700; cursor: pointer;
  background: var(--primary); color: #fff; border: 3px solid var(--fg);
  border-radius: 14px; padding: .5rem 1rem; box-shadow: 3px 3px 0 var(--fg);
  transition: transform .15s ease-out;
}
button:hover, .btn:hover { transform: translate(-1px, -1px); }
button:active, .btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--fg); }
.btn-secondary { background: var(--secondary); }
.btn-accent { background: var(--accent); }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; border-width: 2px; border-radius: 10px; box-shadow: 2px 2px 0 var(--fg); }

form p { margin: .5rem 0; }
input, select, textarea {
  font-family: inherit; font-size: .95rem;
  border: 2px solid var(--fg); border-radius: 10px; padding: .4rem .5rem;
  width: 100%; max-width: 420px; background: #fff;
}
textarea { min-height: 90px; }
label { font-weight: 700; display: block; margin-bottom: .2rem; }
.helptext { color: var(--muted); font-size: .85rem; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid #E4ECFC; }
th { font-family: 'Baloo 2', cursive; }

.messages { margin-bottom: 1rem; }
.msg { padding: .6rem 1rem; border-radius: 12px; font-weight: 600; margin-bottom: .5rem; border: 2px solid var(--fg); }
.msg.success { background: #DCFCE7; }
.msg.warning { background: #FEF3C7; }
.msg.error { background: #FEE2E2; }

.muted { color: var(--muted); }
.inline-form { display: inline; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0; }
.lesson-content { max-height: 240px; overflow: auto; white-space: pre-wrap; background: #F8FAFF; border-radius: 12px; padding: .75rem; }

/* Loading overlay za AI operacije */
#loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 1rem; text-align: center;
  background: rgba(248, 250, 255, 0.92);
}
#loading-overlay.show { display: flex; }
.spinner {
  width: 60px; height: 60px; border: 6px solid var(--primary);
  border-top-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-overlay .loading-text {
  font-family: 'Baloo 2', cursive; font-size: 1.15rem; font-weight: 700; color: var(--fg);
  padding: 0 1rem;
}

/* Mreža rasporeda na dashboardu */
.timetable-scroll { overflow-x: auto; }
.timetable-grid { min-width: 640px; }
.timetable-grid th, .timetable-grid td { text-align: center; vertical-align: middle; }
.timetable-grid td.period {
  text-align: left; font-weight: 700; white-space: nowrap; background: #F0F5FF;
}
.timetable-grid td.period small { color: var(--muted); font-weight: 400; }
.timetable-grid tbody td { min-width: 90px; }


/* P2.5 — interaktivni kviz, progres i grafik aktivnosti */
.progress-wrap { margin: .75rem 0 1.25rem; }
.progress {
  width: 100%; height: 18px; background: #DBEAFE;
  border: 2px solid var(--fg); border-radius: 999px; overflow: hidden;
}
.progress-bar {
  height: 100%; width: 0; background: var(--success);
  transition: width .3s ease-out;
}

.options { margin-top: .5rem; }
.option {
  display: block; font-weight: 600; margin: .25rem 0;
  cursor: pointer; padding: .15rem .3rem; border-radius: 8px;
}
.option input { width: auto; margin-right: .4rem; }
.options.locked { pointer-events: none; opacity: .85; }

.question.q-correct { border-color: var(--success); }
.question.q-wrong { border-color: var(--danger); }
.feedback {
  margin-top: .6rem; padding: .5rem .75rem; border-radius: 12px;
  font-weight: 700; border: 2px solid var(--fg);
}
.feedback.quiz-ok { background: #DCFCE7; }
.feedback.quiz-bad { background: #FEE2E2; }
.quiz-summary h2 { margin-bottom: .75rem; }
.next-btn { margin-top: .6rem; }

/* Grafikon aktivnosti (14 dana) — čist CSS */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.chart-col {
  flex: 1 1 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; height: 100%;
}
.chart-bar {
  width: 100%; max-width: 28px; background: var(--primary);
  border-radius: 6px 6px 0 0; min-height: 3px;
}
.chart-bar.chart-today { background: var(--secondary); }
.chart-label { font-size: .7rem; color: var(--muted); margin-top: .25rem; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.stat-grid .stat-num {
  display: block; font-family: 'Baloo 2', cursive;
  font-size: 1.6rem; font-weight: 700; color: var(--primary);
}

@media (max-width: 700px) {
  .option { font-size: 1.05rem; padding: .35rem .3rem; }
  .chart { height: 110px; }
  .chart-label { font-size: .6rem; }
}

