/* GaadiDiary 2.0 — Design Tokens & Typography Foundation */
/* Single Source of Truth matching DESIGN.md */

:root {
  /* ==========================================================================
     Core Palette (DESIGN.md Section 2.1)
     ========================================================================== */
  --color-primary: #003399;           /* HSRP India Blue — Main brand accent, primary CTA */
  --color-primary-hover: #002266;     /* Pressed and hover state for primary elements */
  --color-canvas: #F8F9FA;            /* Canvas / App body background (neutral, glare-free) */
  --color-surface: #FFFFFF;           /* Card and surface background */
  --color-surface-subtle: #F1F3F5;    /* Muted table headers, search inputs, subtle areas */
  --color-text-primary: #12151A;      /* Deep Carbon ink — Headings, metrics, primary data */
  --color-text-secondary: #4A5260;    /* Graphite slate — Form labels, subheaders */
  --color-text-muted: #5E6778;        /* Muted utility text, timestamps, table column heads */
  --color-border: #E2E4E9;            /* Hairline dividers, card boundaries, separators */
  --color-border-focus: #003399;      /* High-contrast keyboard and input focus boundary */

  /* ==========================================================================
     Semantic Operational Signals (DESIGN.md Section 2.2)
     ========================================================================== */
  /* Success / Paid */
  --color-success: #059669;
  --color-success-bg: #ECFDF5;
  --color-success-border: #A7F3D0;
  --color-success-text: #047857;      /* Emerald 700: 5.21:1 contrast on tint BG */

  /* Warning / Due */
  --color-warning: #D97706;
  --color-warning-bg: #FFFBEB;
  --color-warning-border: #FDE68A;
  --color-warning-text: #92400E;      /* Amber 800: 6.84:1 contrast on tint BG */

  /* Danger / Alert */
  --color-danger: #DC2626;
  --color-danger-bg: #FEF2F2;
  --color-danger-border: #FECACA;
  --color-danger-text: #B91C1C;       /* Crimson 700: 5.91:1 contrast on tint BG */

  /* Info / Scheduled */
  --color-info: #0284C7;
  --color-info-bg: #F0F9FF;
  --color-info-border: #BAE6FD;
  --color-info-text: #0369A1;         /* Sky 700: 5.57:1 contrast on tint BG */

  /* ==========================================================================
     Typography Stacks & Scale (DESIGN.md Section 3)
     ========================================================================== */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Menlo, Monaco, Consolas, monospace;
}

/* Explicit Typographic Hierarchy (>= 1.25x ratio across dominant roles) */
.type-page-title {
  font-size: 1.5rem; /* 24px */
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.type-section-title {
  font-size: 1.25rem; /* 20px (1.25x over 16px body) */
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.type-subsection-title {
  font-size: 0.875rem; /* 14px */
  line-height: 1.4;
}

/* Browser Surface Cohesion (Selection, Caret, Scrollbars, Links) */
::selection {
  background-color: rgba(0, 51, 153, 0.14);
  color: var(--color-text-primary);
}

input,
select,
textarea {
  caret-color: var(--color-primary);
}

a {
  text-underline-offset: 3px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: #CBD5E1;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #94A3B8;
}

/* Tabular Numerals Enforcement */
.font-mono, [data-tabular], .tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Semantic Badges with Verified WCAG AA Contrast Ratios */
.badge-success {
  background-color: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success-text);
}

.badge-warning {
  background-color: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning-text);
}

.badge-danger {
  background-color: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: var(--color-danger-text);
}

.badge-info {
  background-color: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  color: var(--color-info-text);
}

/* Visual HSRP Number Plate Component (DESIGN.md Section 5.3) */
.hsrp-plate {
  display: inline-flex;
  align-items: stretch;
  height: 1.75rem;
  padding: 2px;
  gap: 2px;
  background-color: #FFFFFF;
  border: 1px solid #12151A;
  border-radius: 4px;
  overflow: hidden;
  font-family: var(--font-mono);
  user-select: none;
  flex-shrink: 0;
}

.hsrp-badge {
  background-color: var(--color-primary);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  padding: 0 6px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  letter-spacing: -0.02em;
  line-height: 1;
}

.hsrp-text {
  padding: 0 7px;
  color: var(--color-text-primary);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

/* ==========================================================================
   Application Shell Navigation Styles (DESIGN.md Section 5.7)
   ========================================================================== */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  border-left: 3px solid transparent;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
  text-decoration: none;
}

.nav-link.is-collapsed {
  justify-content: center;
  padding: 0.85rem 0;
  gap: 0;
}

.nav-link:hover {
  background-color: var(--color-canvas);
  color: var(--color-text-primary);
}

.nav-link.active,
.nav-active {
  background-color: rgba(0, 51, 153, 0.08);
  color: var(--color-primary);
  font-weight: 700;
}

.nav-link.active i,
.nav-active i {
  color: var(--color-primary);
}

/* ==========================================================================
   Safe-Area Bottom Dock & Content Clearance (DESIGN.md Section 4.2 & 5.7)
   ========================================================================== */
.mobile-bottom-dock {
  min-height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-content-clearance {
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

/* ==========================================================================
   Accessibility & Keyboard Focus Rings (DESIGN.md Section 8)
   ========================================================================== */
:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

/* Maintain clean mouse click experience while guaranteeing keyboard accessibility */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* Mobile Tab Swipe Surface & Directional Arrival Motion */
.tab-swipe-surface {
  touch-action: pan-y;
}

.tab-swipe-surface .overflow-x-auto {
  touch-action: pan-x pan-y;
}

@keyframes tab-enter-next {
  from {
    opacity: 0.45;
    transform: translate3d(18px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes tab-enter-prev {
  from {
    opacity: 0.45;
    transform: translate3d(-18px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes tab-enter-fade {
  from {
    opacity: 0.65;
  }
  to {
    opacity: 1;
  }
}

.tab-slide-next {
  animation: tab-enter-next 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-slide-prev {
  animation: tab-enter-prev 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reduced motion preference support (preserve state feedback, suppress translational motion) */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .animate-in,
  .transition-transform {
    animation: none !important;
    transform: none !important;
  }

  .tab-slide-next,
  .tab-slide-prev {
    animation: tab-enter-fade 120ms ease;
  }

  .fa-spin {
    animation: none !important;
    opacity: 0.75;
  }
}

/* Subtle KPI chart metadata pill */
.bklit-chart-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: #F8F9FA;
  border: 1px solid #E2E4E9;
  color: #4A5260;
}
