/* =====================================================================
   Program Susu Sekolah (PSS) - Vanilla CSS Base
   Flexbox / CSS Grid | Responsive | No framework
   ===================================================================== */

:root {
  --primary: #1f6fb2;
  --primary-dark: #175a8f;
  --primary-light: #e8f1fa;
  --secondary: #2e7d32;
  --danger: #c62828;
  --warning: #f9a825;
  --muted: #6b7280;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1f2937;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 6px 18px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------------
   Navigation bar
   --------------------------------------------------------------------- */
.navbar {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: var(--shadow);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.navbar-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  padding: 14px 0;
}

.navbar-brand:hover {
  text-decoration: none;
  opacity: 0.9;
}

.navbar-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.navbar-links a {
  color: #dbeafe;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.navbar-links a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
}

.navbar-links a.active {
  background: var(--primary);
  color: #fff;
}

/* ---------------------------------------------------------------------
   Layout / main
   --------------------------------------------------------------------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  width: 100%;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.page-subtitle {
  color: var(--muted);
  margin: 2px 0 0;
}

/* ---------------------------------------------------------------------
   Cards & responsive grid
   --------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }
}

/* Stat cards */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-table th,
.data-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #334155;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.data-table tbody tr:hover {
  background: var(--primary-light);
}

.data-table td.numeric,
.data-table th.numeric {
  text-align: right;
}

/* ---------------------------------------------------------------------
   Status badges
   --------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #e6f4ea; color: var(--secondary); }
.badge-warning { background: #fff7e0; color: #b26a00; }
.badge-danger  { background: #fdecea; color: var(--danger); }
.badge-muted   { background: #eef0f3; color: var(--muted); }

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.form-control,
select.form-control,
textarea.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
  color: var(--text);
}

.form-control:focus,
select.form-control:focus,
textarea.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 178, 0.15);
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, opacity 0.15s;
}

.btn:hover {
  text-decoration: none;
  opacity: 0.9;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #eef0f3; color: var(--text); }
.btn-success { background: var(--secondary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------
   Alerts / messages
   --------------------------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border-left: 4px solid transparent;
}

.alert-success { background: #e6f4ea; border-color: var(--secondary); color: #1b5e20; }
.alert-danger  { background: #fdecea; border-color: var(--danger); color: #8e1c1c; }
.alert-warning { background: #fff7e0; border-color: var(--warning); color: #7a4d00; }
.alert-info    { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }

/* ---------------------------------------------------------------------
   Misc utilities
   --------------------------------------------------------------------- */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
  padding: 16px;
}

/* ---------------------------------------------------------------------
   Responsive tweaks
   --------------------------------------------------------------------- */
@media (max-width: 600px) {
  .navbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn {
    width: 100%;
  }

  .btn-group {
    flex-direction: column;
  }
}
