/* RaporKalam — SD Kristen Kalam Kudus Blitar */
:root {
  --primary: #1e40af;
  --primary-dark: #1e3a8a;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --sidebar-w: 240px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ===== LOGIN ===== */
#login-screen {
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}
#login-screen.active { display: flex; }

.login-card {
  background: white;
  padding: 3rem 2.5rem;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.logo-placeholder {
  width: 80px; height: 80px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 1rem;
}

.login-card h1 { font-size: 1.8rem; color: var(--primary); margin-bottom: 0.25rem; }
.school-name { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; }
.login-desc { color: var(--text-muted); margin-bottom: 1.5rem; }
.login-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 1rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; width: 100%; justify-content: center; }

/* ===== HEADER ===== */
.app-header {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 0.75rem; font-size: 1.25rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 1rem; }
#user-info { font-size: 0.9rem; opacity: 0.9; }

/* ===== LAYOUT ===== */
.app-body { display: flex; min-height: calc(100vh - 56px); }

.sidebar {
  width: var(--sidebar-w);
  background: white;
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  flex-shrink: 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.15s;
}
.nav-item:hover { background: #f1f5f9; }
.nav-item.active {
  background: #eff6ff;
  color: var(--primary);
  border-right: 3px solid var(--primary);
  font-weight: 600;
}
.nav-item i { width: 20px; text-align: center; }

.content {
  flex: 1;
  padding: 1.5rem;
  overflow-x: auto;
}
.page { display: none; }
.page.active { display: block; }

h2 { font-size: 1.5rem; margin-bottom: 1.25rem; color: var(--text); }

/* ===== CARDS ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.card {
  background: white;
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.08);
}
.card-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
}
.card-icon.blue { background: #3b82f6; }
.card-icon.green { background: #10b981; }
.card-icon.orange { background: #f59e0b; }
.card-info h3 { font-size: 1.5rem; font-weight: 700; }
.card-info p { font-size: 0.85rem; color: var(--text-muted); }

/* ===== PANEL & FILTER ===== */
.panel {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.08);
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: center;
}
.filter-bar select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: white;
  min-width: 140px;
}

/* ===== TABLE ===== */
.table-responsive { overflow-x: auto; background: white; border-radius: 12px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.08); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover { background: #f8fafc; }
.data-table input[type="number"],
.data-table input[type="text"] {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}
.data-table input[type="number"] { width: 80px; text-align: center; }

.action-bar { margin-top: 1rem; display: flex; gap: 0.75rem; }

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.active { display: flex; }
.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}
.modal-content.modal-lg { max-width: 900px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-body { padding: 1.25rem; }
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ===== PRINT ===== */
@media print {
  body * { visibility: hidden; }
  #rapor-preview-area, #rapor-preview-area * { visibility: visible; }
  #rapor-preview-area {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
  }
  .modal-header, .modal-footer, .no-print { display: none !important; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar select, .filter-bar .btn { width: 100%; }
}
