/* ============================================================
   assets/css/app.css — SiPendas Design System
   Dinas Pendidikan Kabupaten Malang
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Playfair+Display:wght@600&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --sb-width: 240px;
  --topnav-h: 56px;

  /* Brand Palette: Merah Putih + Pendidikan */
  --primary:       #1a3a6b;   /* biru dinas */
  --primary-light: #2a54a0;
  --primary-dark:  #102547;
  --accent:        #c0392b;   /* merah aksen */
  --accent-light:  #e74c3c;
  --gold:          #f39c12;

  /* Neutrals */
  --bg:            #f0f4f8;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e2e8f0;
  --text:          #1e293b;
  --text-muted:    #64748b;

  /* Status */
  --success: #16a34a;
  --warning: #d97706;
  --danger:  #dc2626;
  --info:    #0284c7;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 4px 16px rgba(26,58,107,.10);
  --shadow-lg:  0 10px 40px rgba(26,58,107,.15);

  /* Typography */
  --font-sans:  'Plus Jakarta Sans', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --radius:     12px;
  --radius-sm:  8px;
  --radius-lg:  16px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: .9rem;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---------- TOP NAVBAR ---------- */
.sb-topnav {
  z-index: 1040;
  height: var(--topnav-h);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  box-shadow: 0 2px 16px rgba(0,0,0,.25);
  border-bottom: 3px solid var(--accent);
  padding: 0 1rem;
}

.brand-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.2);
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: #fff;
  font-weight: 600;
  line-height: 1.1;
  display: block;
}

.brand-sub {
  font-size: .65rem;
  color: rgba(255,255,255,.65);
  letter-spacing: .05em;
  line-height: 1;
}

.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: grid; place-items: center;
  font-size: .75rem; font-weight: 700;
  color: #fff; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.3);
}

/* ---------- SIDEBAR ---------- */
#layoutSidenav {
  display: flex;
  padding-top: var(--topnav-h);
}

#layoutSidenav_nav {
  width: var(--sb-width);
  min-height: calc(100vh - var(--topnav-h));
  flex-shrink: 0;
  position: sticky;
  top: var(--topnav-h);
  height: calc(100vh - var(--topnav-h));
  overflow-y: auto;
  overflow-x: hidden;
}

#layoutSidenav_content {
  flex: 1;
  min-width: 0;
}

.sb-sidenav {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--primary-dark);
}

.sb-sidenav-menu {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sb-sidenav-menu .nav { flex-direction: column; padding: .5rem 0; }

.sb-sidenav-menu-heading {
  padding: .85rem 1rem .3rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
}

.sb-sidenav .nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 1rem;
  color: rgba(255,255,255,.72);
  font-weight: 500;
  font-size: .855rem;
  border-radius: 0;
  transition: all .2s;
  position: relative;
  margin: 1px .5rem;
  border-radius: var(--radius-sm);
}

.sb-sidenav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}

.sb-sidenav .nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  box-shadow: 0 4px 12px rgba(192,57,43,.4);
  font-weight: 600;
}

.sb-nav-link-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  font-size: 1rem; flex-shrink: 0;
  border-radius: 6px;
  background: rgba(255,255,255,.08);
  transition: background .2s;
}

.sb-sidenav .nav-link:hover .sb-nav-link-icon,
.sb-sidenav .nav-link.active .sb-nav-link-icon {
  background: rgba(255,255,255,.15);
}

.sb-sidenav-footer {
  padding: .75rem 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.45);
  font-size: .7rem;
  line-height: 1.6;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
  padding: 1.5rem;
  min-height: calc(100vh - var(--topnav-h) - 52px);
}

.main-footer {
  padding: .85rem 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-muted);
}

/* ---------- PAGE HEADER ---------- */
.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}

.page-header-title h1 {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  line-height: 1.3;
}

.page-header-title .breadcrumb {
  font-size: .78rem;
  margin: .2rem 0 0;
}

/* ---------- STAT CARDS (Dashboard) ---------- */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
  position: relative;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--primary));
  border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.35rem;
  background: var(--icon-bg, rgba(26,58,107,.1));
  color: var(--card-accent, var(--primary));
  flex-shrink: 0;
}

.stat-card-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-card-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* ---------- CONTENT CARDS ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0 !important;
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

.card-header-title {
  font-weight: 700;
  color: var(--primary);
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ---------- TABLES ---------- */
.table-responsive { border-radius: var(--radius-sm); overflow: hidden; }

.table {
  font-size: .855rem;
  margin: 0;
}

.table thead th {
  background: var(--primary);
  color: rgba(255,255,255,.9);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border: none;
  padding: .7rem 1rem;
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

.table tbody tr:hover { background: var(--surface-2); }
.table tbody td { padding: .7rem 1rem; vertical-align: middle; border: none; }

/* ---------- BADGES ---------- */
.badge-role-admin   { background: #7c3aed22; color: #7c3aed; }
.badge-role-dinas   { background: #0284c722; color: #0284c7; }
.badge-role-sekolah { background: #16a34a22; color: #16a34a; }

/* ---------- FORMS ---------- */
.form-label { font-weight: 600; font-size: .83rem; color: var(--text); margin-bottom: .3rem; }

.form-control, .form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  transition: border-color .2s, box-shadow .2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26,58,107,.1);
}

/* ---------- BUTTONS ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: .83rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
.btn-danger { background: var(--accent); border-color: var(--accent); }

/* ---------- FOTO GRID ---------- */
.foto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px,1fr));
  gap: 1rem;
}

.foto-item {
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
}

.foto-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}

.foto-item:hover img { transform: scale(1.05); }

.foto-item-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.foto-item:hover .foto-item-overlay { opacity: 1; }

/* ---------- UPLOAD ZONE ---------- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface-2);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary-light);
  background: rgba(26,58,107,.04);
}

.upload-zone .upload-icon { font-size: 2.5rem; color: var(--text-muted); margin-bottom: .75rem; }

/* ---------- LOGIN PAGE ---------- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(192,57,43,.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(243,156,18,.15) 0%, transparent 50%);
}

.login-card {
  background: rgba(255,255,255,.97);
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0,0,0,.35);
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.login-card-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  padding: 2rem 2rem 1.5rem;
  text-align: center;
  position: relative;
}

.login-card-header::after {
  content: '';
  position: absolute; bottom: -1px; left: 0; right: 0; height: 20px;
  background: rgba(255,255,255,.97);
  border-radius: 20px 20px 0 0;
}

.login-logo {
  width: 64px; height: 64px;
  background: rgba(255,255,255,.15);
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 1.8rem;
  margin: 0 auto 1rem;
  border: 2px solid rgba(255,255,255,.25);
  color: #fff;
}

.login-card-body { padding: 1.5rem 2rem 2rem; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 991.98px) {
  #layoutSidenav_nav {
    width: var(--sb-width);
    position: fixed;
    left: calc(-1 * var(--sb-width));
    height: calc(100vh - var(--topnav-h));
    transition: left .25s ease;
    z-index: 1035;
  }

  #layoutSidenav_nav.sb-sidenav-toggled { left: 0; }

  #layoutSidenav_content { margin-left: 0 !important; }

  .main-content { padding: 1rem; }
}

@media (min-width: 992px) {
  #layoutSidenav_content { margin-left: 0; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Utilities */
.text-primary-custom { color: var(--primary) !important; }
.bg-primary-custom   { background: var(--primary) !important; }
.fw-700 { font-weight: 700 !important; }
.fs-tiny { font-size: .72rem !important; }
.rounded-custom { border-radius: var(--radius) !important; }
