/* ============================================================
   ISI Pedagogical App — Base Design System
   ISI-DS-PEDA-001 | v1.0
   ============================================================ */

/* ── 1. Design Tokens ───────────────────────────────────────── */
:root {
  --sidebar-w: 260px;
  --header-h: 64px;
  --radius: 10px;

  --sidebar-bg: #0f172a;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-text: #94a3b8;
  --sidebar-active: #f59e0b;
  --sidebar-active-bg: rgba(245, 158, 11, 0.1);

  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-soft: rgba(245, 158, 11, 0.12);

  --success: #10b981;
  --danger: #ef4444;

  --body-bg: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;

  --text-primary: #0f172a;
  --text-muted: #64748b;

  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);

  --font-head: "Barlow Condensed", sans-serif;
  --font-body: "Barlow", sans-serif;
}

/* ── 2. Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--body-bg);
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.3px;
  margin: 0;
}

a { text-decoration: none; }

/* ── 3. Layout Shell ────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s ease;
}

#main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── 4. Topbar ─────────────────────────────────────────────── */
#topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.topbar-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.topbar-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.topbar-breadcrumb a:hover { color: var(--accent); }

.topbar-breadcrumb .bc-sep {
  font-size: 10px;
  opacity: 0.5;
}

.topbar-breadcrumb .bc-active {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-btn {
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.topbar-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.topbar-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0f172a;
  font-weight: 600;
}

.topbar-btn.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #0f172a;
}

/* Mobile toggle */
.topbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* ── 5. Flash messages ──────────────────────────────────────── */
#flash-container {
  padding: 12px 28px 0;
}

/* ── 6. Page Content ────────────────────────────────────────── */
#page-content {
  padding: 28px;
  flex: 1;
}

/* ── 7. Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header-left { flex: 1; min-width: 0; }

.page-header-left h1 {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* ── 8. Sidebar Brand ───────────────────────────────────────── */
.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  text-decoration: none;
}

.sidebar-brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #0f172a;
  flex-shrink: 0;
}

.sidebar-brand-text { line-height: 1.2; }

.sidebar-brand-name {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
}

/* ── 9. Sidebar Navigation ──────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  padding: 8px 20px 4px;
  margin-top: 8px;
  display: block;
  font-family: var(--font-body);
}

.nav-item-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: var(--font-body);
  cursor: pointer;
}

.nav-item-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item-link.active {
  color: var(--sidebar-active);
  border-left-color: var(--accent);
  background: var(--sidebar-active-bg);
}

.nav-item-link i { font-size: 15px; flex-shrink: 0; }

.nav-item-link[data-bs-toggle="collapse"]::after {
  content: "\F282";
  font-family: "bootstrap-icons";
  font-size: 12px;
  margin-left: auto;
  color: rgba(255, 255, 255, 0.3);
  transition: transform 0.2s;
}

.nav-item-link[data-bs-toggle="collapse"][aria-expanded="true"]::after {
  transform: rotate(180deg);
  color: var(--accent);
}

.nav-sub {
  background: rgba(0, 0, 0, 0.2);
}

.nav-sub .nav-item-link {
  padding-left: 50px;
  font-size: 13px;
  border-left: 3px solid transparent;
}

.nav-sub .nav-item-link.active {
  color: var(--sidebar-active);
  border-left-color: var(--accent);
  background: var(--sidebar-active-bg);
}

.badge-count {
  margin-left: auto;
  background: var(--accent);
  color: #0f172a;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

/* ── 10. Sidebar Footer ─────────────────────────────────────── */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-footer-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--sidebar-text);
  text-transform: capitalize;
  display: block;
}

.sidebar-footer-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.sidebar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ── 11. Cards ──────────────────────────────────────────────── */
.isi-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.isi-card-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.isi-card-header h2,
.isi-card-header h3 {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-primary);
  margin: 0;
}

.isi-card-header .header-count {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 400;
}

.isi-card-body { padding: 24px; }

