/* Elektronska Pedagoška Sveska - Stilovi */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif:wght@400;700&display=swap');

:root {
  --primary: #1a3a5c;
  --primary-light: #2756a0;
  --secondary: #c0392b;
  --accent: #2980b9;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --bg: #f0f2f5;
  --sidebar-bg: #1a3a5c;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #dde3ea;
  --header-height: 64px;
  --sidebar-width: 280px;
}

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

body {
  font-family: 'Segoe UI', 'Noto Serif', serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ---- LAYOUT ---- */
#app { display: flex; flex-direction: column; min-height: 100vh; }

.header {
  background: var(--primary);
  color: white;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  gap: 16px;
}

.header-logo {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo .fa-book-open { color: #f39c12; }

.header-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}

.header-teacher {
  background: rgba(255,255,255,0.1);
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-year-select {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.header-year-select option { background: var(--primary); color: white; }

.main-layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: white;
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 900;
  transition: transform 0.3s;
}

.sidebar-section { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.5);
  padding: 8px 20px 4px;
  font-weight: 600;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.2s;
  font-size: 13.5px;
}

.sidebar-item:hover { background: rgba(255,255,255,0.08); color: white; border-left-color: rgba(255,255,255,0.4); }
.sidebar-item.active { background: rgba(255,255,255,0.15); color: white; border-left-color: #f39c12; font-weight: 600; }
.sidebar-item i { width: 18px; text-align: center; }

.sidebar-classes { padding: 0; }
.class-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 8px 36px;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.class-item:hover { background: rgba(255,255,255,0.06); color: white; }
.class-item.active { background: rgba(255,255,255,0.12); color: white; border-left-color: #f39c12; }
.class-badge {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
}

.btn-add-class {
  margin: 8px 16px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.1);
  border: 1px dashed rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.7);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-add-class:hover { background: rgba(255,255,255,0.18); color: white; }

/* ---- MAIN CONTENT ---- */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px;
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: auto;
}

/* ---- CARDS ---- */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  background: var(--primary);
  color: white;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h2 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary { background: var(--primary-light); color: white; }
.btn-primary:hover { background: #1e4a8a; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #229954; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #e08e0b; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 7px; font-size: 11px; border-radius: 4px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-light); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.2s;
  background: white;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(41,128,185,0.1); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-lg { max-width: 1000px; }
.modal-xl { max-width: 1400px; }

.modal-header {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px 12px 0 0;
}

.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.btn-close { background: none; border: none; color: white; font-size: 18px; cursor: pointer; padding: 0; }

/* ---- TABLES ---- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: #f8f9fa;
  border-bottom: 2px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  white-space: nowrap;
}
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f8fbff; }
tr:last-child td { border-bottom: none; }

/* ---- GRADES TABLE ---- */
.grades-table th { background: var(--primary); color: white; padding: 8px 10px; font-size: 11px; }
.grades-table td { padding: 6px 8px; font-size: 12px; }
.grade-cell {
  min-width: 40px;
  text-align: center;
  font-weight: 700;
  border-radius: 4px;
  padding: 3px 6px;
}
.grade-5 { background: #d5f5e3; color: #1e8449; }
.grade-4 { background: #d6eaf8; color: #1a5276; }
.grade-3 { background: #fef9e7; color: #9a7d0a; }
.grade-2 { background: #fdebd0; color: #a04000; }
.grade-1 { background: #fadbd8; color: #922b21; }
.grade-empty { background: #fffde7; }
.grade-ne { background: #f2f3f4; color: #7f8c8d; font-size: 11px; }

/* ---- FORMATIVE GRADES ---- */
.form-grade-smiley { font-size: 18px; cursor: pointer; }
.form-grade-znak {
  display: inline-block;
  width: 28px; height: 28px;
  border-radius: 50%;
  text-align: center;
  line-height: 28px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.form-grade-plus { background: #d5f5e3; color: #1e8449; }
.form-grade-nula { background: #fef9e7; color: #9a7d0a; }
.form-grade-minus { background: #fadbd8; color: #922b21; }

/* ---- STATS ---- */
.stats-bar {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.stat-item { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.stat-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-weight: 700; font-size: 13px; }
.stat-5 { background: #d5f5e3; color: #1e8449; }
.stat-4 { background: #d6eaf8; color: #1a5276; }
.stat-3 { background: #fef9e7; color: #9a7d0a; }
.stat-2 { background: #fdebd0; color: #a04000; }
.stat-1 { background: #fadbd8; color: #922b21; }
.stat-prosek { background: var(--primary); color: white; padding: 3px 12px; border-radius: 12px; font-size: 13px; font-weight: 700; }

/* ---- PRESENCE ---- */
.izostanak-pct { font-size: 11px; color: var(--text-light); }
.izostanak-high { color: var(--danger); font-weight: 700; }
.izostanak-warn { color: var(--warning); font-weight: 600; }

/* ---- TABS ---- */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 4px; flex-wrap: wrap; }
.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--primary); background: #f8f9fa; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); background: #f0f4ff; font-weight: 600; }

/* ---- BADGES ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-primary { background: #d6eaf8; color: var(--primary); }
.badge-success { background: #d5f5e3; color: var(--success); }
.badge-warning { background: #fef9e7; color: #9a7d0a; }
.badge-danger { background: #fadbd8; color: var(--danger); }
.badge-info { background: #e8f8f5; color: #1a7a6a; }

/* ---- REMINDER ---- */
.reminder-card {
  border-left: 4px solid var(--warning);
  padding: 12px 16px;
  background: #fffdf0;
  border-radius: 0 8px 8px 0;
  margin-bottom: 10px;
}
.reminder-high { border-left-color: var(--danger); background: #fff5f5; }
.reminder-low { border-left-color: var(--success); background: #f0fff4; }
.reminder-done { opacity: 0.5; text-decoration: line-through; }

/* ---- INFO BANNER ---- */
.info-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.info-banner .fa-school { font-size: 36px; opacity: 0.8; }
.info-banner h2 { font-size: 20px; margin-bottom: 4px; }
.info-banner p { opacity: 0.85; font-size: 13px; }

/* ---- SUMMARY ROW ---- */
.summary-row { background: #f0f4ff; font-weight: 600; }
.summary-final { background: var(--primary); color: white; font-weight: 700; }

/* ---- POLUGODISTE ROWS ---- */
.pol-header {
  background: #e8eef8;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
}

/* ---- DASHBOARD GRID ---- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.dashboard-stat {
  background: white;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  display: flex;
  align-items: center;
  gap: 14px;
}
.dashboard-stat-icon { font-size: 28px; width: 50px; height: 50px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-icon-blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon-green { background: #dcfce7; color: #16a34a; }
.stat-icon-orange { background: #ffedd5; color: #ea580c; }
.stat-icon-purple { background: #f3e8ff; color: #9333ea; }
.dashboard-stat-info strong { font-size: 24px; display: block; }
.dashboard-stat-info span { font-size: 12px; color: var(--text-light); }

/* ---- NO DATA ---- */
.no-data { text-align: center; padding: 40px 20px; color: var(--text-light); }
.no-data i { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.no-data p { font-size: 14px; }

/* ---- COMMENT TOOLTIP ---- */
.has-comment { position: relative; cursor: help; }
.has-comment::after {
  content: attr(data-comment);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #2c3e50;
  color: white;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  white-space: nowrap;
  max-width: 200px;
  white-space: pre-wrap;
  z-index: 999;
  display: none;
}
.has-comment:hover::after { display: block; }

/* ---- COMPACT TABLE ---- */
.compact-table td { padding: 5px 8px; }

/* ---- ALERT ---- */
.alert {
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-info { background: #dbeafe; color: #1e40af; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-danger { background: #fee2e2; color: #991b1b; }

/* ---- PRINT ---- */
@media print {
  .sidebar, .header, .btn, .modal-overlay { display: none !important; }
  .content { margin-left: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .content { margin-left: 0; }
  .form-row { flex-direction: column; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text-light); }
.loading i { animation: spin 1s linear infinite; margin-right: 8px; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Tag for student special */
.tag { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; margin: 1px; }
.tag-iop { background: #f3e8ff; color: #7e22ce; }
.tag-takmicenje { background: #fef3c7; color: #92400e; }
.tag-dopunska { background: #dbeafe; color: #1e40af; }
.tag-dodatna { background: #dcfce7; color: #166534; }
.tag-upis { background: #e0f2fe; color: #0369a1; }
.tag-ispis { background: #fee2e2; color: #991b1b; }
