/**
 * Sri NRI Junior College - Unified Brand & Accessibility Design System
 */
:root {
  /* Institutional Brand Palette */
  --brand-primary: #D9480F;
  --brand-primary-hover: #C2410C;
  --brand-primary-light: #FF6A1F;
  --brand-secondary: #0F172A;
  --brand-secondary-hover: #1E293B;
  --brand-accent: #0284C7;
  --brand-accent-hover: #0369A1;

  /* Semantic Feedback (Accessible 4.5:1+ Contrast) */
  --brand-success: #15803D;
  --brand-success-bg: #DCFCE7;
  --brand-warning: #B45309;
  --brand-warning-bg: #FEF3C7;
  --brand-danger: #B91C1C;
  --brand-danger-bg: #FEE2E2;
  --brand-info: #0369A1;
  --brand-info-bg: #E0F2FE;

  /* Neutral Surfaces & Text */
  --brand-bg: #F8FAFC;
  --brand-surface: #FFFFFF;
  --brand-surface-raised: #F1F5F9;
  --brand-border: #CBD5E1;
  --brand-border-light: #E2E8F0;
  --brand-text: #0F172A;
  --brand-text-muted: #475569;
  --brand-text-subtle: #64748B;

  /* Typography */
  --brand-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --brand-font-mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --brand-text-caption: 12px;
  --brand-text-sm: 14px;
  --brand-text-base: 15px;
  --brand-text-lg: 18px;

  /* Geometry & Radius */
  --brand-radius-xs: 4px;
  --brand-radius-sm: 6px;
  --brand-radius-md: 10px;
  --brand-radius-lg: 14px;
  --brand-radius-pill: 999px;

  /* Tap Targets */
  --brand-tap-min: 44px;
}

[data-bs-theme="dark"], .dark-mode {
  --brand-bg: #0B132B;
  --brand-surface: #1E293B;
  --brand-surface-raised: #334155;
  --brand-border: #475569;
  --brand-border-light: #334155;
  --brand-text: #F8FAFC;
  --brand-text-muted: #94A3B8;
  --brand-text-subtle: #CBD5E1;
}

/* ================= Accessibility & Focus System ================= */
:focus-visible {
  outline: 2.5px solid var(--brand-accent) !important;
  outline-offset: 2px !important;
}

body {
  font-family: var(--brand-font-sans);
  font-size: var(--brand-text-base);
  color: var(--brand-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Ensure minimum text size 14px for body text and 12px for captions */
p, span, li, td, th, input, select, textarea, button {
  font-size: var(--brand-text-base);
}

small, .small, .caption, .badge, .form-text, .text-muted {
  font-size: var(--brand-text-caption) !important;
}

/* Minimum 44x44px Tap Targets for Touch Optimization */
.btn,
.nav-link,
.dropdown-item,
.page-link,
button:not(.btn-close),
.form-check-input,
.btn-icon {
  min-height: var(--brand-tap-min);
  display: inline-flex;
  align-items: center;
}

.btn-sm {
  min-height: 38px;
  padding: 6px 14px;
}

@media (max-width: 768px) {
  .btn,
  .btn-sm,
  button:not(.btn-close) {
    min-height: var(--brand-tap-min) !important;
    min-width: var(--brand-tap-min);
  }
}

/* Tabular figures for numbers */
.value, .stat-value, .num, .figure, .amount, .count, [data-field="admission_number"], [data-field="mobile"] {
  font-family: var(--brand-font-mono) !important;
  font-variant-numeric: tabular-nums !important;
}

/* Contrast-Safe Text Color Utilities (>= 4.5:1 ratio on light & dark backgrounds) */
.text-success {
  color: var(--brand-success) !important;
}
.text-danger {
  color: var(--brand-danger) !important;
}
.text-warning {
  color: var(--brand-warning) !important;
}
.text-muted {
  color: var(--brand-text-muted) !important;
}

.sticky-start-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background-color: var(--brand-surface) !important;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
}

/* Table Responsive Horizontal Scroll Prevention */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .table-responsive th:first-child,
  .table-responsive td:first-child {
    position: sticky;
    left: 0;
    background: var(--brand-surface);
    z-index: 2;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
  }
}
