/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600&display=swap');

/* ===== ROOT VARIABLES ===== */
:root {
  --primary: #1a6b4a;
  --primary-light: #e8f5ef;
  --primary-mid: #2d9b6f;
  --accent: #f0a500;
  --accent-light: #fff8e7;
  --danger: #e53935;
  --danger-light: #ffeaea;
  --info: #1565c0;
  --info-light: #e3f0ff;
  --bg: #f4f7f5;
  --bg-white: #ffffff;
  --text: #1c2b22;
  --text-muted: #6b7c72;
  --border: #dce8e1;
  --shadow: 0 2px 12px rgba(26,107,74,0.08);
  --shadow-lg: 0 8px 32px rgba(26,107,74,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font: 'Outfit', sans-serif;
  --font-alt: 'Space Grotesk', sans-serif;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ===== HIDDEN ===== */
.hidden { display: none !important; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== NAV ===== */
.top-nav {
  background: var(--primary);
  padding: 0 2rem;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.nav-brand .logo-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  color: rgba(255,255,255,0.85);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  color: white;
  background: rgba(255,255,255,0.15);
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-size: 0.875rem;
}
.nav-user .avatar {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}
.btn-logout {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ===== PAGE WRAPPER ===== */
.page-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ===== CARD ===== */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .icon {
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

/* ===== CYCLE SELECTOR ===== */
.cycle-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.cycle-card {
  background: var(--bg-white);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.22s;
  text-align: center;
}
.cycle-card:hover {
  border-color: var(--primary-mid);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.cycle-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26,107,74,0.12);
}
.cycle-card .cycle-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.cycle-card .cycle-name { font-weight: 600; font-size: 1rem; color: var(--text); }
.cycle-card .cycle-range {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  margin-top: 4px;
}
.cycle-card.active .cycle-range { background: var(--primary); color: white; }

/* ===== GRADE SECTION ===== */
.grade-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.grade-tab {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-white);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.18s;
}
.grade-tab:hover { border-color: var(--primary-mid); color: var(--primary); }
.grade-tab.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ===== SECTION PILLS ===== */
.section-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.section-pill {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-white);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.section-pill:hover { border-color: var(--primary-mid); color: var(--primary); }
.section-pill.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.875rem;
  border: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #155c3e; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger-light); color: var(--danger); border: 1.5px solid #f5c6c6; }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #d4920a; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 11px 26px; font-size: 1rem; }
.btn-icon { padding: 7px; border-radius: 8px; }

/* ===== FORM ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-control {
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg-white);
  color: var(--text);
  transition: border 0.18s;
  width: 100%;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,107,74,0.08); }
.form-control::placeholder { color: #b0beb6; }
select.form-control { cursor: pointer; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
thead th:first-child { border-radius: 10px 0 0 0; }
thead th:last-child { border-radius: 0 10px 0 0; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:hover { background: var(--primary-light); }
tbody td { padding: 10px 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-green { background: #e2f5ea; color: #1a7a3a; }
.badge-blue { background: #e3f0ff; color: #1565c0; }
.badge-orange { background: #fff3e0; color: #e65100; }
.badge-gray { background: #f0f0f0; color: #555; }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-yellow { background: var(--accent-light); color: #8a6200; }

/* ===== STAT CARD ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.stat-num { font-size: 2rem; font-weight: 700; color: var(--primary); font-family: var(--font-alt); }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; margin-top: 2px; }
.stat-card.accent .stat-num { color: var(--accent); }
.stat-card.info .stat-num { color: var(--info); }
.stat-card.danger .stat-num { color: var(--danger); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: none;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.18s;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); border-color: #f5c6c6; }

/* ===== ALERT ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: #e2f5ea; color: #1a6b35; border: 1px solid #b3dfc0; }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #f5c6c6; }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid #b3cfed; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; }
.page-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 2px; }

/* ===== SEARCH & FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-box input { padding-left: 36px; }
.search-box .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== IMPORT ZONE ===== */
.import-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.import-zone:hover, .import-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.import-zone .import-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.import-zone p { color: var(--text-muted); font-size: 0.9rem; }
.import-zone strong { color: var(--primary); }

/* ===== TABS ===== */
.tab-nav {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab-btn {
  padding: 9px 18px;
  border: none;
  background: none;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.18s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ===== REPORT CHART BARS ===== */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 120px; font-size: 0.8rem; font-weight: 500; text-align: right; color: var(--text-muted); flex-shrink: 0; }
.bar-track { flex: 1; background: var(--bg); border-radius: 4px; height: 22px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary-mid); border-radius: 4px; transition: width 0.5s ease; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; }
.bar-fill span { font-size: 0.75rem; font-weight: 700; color: white; }
.bar-fill.accent { background: var(--accent); }
.bar-fill.info { background: var(--info); }
.bar-fill.danger { background: var(--danger); }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f3d26 0%, #1a6b4a 40%, #2d9b6f 100%);
  padding: 1rem;
}
.login-box {
  background: white;
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo .logo-big {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 1rem;
}
.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.login-logo p { color: var(--text-muted); font-size: 0.85rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .cycle-selector { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}
@media (max-width: 480px) {
  .cycle-selector { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-wrapper { padding: 1rem; }
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { background: var(--primary); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { font-size: 0.875rem; }

/* ===== PRINT STYLES ===== */
@media print {
  .top-nav, .btn, .filter-bar, #toast-container, .modal-overlay { display: none !important; }
  body { background: white; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .page-wrapper { padding: 0; }
}
