/* ============================================================
   ADMIN PANEL CSS - SMA Negeri 1 Halmahera Timur
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --sidebar-w: 260px;
  --header-h: 64px;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --accent: #0f172a;
  --accent-soft: #1e293b;
  --accent-100: #f1f5f9;
  --accent-200: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
}

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

html { font-family: var(--font-sans); font-size: 14px; scroll-behavior: smooth; }

body {
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================
   LAYOUT
   ============================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================
   SIDEBAR
   ============================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--accent);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transform: translateX(0);
  transition: transform .3s ease, width .3s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 68px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
  min-height: var(--header-h);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  padding: 2px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand-text { overflow: hidden; }
.sidebar-brand-text .name {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  line-height: 1.2;
}
.sidebar-brand-text .sub {
  font-size: 10px;
  color: #64748b;
  white-space: nowrap;
  margin-top: 2px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
  padding: 10px 10px 4px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 2px;
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  position: relative;
}

.nav-item svg { flex-shrink: 0; }

.nav-item:hover { background: rgba(255,255,255,.07); color: #e2e8f0; }

.nav-item.active {
  background: rgba(255,255,255,.12);
  color: #f1f5f9;
  font-weight: 600;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9999px;
  min-width: 18px;
  text-align: center;
}

.sidebar.collapsed .nav-item span:not(.nav-badge),
.sidebar.collapsed .sidebar-brand-text { display: none; }

.sidebar.collapsed .nav-badge { position: absolute; top: 6px; right: 6px; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ============================
   MAIN AREA
   ============================ */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .3s;
}

.main-area.expanded { margin-left: 68px; }

/* ============================
   TOP HEADER
   ============================ */
.top-header {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  flex-shrink: 0;
  transition: all .2s;
}

.header-toggle-btn:hover { background: #f8fafc; color: #0f172a; }

.header-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
}

.header-breadcrumb .page-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  font-family: var(--font-serif);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid #e2e8f0;
}

/* ============================
   PAGE CONTENT
   ============================ */
.page-content {
  flex: 1;
  padding: 28px 28px;
  display: none;
}

.page-content.active { display: block; }

/* ============================
   STAT CARDS
   ============================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all .2s;
}

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

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #d1fae5; color: #059669; }
.stat-icon.yellow { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: #64748b; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-family: var(--font-serif); font-size: 28px; font-weight: 700; color: #0f172a; line-height: 1.2; margin-top: 2px; }
.stat-sub { font-size: 11px; color: #94a3b8; margin-top: 4px; }

/* ============================
   CHARTS GRID
   ============================ */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.chart-card {
  background: white;
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
}

.chart-card.col-8  { grid-column: span 8; }
.chart-card.col-4  { grid-column: span 4; }
.chart-card.col-6  { grid-column: span 6; }
.chart-card.col-12 { grid-column: span 12; }

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.chart-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.chart-subtitle { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.chart-body { position: relative; }

/* ============================
   TABLE
   ============================ */
.table-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.table-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  flex: 1;
  min-width: 160px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap input {
  padding: 8px 12px 8px 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12.5px;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
  width: 220px;
  transition: all .2s;
  font-family: var(--font-sans);
}

.search-input-wrap input:focus { border-color: #0f172a; background: white; }
.search-input-wrap svg { position: absolute; left: 10px; color: #94a3b8; flex-shrink: 0; }

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead { background: #f8fafc; }

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid #f8fafc;
  font-size: 13px;
  color: #334155;
  vertical-align: middle;
}

tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }

.table-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e2e8f0;
}

.table-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

.table-actions { display: flex; align-items: center; gap: 6px; }

.action-btn {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all .15s;
}

.action-btn.edit   { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.action-btn.delete { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.action-btn.view   { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }

.action-btn:hover { opacity: .8; transform: scale(.98); }

.table-empty {
  text-align: center;
  padding: 48px 16px;
  color: #94a3b8;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid #f1f5f9;
  font-size: 12px;
  color: #64748b;
  flex-wrap: wrap;
  gap: 10px;
}

/* ============================
   BUTTONS
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  font-family: var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: #0f172a; color: white; }
.btn-primary:hover { background: #1e293b; }

.btn-outline {
  background: white;
  color: #1e293b;
  border: 1px solid #e2e8f0;
}
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }

/* ============================
   MODAL & FORM
   ============================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0,0,0,.2);
  transform: scale(.95) translateY(20px);
  transition: transform .25s;
}

.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }

.modal-box::-webkit-scrollbar { width: 5px; }
.modal-box::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #f1f5f9;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
  border-radius: 20px 20px 0 0;
}

.modal-title { font-family: var(--font-serif); font-size: 18px; font-weight: 700; color: #0f172a; }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all .2s;
}
.modal-close:hover { background: #f8fafc; color: #0f172a; }

.modal-body { padding: 22px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: white;
  border-radius: 0 0 20px 20px;
}

/* ============================
   FORM ELEMENTS
   ============================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 18px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: span 2; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-label span { color: var(--danger); margin-left: 2px; }

.form-control {
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  transition: all .2s;
  width: 100%;
}

.form-control:focus { border-color: #0f172a; background: white; box-shadow: 0 0 0 3px rgba(15,23,42,.06); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 14px 0 6px;
  border-top: 1px solid #f1f5f9;
  margin-top: 4px;
  grid-column: span 2;
}

.form-section-title:first-child { border-top: none; padding-top: 0; }

/* ============================
   TOAST
   ============================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  min-width: 260px;
  animation: toastIn .3s ease forwards;
}

.toast.success { border-left: 3px solid #10b981; }
.toast.error   { border-left: 3px solid #ef4444; }
.toast.info    { border-left: 3px solid #3b82f6; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================
   CONFIRM DIALOG
   ============================ */
.confirm-dialog .modal-box {
  max-width: 420px;
}

.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fee2e2;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

/* ============================
   LOGIN PAGE
   ============================ */
.login-page {
  min-height: 100vh;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  border: 1px solid #f1f5f9;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
  gap: 10px;
}

.login-logo img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: contain;
  border: 2px solid #e2e8f0;
}

.login-title { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: #0f172a; text-align: center; }
.login-sub   { font-size: 12px; color: #94a3b8; text-align: center; margin-top: 2px; letter-spacing: .02em; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-label { font-size: 12px; font-weight: 600; color: #374151; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 5px; display: block; }

.login-input-wrap { position: relative; }
.login-input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.login-input {
  width: 100%;
  padding: 11px 12px 11px 38px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13.5px;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  font-family: var(--font-sans);
  transition: all .2s;
}
.login-input:focus { border-color: #0f172a; background: white; box-shadow: 0 0 0 3px rgba(15,23,42,.06); }

.login-btn {
  width: 100%;
  padding: 13px;
  background: #0f172a;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-sans);
  margin-top: 6px;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.login-btn:hover { background: #1e293b; }
.login-btn:disabled { opacity: .7; cursor: not-allowed; }

.login-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 500;
  display: none;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); width: var(--sidebar-w); }
  .main-area { margin-left: 0 !important; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.col-8,
  .chart-card.col-4,
  .chart-card.col-6 { grid-column: span 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: span 1; }
  .form-section-title { grid-column: span 1; }
  .page-content { padding: 16px; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .table-header { flex-direction: column; align-items: flex-start; }
  .search-input-wrap input { width: 100%; }
}