/* Card Icon */
.card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.card-icon.amber { background: var(--accent-soft); color: var(--accent); }
.card-icon.green { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.card-icon.blue  { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.card-icon.red   { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.card-icon.purple{ background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }

/* ── 12. KPI Stat Block ─────────────────────────────────────── */
.stat-value {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.stat-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── 13. Tables ─────────────────────────────────────────────── */
.isi-table {
  width: 100%;
  border-collapse: collapse;
}

.isi-table thead tr {
  background: #f8fafc;
  border-bottom: 2px solid var(--card-border);
}

.isi-table th {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
}

.isi-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--card-border);
  vertical-align: middle;
  color: var(--text-primary);
  font-size: 14.5px;
}

.isi-table tbody tr:hover { background: #f8fafc; }

.isi-table tbody tr:last-child td { border-bottom: none; }

.table-primary-link {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.15s;
}

.table-primary-link:hover { color: var(--accent); }

.table-secondary-text {
  font-size: 13px;
  color: var(--text-muted);
  display: block;
}

/* ── 14. Badges ─────────────────────────────────────────────── */
.isi-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.isi-badge.amber { background: var(--accent-soft); color: #92400e; }
.isi-badge.green { background: rgba(16, 185, 129, 0.12); color: #065f46; }
.isi-badge.red   { background: rgba(239, 68, 68, 0.12); color: #991b1b; }
.isi-badge.blue  { background: rgba(59, 130, 246, 0.12); color: #1e40af; }
.isi-badge.gray  { background: #f1f5f9; color: #475569; }

/* ── 15. Buttons ────────────────────────────────────────────── */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 8px;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  line-height: 1.4;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12.5px;
}

.btn-amber {
  background: var(--accent);
  color: #0f172a;
  border-color: var(--accent);
}

.btn-amber:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #0f172a;
}

.btn-outline-amber {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline-amber:hover {
  background: var(--accent);
  color: #0f172a;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--card-border);
}

.btn-ghost:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-danger-soft {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: transparent;
}

.btn-danger-soft:hover {
  background: var(--danger);
  color: #fff;
}

/* ── 16. Forms ──────────────────────────────────────────────── */
.form-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: var(--font-body);
  display: block;
}

.form-control,
.form-select {
  border-radius: 8px;
  border-color: var(--card-border);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 13px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  border: 1px solid var(--card-border);
  width: 100%;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
  outline: none;
}

.form-control.is-invalid { border-color: var(--danger); }

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.invalid-feedback { font-size: 12px; color: var(--danger); }

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
  border-color: var(--accent);
}

/* Icon-prefixed input */
.input-icon-wrap { position: relative; }

.input-icon-wrap > i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
  z-index: 1;
}

.input-icon-wrap .form-control { padding-left: 38px; }

/* Form section title */
.form-section-title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  margin-bottom: 20px;
}

/* Section divider */
.section-divider {
  height: 1px;
  background: var(--card-border);
  margin: 24px 0;
}

/* ── 17. Alerts ─────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  font-size: 13.5px;
  border: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
}

.alert i { flex-shrink: 0; margin-top: 2px; font-size: 16px; }

.alert-success { background: rgba(16, 185, 129, 0.1); color: #065f46; }
.alert-danger  { background: rgba(239, 68, 68, 0.1); color: #991b1b; }
.alert-warning { background: rgba(245, 158, 11, 0.1); color: #92400e; }
.alert-info    { background: rgba(59, 130, 246, 0.1); color: #1e40af; }

/* ── 18. Animations ─────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.35s ease forwards; }

.fade-up-delay-1 { opacity: 0; animation: fadeUp 0.35s ease 0.05s forwards; }
.fade-up-delay-2 { opacity: 0; animation: fadeUp 0.35s ease 0.10s forwards; }
.fade-up-delay-3 { opacity: 0; animation: fadeUp 0.35s ease 0.15s forwards; }

/* ── 19. Pagination ─────────────────────────────────────────── */
.isi-pagination {
  padding: 16px 24px;
  border-top: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.isi-pagination-info {
  font-size: 13px;
  color: var(--text-muted);
}

.isi-pagination-controls { display: flex; gap: 4px; }

/* ── 20. Mobile overlay ─────────────────────────────────────── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1039;
}

#sidebar-overlay.active { display: block; }

/* ── 21. Detail page meta list ──────────────────────────────── */
.detail-meta { list-style: none; padding: 0; margin: 0; }

.detail-meta li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 14px;
}

.detail-meta li:last-child { border-bottom: none; }

.detail-meta .meta-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  min-width: 110px;
  flex-shrink: 0;
  margin-top: 2px;
  font-family: var(--font-body);
}

.detail-meta .meta-value {
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

/* ── 22. Responsive ─────────────────────────────────────────── */
@media (max-width: 991.98px) {
  #sidebar {
    transform: translateX(-100%);
    z-index: 1045;
  }

  #sidebar.sidebar-open { transform: translateX(0); }

  #main-wrap { margin-left: 0; }

  #page-content { padding: 20px 16px; }

  #topbar { padding: 0 16px; }

  #flash-container { padding: 10px 16px 0; }

  .topbar-toggle { display: flex; align-items: center; }

  .page-header-left h1 { font-size: 22px; }
}

@media (max-width: 575.98px) {
  .isi-card-body { padding: 16px; }
  .isi-card-header { padding: 14px 16px 12px; }
}

/* ── 23. Fill Rate Bar ──────────────────────────────────────── */
.fill-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.fill-bar-track {
  flex: 1;
  height: 8px;
  background: var(--card-border);
  border-radius: 4px;
  overflow: hidden;
}

.fill-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s;
}

.fill-bar-label {
  font-weight: 600;
  font-size: 13px;
  min-width: 38px;
}

/* ── 24. Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state-icon {
  font-size: 52px;
  color: #e2e8f0;
  margin-bottom: 16px;
  line-height: 1;
}

.empty-state-text {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0 0 16px;
}
