/* ============================================================
   MASTER.CSS  —  BK SMAN 1 Banda Aceh  v5.0
   ============================================================ */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --primary:       #4e73df;
  --primary-dark:  #2e59d9;
  --primary-light: #6f8fe8;
  --success:       #1cc88a;
  --success-dark:  #169a6b;
  --info:          #36b9cc;
  --info-dark:     #258391;
  --warning:       #f6c23e;
  --warning-dark:  #dda20a;
  --danger:        #e74a3b;
  --danger-dark:   #be2617;
  --secondary:     #858796;
  --dark:          #3a3b45;
  --light:         #f8f9fc;
  --white:         #ffffff;
  --accent:        #e67e22;
  --accent-dark:   #ca6f1e;
  --purple:        #6f42c1;

  --bg:            #f4f6fc;
  --bg-card:       #ffffff;
  --border:        #e3e6f0;
  --border-color:  #e3e6f0;
  --shadow-sm:     0 1px 6px rgba(58,59,69,.08);
  --shadow:        0 2px 14px rgba(58,59,69,.10);
  --shadow-lg:     0 8px 28px rgba(58,59,69,.15);

  --sidebar-w:       240px;
  --sidebar-bg:      #1a2a5e;
  --header-h:        62px;
  --radius:          .6rem;
  --radius-sm:       .35rem;
  --radius-lg:       .85rem;
  --font:            'Nunito', system-ui, sans-serif;
  --transition:      .2s ease;

  /* Aliases */
  --primary-ultra:    rgba(78,115,223,.06);
  --primary-ultra2:   rgba(78,115,223,.12);
  --font-family:      var(--font);
  --border-radius:    var(--radius);
  --border-radius-sm: var(--radius-sm);
  --border-radius-lg: var(--radius-lg);
  --content-bg:       var(--bg);
  --text-dark:        var(--dark);
  --text-main:        var(--dark);
  --text-muted:       var(--secondary);

  --z-sidebar: 200;
  --z-header:  300;
  --z-overlay: 400;
  --z-modal:   500;
  --z-toast:   600;
}

/* ── Reset ──────────────────────────────────────────────── */
*, ::before, ::after { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); font-size: .875rem;
  background: var(--bg); color: var(--dark); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
button { font-family: var(--font); }
h1,h2,h3,h4,h5,h6 { line-height: 1.3; margin: 0; }

/* ── App wrapper ────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar Overlay (mobile) ───────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: var(--z-overlay);
}
.sidebar-overlay.show { display: block; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  z-index: var(--z-sidebar);
  overflow-y: auto; overflow-x: hidden;
  transition: transform var(--transition), width var(--transition);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
/* Desktop: collapsed */
.sidebar.collapsed { width: 70px; }

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* Brand */
.sidebar-header {
  padding: 0 1.25rem; height: var(--header-h);
  display: flex; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  color: #fff; text-decoration: none;
  font-weight: 800; font-size: 1.05rem;
  white-space: nowrap; overflow: hidden;
}
.sidebar-brand i { font-size: 1.3rem; color: var(--primary-light); flex-shrink: 0; }
.sidebar.collapsed .sidebar-brand span { display: none; }

/* Nav */
.sidebar-nav { padding: .75rem 0 2rem; flex: 1; }

/* Section labels */
.menu-label {
  padding: .9rem 1.25rem .4rem;
  font-size: .62rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: rgba(255,255,255,.35);
  white-space: nowrap; overflow: hidden;
}
.sidebar.collapsed .menu-label { opacity: 0; pointer-events: none; height: 0; padding: 0; }

