/* ==========================================================================
   School ERP — Design System
   Built on top of Bootstrap 5 (grid, utilities, components) rather than
   replacing it — these are the tokens and overrides that make the app look
   like a considered product instead of a stock Bootstrap page.
   ========================================================================== */

:root {
  /* Palette — deep indigo primary (trustworthy, institutional, not playful),
     teal accent for positive/success states, warm amber for attention. */
  --erp-primary: #3730a3;
  --erp-primary-dark: #2b2380;
  --erp-primary-light: #6366f1;
  --erp-accent: #0d9488;
  --erp-warning: #d97706;
  --erp-danger: #dc2626;

  --erp-ink: #1e1b2e;
  --erp-ink-muted: #6b7280;
  --erp-surface: #ffffff;
  --erp-surface-alt: #f7f7fb;
  --erp-border: #e5e7eb;

  --erp-radius: 0.65rem;
  --erp-radius-lg: 1rem;
  --erp-shadow-sm: 0 1px 2px rgba(30, 27, 46, 0.06);
  --erp-shadow: 0 4px 16px rgba(30, 27, 46, 0.08);
  --erp-shadow-lg: 0 12px 32px rgba(30, 27, 46, 0.12);

  --erp-sidebar-width: 260px;
  --erp-topbar-height: 64px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--erp-ink);
  background: var(--erp-surface-alt);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .erp-heading {
  font-weight: 700;
  letter-spacing: -0.01em;
}

a { color: var(--erp-primary); }
a:hover { color: var(--erp-primary-dark); }

/* Bootstrap primary-color overrides, so .btn-primary/.bg-primary/.text-primary
   etc. all pick up the brand palette without touching every template. */
.btn-primary {
  background-color: var(--erp-primary);
  border-color: var(--erp-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--erp-primary-dark);
  border-color: var(--erp-primary-dark);
}
.btn-outline-primary {
  color: var(--erp-primary);
  border-color: var(--erp-primary);
}
.btn-outline-primary:hover {
  background-color: var(--erp-primary);
  border-color: var(--erp-primary);
}
.text-primary { color: var(--erp-primary) !important; }
.bg-primary { background-color: var(--erp-primary) !important; }

.form-control:focus, .form-select:focus {
  border-color: var(--erp-primary-light);
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.15);
}

/* ==========================================================================
   App shell — collapsible sidebar + topbar, used by layouts/app.php
   ========================================================================== */

.erp-shell {
  display: flex;
  min-height: 100vh;
}

.erp-sidebar {
  width: var(--erp-sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--erp-primary-dark), var(--erp-primary));
  color: #fff;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 1040;
  transition: transform 0.2s ease;
}

.erp-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.25rem 1.25rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.erp-sidebar-brand:hover { color: #fff; }

.erp-sidebar-nav { padding: 0.75rem 0.75rem; }

.erp-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--erp-radius);
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.94rem;
  margin-bottom: 0.15rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.erp-sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.erp-sidebar-link.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.erp-sidebar-link .bi, .erp-sidebar-link .erp-icon { width: 1.1rem; text-align: center; }

.erp-main {
  margin-left: var(--erp-sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.erp-topbar {
  height: var(--erp-topbar-height);
  background: var(--erp-surface);
  border-bottom: 1px solid var(--erp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.erp-sidebar-toggle {
  display: none;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--erp-ink);
  padding: 0.25rem 0.5rem;
}

.erp-content { padding: 1.5rem; flex: 1; }

.erp-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1035;
}

@media (max-width: 991.98px) {
  .erp-sidebar {
    transform: translateX(-100%);
  }
  .erp-sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--erp-shadow-lg);
  }
  .erp-main { margin-left: 0; }
  .erp-sidebar-toggle { display: inline-block; }
  .erp-sidebar-backdrop.is-open { display: block; }
}

/* ==========================================================================
   Cards, tables, badges — shared across list/detail/form pages
   ========================================================================== */

.erp-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius-lg);
  box-shadow: var(--erp-shadow-sm);
}

.erp-stat-card {
  border-radius: var(--erp-radius-lg);
  padding: 1.25rem 1.5rem;
  color: #fff;
  background: linear-gradient(135deg, var(--erp-primary), var(--erp-primary-light));
  box-shadow: var(--erp-shadow);
}
.erp-stat-card .erp-stat-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.erp-stat-card .erp-stat-label { opacity: 0.85; font-size: 0.9rem; margin-top: 0.35rem; }

.erp-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--erp-ink-muted);
  margin-bottom: 0.75rem;
}

.table.erp-table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--erp-ink-muted);
  border-bottom-width: 1px;
  font-weight: 700;
}
.table.erp-table td { vertical-align: middle; }

.erp-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--erp-surface-alt);
  border: 1px solid var(--erp-border);
}
.erp-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--erp-primary-light);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Responsive table -> stacked cards below 768px, used on the student list */
@media (max-width: 767.98px) {
  .erp-table-responsive-cards thead { display: none; }
  .erp-table-responsive-cards tbody tr {
    display: block;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    margin-bottom: 0.75rem;
    padding: 0.75rem;
  }
  .erp-table-responsive-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    padding: 0.35rem 0;
  }
  .erp-table-responsive-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--erp-ink-muted);
    font-size: 0.8rem;
    margin-right: 1rem;
  }
}

/* ==========================================================================
   Forms — sectioned, wizard-like layout for the full Student form
   ========================================================================== */

.erp-form-section {
  border-bottom: 1px solid var(--erp-border);
  padding: 1.5rem 0;
}
.erp-form-section:last-child { border-bottom: none; }

.erp-form-section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.erp-form-section-hint {
  color: var(--erp-ink-muted);
  font-size: 0.87rem;
  margin-bottom: 1rem;
}

.erp-required::after {
  content: '*';
  color: var(--erp-danger);
  margin-left: 0.2rem;
}

.erp-age-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--erp-surface-alt);
  border: 1px solid var(--erp-border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  color: var(--erp-ink-muted);
  margin-top: 0.4rem;
}
.erp-age-chip strong { color: var(--erp-ink); }

.erp-sibling-result {
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: var(--erp-radius);
}
.erp-sibling-result:hover { background: var(--erp-surface-alt); }

.erp-photo-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--erp-border);
  background: var(--erp-surface-alt);
}

/* ==========================================================================
   Landing page
   ========================================================================== */

.erp-landing-hero {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(99, 102, 241, 0.25), transparent),
    linear-gradient(160deg, var(--erp-primary-dark), var(--erp-primary) 60%);
  color: #fff;
}

.erp-landing-nav {
  padding: 1.25rem 0;
}

.erp-feature-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--erp-radius);
  background: rgba(55, 48, 163, 0.1);
  color: var(--erp-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.erp-landing-mock {
  background: var(--erp-surface);
  border-radius: var(--erp-radius-lg);
  box-shadow: var(--erp-shadow-lg);
  padding: 1.25rem;
  color: var(--erp-ink);
}

/* ==========================================================================
   Auth (login) screen
   ========================================================================== */

.erp-auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--erp-surface-alt);
}
.erp-auth-visual {
  flex: 1;
  background: linear-gradient(160deg, var(--erp-primary-dark), var(--erp-primary) 65%, var(--erp-accent));
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
}
.erp-auth-form-panel {
  width: 480px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--erp-surface);
}
@media (max-width: 991.98px) {
  .erp-auth-visual { display: none; }
  .erp-auth-form-panel { width: 100%; }
}

.erp-role-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.82rem;
  margin: 0.2rem 0.3rem 0.2rem 0;
}
