/* =============================================
   SD Al-Wildan 4 - Sistem Jadwal
   style.css
   ============================================= */

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

:root {
  --primary: #1a5276;
  --primary-light: #2e86c1;
  --accent: #148f77;
  --danger: #c0392b;
  --warning: #d4ac0d;
  --success: #1e8449;
  --gray-1: #f4f6f9;
  --gray-2: #e8ecf0;
  --gray-3: #c8d0d9;
  --gray-4: #8899aa;
  --text: #1c2833;
  --text-light: #5d6d7e;
  --white: #ffffff;
  --sidebar-w: 230px;
  --header-h: 56px;
  --radius: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,.12);
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--gray-1);
}

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

/* ---- Login ---- */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--primary);
}
.login-box {
  background: var(--white); border-radius: var(--radius);
  padding: 36px 32px; width: 340px; box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
.login-box .logo { text-align: center; margin-bottom: 24px; }
.login-box .logo h2 { color: var(--primary); font-size: 18px; line-height: 1.4; }
.login-box .logo small { color: var(--text-light); font-size: 12px; }

/* ---- Layout ---- */
#app { display: none; }
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--primary); overflow-y: auto; z-index: 100;
}
#sidebar .brand {
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.1);
  color: #fff; font-size: 13px; font-weight: 600; line-height: 1.4;
}
#sidebar .brand small { display: block; font-weight: 400; opacity: .7; font-size: 11px; }
#sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: rgba(255,255,255,.8);
  font-size: 13px; transition: background .15s;
}
#sidebar nav a:hover, #sidebar nav a.active {
  background: rgba(255,255,255,.12); color: #fff; text-decoration: none;
}
#sidebar nav .nav-section {
  padding: 16px 16px 4px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.4);
}
#main { margin-left: var(--sidebar-w); }
#topbar {
  position: sticky; top: 0; height: var(--header-h);
  background: var(--white); border-bottom: 1px solid var(--gray-2);
  display: flex; align-items: center; padding: 0 20px;
  justify-content: space-between; z-index: 90; box-shadow: var(--shadow);
}
#topbar h1 { font-size: 16px; font-weight: 600; color: var(--text); }
#topbar .user-info { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-light); }
#topbar .user-info strong { color: var(--text); }
#content { padding: 20px; }

/* ---- Cards & Panels ---- */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-header {
  padding: 12px 16px; border-bottom: 1px solid var(--gray-2);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 14px; font-weight: 600; color: var(--text); }
.card-body { padding: 16px; }

