/**
 * THANE POLICE COMMISSIONERATE
 * Canonical Design Tokens & Design System Core (tokens.css)
 * Strict 8px spacing scale, modern government palette, fluid clamp typography,
 * and WCAG 2.1 AA accessibility standards.
 */

:root {
  /* ==========================================================================
     1. COLOR PALETTE (Modern Civic Government)
     ========================================================================== */
  /* Thane Navy Scale */
  --color-navy-950: #071930;
  --color-navy-900: #0b2447;  /* Deep Navy */
  --color-navy-800: #12386b;  /* Thane Police Primary Navy */
  --color-navy-700: #1a4f8b;  /* Royal Blue Accent */
  --color-navy-600: #2563eb;  /* Vibrant Civic Blue */
  --color-navy-100: #e0edfb;  /* Navy Light Tint */
  --color-navy-50:  #f0f6fd;  /* Navy Wash */

  /* Saffron Gold & Police Logo Orange Accent */
  --color-saffron:        #ea580c;  /* Police Logo Saffron/Orange Accent */
  --color-saffron-dark:   #c2410c;  /* Deep Orange Hover */
  --color-saffron-light:  #ffedd5;  /* Orange Badge Background */
  --color-saffron-border: #fdba74;  /* Orange Border */

  /* Surfaces & Backgrounds (Warm Orange Theme matching Thane Police Logo) */
  --color-bg-page:        #fff3e0;  /* Warm Orange Page Canvas */
  --color-bg-body:        #fff3e0;
  --color-surface-card:   #ffffff;  /* Crisp White Card */
  --color-surface-subtle: #ffedd5;  /* Warm Orange Section Background */
  --color-surface-muted:  #fed7aa;  /* Muted Orange Inset Background */

  /* Neutral Slate Text (WCAG AAA / AA compliant) */
  --color-text-main:    #0f172a;  /* Slate 900 (15.6:1 contrast against white) */
  --color-text-body:    #1e293b;  /* Slate 800 (12.6:1 contrast) */
  --color-text-muted:   #64748b;  /* Slate 500 (4.6:1 contrast - AA compliant) */
  --color-text-light:   #94a3b8;  /* Subtle captions */
  --color-text-inverse: #ffffff;  /* High contrast white */

  /* Semantic Alerts */
  --color-danger:         #dc2626;  /* Emergency Red (112, SOS) */
  --color-danger-dark:    #b91c1c;
  --color-danger-bg:      #fef2f2;
  --color-danger-border:  #fecaca;

  --color-success:        #15803d;  /* Green 700 */
  --color-success-bg:     #f0fdf4;
  --color-warning:        #d97706;
  --color-warning-bg:     #fffbeb;

  /* Borders & Dividers */
  --color-border:         #e2e8f0;  /* Card Border */
  --color-border-subtle:  #cbd5e1;  /* Dividers & Form Borders */
  --color-border-strong:  #94a3b8;

  /* ==========================================================================
     2. STRICT 8PX SPACING SCALE
     ========================================================================== */
  --space-1:   4px;   /* Half-unit (badges, inner padding) */
  --space-2:   8px;   /* 1 unit */
  --space-3:  12px;   /* 1.5 units */
  --space-4:  16px;   /* 2 units (standard component gap) */
  --space-6:  24px;   /* 3 units (card padding, desktop gut) */
  --space-8:  32px;   /* 4 units (module gap) */
  --space-12: 48px;   /* 6 units (sub-section separation) */
  --space-16: 64px;   /* 8 units (desktop section rhythm) */
  --space-24: 96px;   /* 12 units (hero / landing rhythm) */

  /* ==========================================================================
     3. LAYOUT & SECTION RHYTHM
     ========================================================================== */
  --container-max-width:       1200px;
  --container-padding-desktop: 24px;
  --container-padding-mobile:  16px;
  --section-padding-desktop:   64px 0;
  --section-padding-mobile:    40px 0;

  /* ==========================================================================
     4. TYPOGRAPHY & FLUID CLAMP
     ========================================================================== */
  --font-sans: 'Inter', 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-h1: clamp(1.85rem, 4vw, 2.5rem);
  --font-h2: clamp(1.5rem, 3vw, 2rem);
  --font-h3: clamp(1.2rem, 2vw, 1.4rem);
  --font-body: 1rem;
  --font-small: 0.875rem;
  --font-tiny: 0.75rem;

  /* ==========================================================================
     5. RADII & ELEVATIONS
     ========================================================================== */
  --radius-sm:   6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  --shadow-sm:         0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-card:       0 2px 8px -1px rgba(15, 23, 42, 0.06), 0 1px 3px -1px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 10px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-lg:         0 14px 28px -4px rgba(15, 23, 42, 0.12);

  --transition-fast:   all 0.15s ease;
  --transition-smooth: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);

  /* ==========================================================================
     6. UNIFIED CANONICAL ALIASES (Shared by Public Site & Admin CMS)
     ========================================================================== */
  --navy:          #12294a;
  --navy-dark:     #0b1e36;
  --navy-primary:  #12386b;
  --orange:        #ea580c;
  --orange-accent: #e8651a;
  --orange-dark:   #c2410c;
  --orange-soft:   #ffedd5;
  --bg:            #fff3e0;
  --bg-subtle:     #ffedd5;
  --card-bg:       #ffffff;
  --text:          #0f172a;
  --text-body:     #1e293b;
  --text-muted:    #475569;
  --border:        #e2e8f0;
  --border-subtle: #cbd5e1;
  --success:       #15803d;
  --success-bg:    #f0fdf4;
  --warning:       #d97706;
  --warning-bg:    #fffbeb;
  --danger:        #dc2626;
  --danger-dark:   #b91c1c;
  --danger-bg:     #fef2f2;
  --font-heading:  var(--font-sans);
  --font-body:     var(--font-sans);
  --radius:        var(--radius-md);
  --radius-card:   var(--radius-lg);
  --radius-btn:    var(--radius-md);
  --space-5:       20px;
}

/* ==========================================================================
   GLOBAL UTILITIES & SYSTEM COMPLIANCE
   ========================================================================== */

/* Strict container system */
.site-container,
.container-constrained {
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding-desktop);
  padding-right: var(--container-padding-desktop);
  width: 100%;
}

@media (max-width: 768px) {
  .site-container,
  .container-constrained {
    padding-left: var(--container-padding-mobile);
    padding-right: var(--container-padding-mobile);
  }
}

/* Section rhythmic spacing */
.portal-section {
  padding: var(--section-padding-desktop);
  background: var(--color-bg-page);
}

@media (max-width: 768px) {
  .portal-section {
    padding: var(--section-padding-mobile);
  }
}

/* Zero Stray Gap Fix: Headlines Marquee into Hero */
.headlines-wrap,
#headlinesTickerWrap {
  margin-bottom: 0 !important;
  border-bottom: 1px solid var(--color-border);
}

.main-hero,
.hero-section {
  margin-top: 0 !important;
}

/* Equal-Height Flex Cards with Auto-Bottom Footers */
.card-grid-unified {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
  align-items: stretch;
}

.card-item-unified {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

.card-item-unified:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-navy-700);
}

.card-item-unified .card-bottom-action {
  margin-top: auto;
  padding-top: var(--space-4);
}

/* High Contrast Keyboard Focus Rings */
:focus-visible {
  outline: 2px solid var(--color-saffron) !important;
  outline-offset: 2px !important;
}

/* Touch-Enabled Mobile Responsive Table Wrapper */
.table-responsive-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

/* Skeleton Loading State Placeholder */
.skeleton-shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