/* Menu item */
.menu-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem 1.25rem;
  color: rgba(255,255,255,.65);
  font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; border: none; background: none;
  width: 100%; text-align: left;
  border-left: 3px solid transparent;
  white-space: nowrap; overflow: hidden;
}
.menu-item:hover  { color: #fff; background: rgba(255,255,255,.06); border-left-color: rgba(255,255,255,.2); text-decoration: none; }
.menu-item.active { color: #fff; background: rgba(78,115,223,.25); border-left-color: var(--primary-light); }
.menu-item i:first-child { font-size: .9rem; flex-shrink: 0; width: 1.1rem; text-align: center; }
.menu-text { white-space: nowrap; overflow: hidden; flex: 1; }
.sidebar.collapsed .menu-text { display: none; }

/* Submenu */
.menu-submenu { background: rgba(0,0,0,.15); display: none; }
.menu-submenu.show, .menu-item.active + .menu-submenu { display: block; }
.menu-sub-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .45rem 1.25rem .45rem 2.75rem;
  color: rgba(255,255,255,.55); font-size: .78rem; font-weight: 500;
  text-decoration: none; transition: all var(--transition);
  border-left: 3px solid transparent;
  white-space: nowrap; overflow: hidden;
}
.menu-sub-item:hover  { color: #fff; background: rgba(255,255,255,.06); text-decoration: none; }
.menu-sub-item.active { color: var(--primary-light); border-left-color: var(--primary-light); }
.menu-sub-item i { font-size: .78rem; width: .9rem; text-align: center; flex-shrink: 0; }
.menu-arrow { margin-left: auto; font-size: .65rem; transition: transform .25s; opacity: .6; flex-shrink: 0; }
.menu-item.active > .menu-arrow { transform: rotate(90deg); }
.sidebar.collapsed .menu-submenu { display: none !important; }

/* Info anak (orang-tua) */
.info-anak {
  margin: .75rem 1rem; padding: .75rem; border-radius: var(--radius);
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
}
.info-anak-label {
  font-size: .62rem; color: rgba(255,255,255,.4);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: .4rem;
}

/* ── Main content ───────────────────────────────────────── */
.main-content {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left var(--transition);
  display: flex; flex-direction: column;
}
.main-content.expanded { margin-left: 70px; }

/* ── Top header ─────────────────────────────────────────── */
.top-header {
  position: sticky; top: 0; z-index: var(--z-header);
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1.5px solid var(--border);
  box-shadow: 0 2px 8px rgba(58,59,69,.07);
  flex-shrink: 0;
}
.header-container {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; padding: 0 1.75rem; gap: 1rem;
}
.header-left  { display: flex; align-items: center; gap: .75rem; min-width: 0; flex: 1; }
.header-right { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }

.toggle-sidebar {
  background: none; border: none; cursor: pointer;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--secondary); font-size: 1rem;
  transition: all var(--transition); flex-shrink: 0;
}
.toggle-sidebar:hover { background: var(--primary-ultra2); color: var(--primary); }

/* Divider vertikal antara toggle & judul */
.header-divider {
  width: 1px; height: 20px; background: var(--border); flex-shrink: 0;
}

.page-title {
  font-size: .98rem; font-weight: 800; color: var(--dark);
  margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: .01em;
}

/* Separator antara notification & user */
.header-sep {
  width: 1px; height: 26px; background: var(--border);
  margin: 0 .35rem; flex-shrink: 0;
}

/* User */
.user-dropdown, .notification-dropdown { position: relative; cursor: pointer; }

.user-dropdown {
  display: flex; align-items: center; gap: .55rem;
  padding: .28rem .5rem; border-radius: var(--radius);
  transition: background var(--transition);
}
.user-dropdown:hover { background: var(--light); }

.user-info   { text-align: right; }
.user-name   { display: block; font-size: .79rem; font-weight: 700; color: var(--dark); line-height: 1.25; }
.user-role   {
  display: inline-block; font-size: .61rem; font-weight: 700;
  color: var(--primary); background: var(--primary-ultra2);
  padding: 1px 6px; border-radius: 20px; margin-top: 2px;
  letter-spacing: .02em; text-transform: uppercase; line-height: 1.6;
}

.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-weight: 800; font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 2px 6px rgba(78,115,223,.35);
  border: 2px solid rgba(255,255,255,.9);
}

/* Notification */
.notification-dropdown {
  padding: .28rem .35rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.notification-dropdown:hover { background: var(--light); }

.notification-icon {
  position: relative; width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--secondary); font-size: .98rem; transition: all var(--transition);
}
.notification-dropdown:hover .notification-icon { color: var(--primary); }
.notification-badge {
  position: absolute; top: 1px; right: 1px;
  background: var(--danger); color: #fff;
  font-size: .55rem; font-weight: 800;
  min-width: 15px; height: 15px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-card); line-height: 1;
}

/* Dropdown */
.dropdown-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 200px; overflow: hidden; z-index: calc(var(--z-header) + 1);
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem 1rem; font-size: .82rem; color: var(--dark);
  text-decoration: none; transition: background var(--transition);
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.dropdown-item:hover { background: var(--light); text-decoration: none; }
.dropdown-item i { width: 1rem; color: var(--secondary); }
.dropdown-divider { height: 1px; background: var(--border); margin: .25rem 0; }

/* ── Breadcrumb ─────────────────────────────────────────── */
.content-wrapper { padding: 1.25rem 1.75rem; }
nav[aria-label="breadcrumb"] {
  padding: .5rem 0 .35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .25rem;
}
.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center;
  list-style: none; padding: 0; margin: 0; gap: 0;
}
.breadcrumb-item {
  display: flex; align-items: center;
  font-size: .75rem; color: var(--secondary);
  font-weight: 500;
}
.breadcrumb-item a {
  color: var(--secondary); text-decoration: none;
  transition: color var(--transition);
}
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--primary); font-weight: 700; }
.breadcrumb-item + .breadcrumb-item::before {
  content: '\203A'; padding: 0 .4rem;
  color: var(--secondary); opacity: .5; font-size: .9rem;
}

/* ── Alert container ────────────────────────────────────── */
#alertContainer {
  position: fixed; top: 72px; right: 1.25rem;
  z-index: var(--z-toast); max-width: 380px; width: calc(100% - 2.5rem);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Sidebar: off-canvas on mobile */
  .sidebar {
    transform: translateX(-100%);
    z-index: calc(var(--z-overlay) + 1);
    width: var(--sidebar-w) !important; /* always full width on mobile */
  }
  .sidebar.show { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-w) !important; }

  /* Main content fills screen */
  .main-content         { margin-left: 0 !important; }
  .main-content.expanded { margin-left: 0 !important; }

  .page-title   { font-size: .9rem; }
  .user-info    { display: none; }
  .header-container { padding: 0 1rem; }
  .content-wrapper  { padding: .85rem 1rem; }

  #alertContainer { top: 68px; right: .75rem; max-width: calc(100% - 1.5rem); }
}

@media (max-width: 480px) {
  .content-wrapper { padding: .75rem; }
}