/* ---- Stats Row ---- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); border-left: 4px solid var(--primary);
}
.stat-card.danger { border-color: var(--danger); }
.stat-card.success { border-color: var(--success); }
.stat-card.warning { border-color: var(--warning); }
.stat-card .val { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-card.danger .val { color: var(--danger); }
.stat-card.success .val { color: var(--success); }
.stat-card.warning .val { color: var(--warning); }
.stat-card .lbl { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius); border: none;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-xs { padding: 2px 7px; font-size: 11px; }
.btn-wa { background: #25d366; color: #fff; }

/* ---- Forms ---- */
.form-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.form-group { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 160px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-light); }
.form-group input, .form-group select, .form-group textarea {
  padding: 7px 10px; border: 1px solid var(--gray-3); border-radius: var(--radius);
  font-size: 13px; background: var(--white); color: var(--text);
  transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary-light);
}
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ---- Tables ---- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--primary); color: #fff; padding: 8px 10px;
  text-align: left; font-weight: 600; white-space: nowrap;
}
tbody tr:nth-child(even) { background: var(--gray-1); }
tbody tr:hover { background: #dce8f5; }
tbody td { padding: 7px 10px; border-bottom: 1px solid var(--gray-2); }
.td-center { text-align: center; }
.td-actions { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---- Jadwal Grid ---- */
.jadwal-grid { overflow-x: auto; }
.jadwal-table { border-collapse: collapse; font-size: 12px; min-width: 700px; }
.jadwal-table th {
  background: var(--primary); color: #fff; padding: 7px 10px;
  text-align: center; white-space: nowrap; min-width: 110px;
}
.jadwal-table td {
  border: 1px solid var(--gray-2); padding: 6px 8px;
  vertical-align: top; min-height: 52px; min-width: 110px;
}
.jadwal-table td.hari-col {
  background: var(--primary); color: #fff; font-weight: 700;
  text-align: center; writing-mode: vertical-rl;
  text-orientation: mixed; transform: rotate(180deg);
  white-space: nowrap; padding: 8px 5px; font-size: 11px;
}
.jadwal-cell {
  background: #eaf4fb; border-radius: 4px; padding: 4px 6px;
  font-size: 11px; line-height: 1.4; cursor: pointer;
}
.jadwal-cell:hover { background: #c5e3f7; }
.jadwal-cell .mapel { font-weight: 700; color: var(--primary); }
.jadwal-cell .guru { color: var(--text-light); font-size: 10px; }
.jadwal-cell.team { background: #e8f8f5; }
.jadwal-cell.pjok { background: #fef9e7; }
.jadwal-cell.izin { background: #fdecea !important; border: 1px solid var(--danger); }
.jadwal-cell.inval { background: #e9f7ef !important; border: 1px solid var(--success); }
.jadwal-cell.persiapan { background: var(--gray-2); color: var(--text-light); font-size: 10px; font-style: italic; }
.empty-cell { color: var(--gray-3); font-style: italic; font-size: 11px; text-align: center; padding: 10px; }
.cell-edit-btn { font-size: 10px; float: right; cursor: pointer; color: var(--primary-light); }

/* ---- Peta Guru ---- */
.peta-table { font-size: 11px; }
.peta-table th { min-width: 70px; padding: 5px 7px; font-size: 11px; }
.peta-table td { padding: 4px 6px; min-width: 70px; font-size: 11px; }
.peta-cell { background: var(--accent); color: #fff; border-radius: 3px; padding: 2px 5px; font-size: 10px; white-space: nowrap; }

/* ---- Badges & Tags ---- */
.badge {
  display: inline-block; padding: 2px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.badge-aktif { background: #d4efdf; color: var(--success); }
.badge-nonaktif { background: #fdecea; color: var(--danger); }
.badge-inter { background: #d6eaf8; color: var(--primary); }
.badge-mq { background: #fef9e7; color: #9a7d0a; }
.badge-sakit { background: #fdecea; color: var(--danger); }
.badge-izin { background: #fef9e7; color: #9a7d0a; }
.badge-dinas { background: #d6eaf8; color: var(--primary); }

/* ---- Modal ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius);
  width: 90%; max-width: 560px; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.modal-header {
  padding: 14px 18px; border-bottom: 1px solid var(--gray-2);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close { cursor: pointer; font-size: 20px; color: var(--text-light); line-height: 1; }
.modal-body { padding: 18px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--gray-2); display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Alerts ---- */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.alert-danger  { background: #fdecea; color: var(--danger); border: 1px solid #f5b7b1; }
.alert-success { background: #d4efdf; color: var(--success); border: 1px solid #a9dfbf; }
.alert-warning { background: #fef9e7; color: #9a7d0a; border: 1px solid #f7dc6f; }
.alert-info    { background: #d6eaf8; color: var(--primary); border: 1px solid #a9cce3; }

/* ---- Tabs ---- */
.tabs { display: flex; border-bottom: 2px solid var(--gray-2); margin-bottom: 16px; gap: 2px; }
.tab-btn {
  padding: 8px 16px; background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--text-light); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color .15s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Search/Filter Bar ---- */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  margin-bottom: 14px;
}
.filter-bar input, .filter-bar select {
  padding: 7px 10px; border: 1px solid var(--gray-3); border-radius: var(--radius);
  font-size: 13px; min-width: 140px;
}

/* ---- Notification dot ---- */
.notif-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); margin-left: 6px; vertical-align: middle;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); transition: transform .2s; }
  #sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
  .stats-row { grid-template-columns: repeat(2,1fr); }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-2); }
::-webkit-scrollbar-thumb { background: var(--gray-3); border-radius: 3px; }

/* ---- Misc ---- */
.text-muted { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.loading { text-align: center; padding: 32px; color: var(--text-light); }
.loading::after { content: ' ⏳'; }
hr.divider { border: none; border-top: 1px solid var(--gray-2); margin: 12px 0; }
