/* ==========================================================================
   Incidex Australia - Design System
   A professional, warm, and accessible design
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */

:root {
  /* 2025 Color System - Light Mode */
  --color-bg: #FAFAFA;
  --color-bg-alt: #FFFFFF;
  --color-bg-elevated: #FFFFFF;
  --color-text: #1A1A1A;
  --color-text-secondary: #666666;
  --color-text-muted: #999999;
  --color-text-inverse: #FFFFFF;
  --color-border: #EBEBEB;
  --color-border-light: #F0F0F0;

  /* Accent Color - Teal (LGBTIQ+ context) */
  --color-accent: #14B8A6;
  --color-accent-dark: #0D9488;
  --color-accent-light: #5EEAD4;
  --color-accent-50: rgba(20, 184, 166, 0.08);
  --color-accent-100: rgba(20, 184, 166, 0.15);

  /* Primary Colors (using accent) */
  --color-primary: #14B8A6;
  --color-primary-dark: #0D9488;
  --color-primary-light: #5EEAD4;
  --color-primary-50: rgba(20, 184, 166, 0.08);
  --color-primary-100: rgba(20, 184, 166, 0.15);

  /* Secondary Colors (keeping for emergency/important) */
  --color-secondary: #e06055;
  --color-secondary-dark: #c94d42;
  --color-secondary-light: #e8776e;
  --color-secondary-50: rgba(224, 96, 85, 0.08);
  --color-secondary-100: rgba(224, 96, 85, 0.15);

  /* Status Colors */
  --color-success: #2d9d6f;
  --color-success-light: #e8f5ef;
  --color-success-dark: #237a56;
  --color-warning: #e8985e;
  --color-warning-light: #fdf3eb;
  --color-warning-dark: #c97d41;
  --color-error: #d9534f;
  --color-error-light: #fceaea;
  --color-info: #5bc0de;

  /* Severity Colors */
  --color-severity-low: #2d9d6f;
  --color-severity-medium: #e8985e;
  --color-severity-high: #d9534f;

  /* Case Outcome Colors */
  --color-won: #2d9d6f;
  --color-lost: #999999;
  --color-ongoing: #e8985e;

  /* Rainbow Gradient (subtle) */
  --gradient-rainbow: linear-gradient(
    90deg,
    #e06055 0%,
    #e8985e 20%,
    #f0c05a 40%,
    #2d9d6f 60%,
    #1a5f7a 80%,
    #d4a5d4 100%
  );

  /* Typography - 2025 Standards */
  --font-heading: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  --font-mono: 'Source Code Pro', 'Menlo', monospace;

  /* Font Sizes - 2025 Standards */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.75rem;     /* 28px - H3 */
  --text-3xl: 2.25rem;     /* 36px - H2 */
  --text-4xl: 3rem;        /* 48px - H1 */
  --text-5xl: 3.75rem;

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --leading-loose: 1.8;

  /* Letter Spacing */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;

  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadows - Minimal, Refined */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.08);
  --shadow-inner: inset 0 1px 2px rgba(0, 0, 0, 0.02);

  /* Focus Ring */
  --focus-ring: 0 0 0 3px rgba(26, 95, 122, 0.25);
  --focus-ring-error: 0 0 0 3px rgba(224, 96, 85, 0.25);

  /* Transitions - 2025 Easing */
  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-standard);
  --transition-base: 200ms var(--ease-standard);
  --transition-slow: 300ms var(--ease-standard);
  --transition-slower: 500ms var(--ease-standard);

  /* Z-Index Scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;

  /* Container Widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1400px;

  /* Header Height */
  --header-height: 72px;
}

/* Dark Mode Variables - 2025 Standards */
[data-theme="dark"] {
  --color-bg: #0F0F0F;
  --color-bg-alt: #1A1A1A;
  --color-bg-elevated: #242424;
  --color-text: #F5F5F5;
  --color-text-secondary: #999999;
  --color-text-muted: #666666;
  --color-border: #2A2A2A;
  --color-border-light: #333333;

  /* Accent - Lighter, more vibrant in dark mode */
  --color-accent: #5EEAD4;
  --color-primary: #5EEAD4;
  --color-primary-dark: #14B8A6;
  --color-primary-light: #99F6E4;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------------------
   CSS Reset & Base Styles
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base); /* 16px */
  font-weight: 400;
  line-height: 1.5; /* 24px */
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--text-4xl); /* 48px */
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-3xl); /* 36px */
  font-weight: 600;
  line-height: 1.2;
}

h3 {
  font-size: var(--text-2xl); /* 28px */
  font-weight: 600;
  line-height: 1.3;
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
}

p {
  margin-bottom: var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Layout Utilities
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-2xl);
  margin: 0 auto;
  padding: 0 var(--space-8); /* 32px - generous spacing */
}

.container-sm {
  max-width: var(--container-sm);
}

.container-md {
  max-width: var(--container-md);
}

.container-lg {
  max-width: var(--container-lg);
}

.container-xl {
  max-width: var(--container-xl);
}

.section {
  padding: var(--space-16) 0;
}

.section-sm {
  padding: var(--space-8) 0;
}

.section-lg {
  padding: var(--space-24) 0;
}

/* Flex Utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

.gap-8 {
  gap: var(--space-8);
}

/* Grid Utilities */
.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* --------------------------------------------------------------------------
   Header & Navigation
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  min-height: var(--header-height);
  height: auto;
  backdrop-filter: blur(10px);
  background: rgba(250, 250, 250, 0.8);
  /* Allow dropdowns to extend beyond header */
  overflow: visible;
  /* Prevent clipping of absolutely positioned children */
  contain: none;
}

[data-theme="dark"] .site-header {
  background: rgba(15, 15, 15, 0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--space-2);
  max-width: 100%;
  margin: 0;
  gap: var(--space-3);
  /* Position context for absolutely positioned dropdowns */
  position: relative;
  /* Allow dropdowns to extend beyond header */
  overflow: visible;
  /* Prevent clipping of absolutely positioned children */
  contain: none;
}

.header-inner .site-logo {
  flex-shrink: 0;
  margin-right: var(--space-4);
  margin-left: var(--space-1);
  min-width: fit-content;
  max-width: 180px;
  height: 100%;
  display: flex;
  align-items: center;
  z-index: 1;
  position: relative;
}

.header-inner .main-nav {
  flex: 1;
  justify-content: center;
  margin: 0;
  min-width: 0;
  max-width: none;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
  z-index: 0;
  /* Prevent clipping of absolutely positioned children */
  contain: none;
}

.header-inner .main-nav .nav-link {
  flex-shrink: 0;
  white-space: nowrap;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.header-inner .main-nav .nav-link svg,
.header-inner .main-nav .nav-dropdown-toggle svg:not(.nav-dropdown-arrow) {
  display: none;
}

.header-inner .main-nav::-webkit-scrollbar {
  display: none;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  flex-shrink: 0;
  height: 100%;
}

.site-logo img {
  display: block;
  max-width: 100%;
}

.logo-icon {
  width: 56px;
  height: 56px;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  padding: 0;
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

.logo-icon:hover {
  transform: scale(1.05);
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Logo size variations */
.site-logo img.logo-full {
  height: 48px;
  width: auto;
  max-height: 100%;
  object-fit: contain;
}

.site-logo img.logo-compact {
  width: 48px;
  height: auto;
}

.site-logo img.logo-large {
  width: 300px;
  height: auto;
  max-width: 400px;
}

/* Footer logo */
.footer-logo {
  margin-bottom: var(--space-4);
}

.footer-logo img {
  width: 180px;
  height: auto;
  max-width: 100%;
  opacity: 0.9;
  transition: opacity var(--transition-base);
}

.footer-logo img:hover {
  opacity: 1;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  white-space: nowrap;
}

.logo-text span {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  line-height: 1.1;
}

/* Main Navigation */
.main-nav {
  display: flex !important;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  justify-content: center;
  margin: 0 var(--space-4);
  visibility: visible !important;
  opacity: 1 !important;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  border-radius: 6px;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  min-width: fit-content;
  flex: 0 1 auto;
  text-decoration: none;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 4px;
  right: 4px;
  height: 3px;
  background: var(--color-accent);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  border-radius: var(--radius-full) var(--radius-full) 0 0;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: center;
}

.nav-link:hover {
  color: var(--color-accent);
  background: var(--color-accent-50);
}

.nav-link:hover::after {
  opacity: 0.5;
  transform: scaleX(0.7);
}

.nav-link.active {
  color: var(--color-accent);
  background: var(--color-accent-50);
  font-weight: var(--font-semibold);
}

.nav-link.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Large screens - ensure equal spacing */
@media (min-width: 1200px) {
  .main-nav {
    gap: var(--space-1);
  }

  .nav-link {
    padding: var(--space-2) var(--space-3);
  }
}

/* Header Search */
.header-search {
  display: flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
  margin-right: var(--space-1);
}

.header-search input {
  width: 220px;
  padding: var(--space-2) var(--space-3);
  padding-left: var(--space-10);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
  width: 280px;
}

.header-search input::placeholder {
  color: var(--color-text-muted);
}

.header-search svg {
  position: absolute;
  left: var(--space-3);
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  padding: var(--space-2);
  background: transparent;
  border: none;
  color: var(--color-text);
  border-radius: var(--radius-md);
}

.mobile-menu-btn:hover {
  background: var(--color-bg);
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

/* Mobile Navigation */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg-alt);
  z-index: var(--z-fixed);
  padding: var(--space-6);
  overflow-y: auto;
}

.mobile-nav.active {
  display: block;
}

.mobile-nav .nav-link {
  width: 100%;
  padding: var(--space-4);
  font-size: var(--text-base);
  justify-content: flex-start;
  border-bottom: 1px solid var(--color-border-light);
  border-radius: 0;
}

/* --------------------------------------------------------------------------
   Nav Scroll Wrapper + Scroll Hint Buttons (Mobile)
   -------------------------------------------------------------------------- */

/* Wrapper takes the flex-1 role of .main-nav inside .header-inner */
.nav-scroll-wrapper {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  /* Allow dropdown menus to escape */
  overflow: visible;
}

/* Fade gradients at edges (shown via JS class toggles) */
.nav-scroll-wrapper::before,
.nav-scroll-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  z-index: 2;
  pointer-events: none;
  transition: opacity 150ms ease;
  opacity: 0;
}

.nav-scroll-wrapper.fade-left::before {
  left: 0;
  background: linear-gradient(to right, var(--color-bg-alt) 30%, transparent);
  opacity: 1;
}

.nav-scroll-wrapper.fade-right::after {
  right: 0;
  background: linear-gradient(to left, var(--color-bg-alt) 30%, transparent);
  opacity: 1;
}

[data-theme="dark"] .nav-scroll-wrapper.fade-left::before {
  background: linear-gradient(to right, #1A1A1A 30%, transparent);
}

[data-theme="dark"] .nav-scroll-wrapper.fade-right::after {
  background: linear-gradient(to left, #1A1A1A 30%, transparent);
}

/* Chevron scroll buttons — hidden on desktop, shown on tablet/mobile */
.nav-scroll-btn {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 22px;
  height: 30px;
  padding: 0;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, background 150ms ease;
  box-shadow: var(--shadow-sm);
}

.nav-scroll-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.nav-scroll-btn:hover {
  background: var(--color-bg);
  color: var(--color-accent);
}

.nav-scroll-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.nav-scroll-btn--left {
  left: 0;
}

.nav-scroll-btn--right {
  right: 0;
}

/* Pulse animation to hint scrollability on first load */
@keyframes nav-scroll-hint {
  0%   { transform: translateY(-50%) scale(1); box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.5); }
  40%  { transform: translateY(-50%) scale(1.15); box-shadow: 0 0 0 6px rgba(20, 184, 166, 0); }
  100% { transform: translateY(-50%) scale(1); box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); }
}

.nav-scroll-btn--hint {
  animation: nav-scroll-hint 0.6s ease 0.4s 2 forwards;
  border-color: var(--color-accent);
  color: var(--color-accent);
  opacity: 1 !important;
  pointer-events: auto !important;
}

@media (max-width: 1024px) {
  .nav-scroll-btn {
    display: flex;
  }

  /* Ensure .main-nav inside wrapper still fills the space correctly */
  .nav-scroll-wrapper .main-nav {
    flex: 1;
    margin: 0;
  }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
}

/* Button Variants */
.btn-primary {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  padding: 10px 16px; /* Larger padding per brief */
  border-radius: 6px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-dark);
  filter: brightness(1.05);
  transition: filter 150ms var(--ease-standard);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-primary-50);
}

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

.btn-tertiary:hover:not(:disabled) {
  background: var(--color-bg-elevated);
  border-color: var(--color-text-muted);
}

.btn-success {
  background: var(--color-success);
  color: var(--color-text-inverse);
}

.btn-success:hover:not(:disabled) {
  background: var(--color-success-dark);
}

.btn-danger {
  background: var(--color-secondary);
  color: var(--color-text-inverse);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-secondary-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  padding: var(--space-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg);
  color: var(--color-text);
}

/* Icon Buttons */
.btn-icon {
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

.btn-icon.btn-lg {
  padding: var(--space-3);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px; /* 8-12px per brief */
  padding: 24px 32px; /* 24-32px padding per brief */
  transition: all var(--transition-slow);
}

.card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--color-border);
}

.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary-100);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-4);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.card-body {
  color: var(--color-text-secondary);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
}

/* Card Variants */
.card-primary {
  border-left: 4px solid var(--color-primary);
}

.card-secondary {
  border-left: 4px solid var(--color-secondary);
}

.card-success {
  border-left: 4px solid var(--color-success);
}

.card-warning {
  border-left: 4px solid var(--color-warning);
}

/* --------------------------------------------------------------------------
   Forms & Inputs
   -------------------------------------------------------------------------- */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.form-label.required::after {
  content: '*';
  color: var(--color-secondary);
  margin-left: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 10px; /* 10px horizontal, 8px vertical per brief */
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 6px; /* 6px per brief */
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-50);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--color-secondary);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  box-shadow: var(--focus-ring-error);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-sm);
  color: var(--color-secondary);
  margin-top: var(--space-1);
}

/* Select */
.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 18px;
  padding-right: var(--space-10);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.form-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.form-check-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* Input Group */
.input-group {
  display: flex;
  gap: var(--space-2);
}

.input-group .form-input {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Badges & Tags
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 1.4;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.badge-primary {
  background: var(--color-primary-100);
  color: var(--color-primary);
}

.badge-secondary {
  background: var(--color-secondary-100);
  color: var(--color-secondary);
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-light);
  color: var(--color-warning-dark);
}

.badge-error {
  background: var(--color-error-light);
  color: var(--color-error);
}

.badge-neutral {
  background: var(--color-bg);
  color: var(--color-text-muted);
}

/* Status Badges */
.badge-won {
  background: var(--color-success-light);
  color: var(--color-won);
}

.badge-lost {
  background: #f0f0f0;
  color: var(--color-lost);
}

.badge-ongoing {
  background: var(--color-warning-light);
  color: var(--color-ongoing);
}

/* Severity Badges */
.badge-low {
  background: var(--color-success-light);
  color: var(--color-severity-low);
}

.badge-medium {
  background: var(--color-warning-light);
  color: var(--color-severity-medium);
}

.badge-high {
  background: var(--color-error-light);
  color: var(--color-severity-high);
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.tag-accent {
  background: var(--color-accent-50);
  color: var(--color-accent-dark);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th,
.table td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

.table th {
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  background: var(--color-bg);
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
}

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

.table tbody tr:hover {
  background: var(--color-bg);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  background: var(--color-bg-dark);
  color: var(--color-text-inverse);
  padding: var(--space-16) 0 var(--space-8);
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}

.footer-section h4 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text-inverse);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-4);
}

.footer-section ul {
  list-style: none;
}

.footer-section li {
  margin-bottom: var(--space-2);
}

.footer-section a {
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.footer-section a:hover {
  color: var(--color-text-inverse);
}

.footer-section p {
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-copyright {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.5);
}

.footer-social {
  display: flex;
  gap: var(--space-4);
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.7);
  transition: all var(--transition-fast);
}

.footer-social a:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.footer-social svg {
  width: 18px;
  height: 18px;
}

/* Newsletter Form */
.newsletter-form {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.newsletter-form input {
  flex: 1;
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: var(--color-text-inverse);
  font-size: var(--text-sm);
}

.newsletter-form input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.newsletter-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Map Components
   -------------------------------------------------------------------------- */

.map-container {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
}

.map-toolbar {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.map-toolbar .btn {
  box-shadow: var(--shadow-md);
}

/* Map Legend */
.map-legend {
  position: absolute;
  bottom: var(--space-6);
  left: var(--space-4);
  z-index: 100;
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
}

.map-legend h4 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-3);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.legend-dot.low {
  background: var(--color-severity-low);
}

.legend-dot.medium {
  background: var(--color-severity-medium);
}

.legend-dot.high {
  background: var(--color-severity-high);
}

/* Sidebar Panel */
.sidebar-panel {
  position: fixed;
  top: var(--header-height);
  right: -400px;
  width: 400px;
  max-width: 100%;
  height: calc(100vh - var(--header-height));
  background: var(--color-bg-alt);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  transition: right var(--transition-slow);
  overflow-y: auto;
}

.sidebar-panel.open {
  right: 0;
}

.sidebar-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border-light);
}

.sidebar-body {
  padding: var(--space-6);
}

.sidebar-footer {
  position: sticky;
  bottom: 0;
  padding: var(--space-4) var(--space-6);
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border-light);
}

/* --------------------------------------------------------------------------
   Stat Cards
   -------------------------------------------------------------------------- */

.stat-card {
  background: var(--color-bg-alt);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  border: 1px solid var(--color-border-light);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--color-primary);
}

.stat-card.secondary::before {
  background: var(--color-secondary);
}

.stat-card.success::before {
  background: var(--color-success);
}

.stat-card.warning::before {
  background: var(--color-warning);
}

.stat-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-2);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--color-text);
  line-height: 1;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  margin-top: var(--space-2);
}

.stat-change.positive {
  color: var(--color-success);
}

.stat-change.negative {
  color: var(--color-secondary);
}

.stat-detail {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* --------------------------------------------------------------------------
   Alerts & Notifications
   -------------------------------------------------------------------------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid;
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

.alert-message {
  font-size: var(--text-sm);
}

.alert-info {
  background: var(--color-primary-50);
  border-color: var(--color-primary-100);
  color: var(--color-primary-dark);
}

.alert-success {
  background: var(--color-success-light);
  border-color: var(--color-success);
  color: var(--color-success-dark);
}

.alert-warning {
  background: var(--color-warning-light);
  border-color: var(--color-warning);
  color: var(--color-warning-dark);
}

.alert-error {
  background: var(--color-error-light);
  border-color: var(--color-error);
  color: var(--color-error);
}

/* --------------------------------------------------------------------------
   Emergency Banner
   -------------------------------------------------------------------------- */

.emergency-banner {
  background: linear-gradient(
    135deg,
    rgba(224, 96, 85, 0.08) 0%,
    rgba(232, 152, 94, 0.06) 100%
  );
  border: 1px solid rgba(224, 96, 85, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

.emergency-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-secondary);
  margin-bottom: var(--space-4);
}

.emergency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.emergency-card {
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.emergency-card-name {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.emergency-card-phone {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
}

.emergency-card-phone:hover {
  color: var(--color-primary-dark);
}

.emergency-card-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.emergency-24h {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--color-success-light);
  color: var(--color-success);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  width: fit-content;
  margin-top: var(--space-2);
}

/* --------------------------------------------------------------------------
   Loading States
   -------------------------------------------------------------------------- */

.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.loading-spinner.large {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-border-light) 25%,
    var(--color-bg) 50%,
    var(--color-border-light) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

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

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  z-index: 100;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-overlay .loading-text {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.loading-overlay .loading-progress {
  width: 200px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loading-overlay .loading-progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* --------------------------------------------------------------------------
   Transitions & Animations
   -------------------------------------------------------------------------- */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.animate-fade-in {
  animation: fadeIn var(--transition-slow) ease forwards;
}

.animate-fade-in-up {
  animation: fadeInUp var(--transition-slow) ease forwards;
}

/* Staggered animations */
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }

/* --------------------------------------------------------------------------
   Responsive Breakpoints
   -------------------------------------------------------------------------- */

/* Tablet */
@media (max-width: 1024px) {
  :root {
    --header-height: 64px;
  }

  h1 {
    font-size: var(--text-3xl);
  }

  h2 {
    font-size: var(--text-2xl);
  }

  .container {
    padding: 0 var(--space-4);
  }

  .section {
    padding: var(--space-12) 0;
  }

  .main-nav {
    gap: var(--space-1);
    margin: 0 var(--space-2);
    justify-content: flex-start;
  }
  
  .nav-link {
    padding: var(--space-2) var(--space-2);
    font-size: var(--text-xs);
  }
  
  .nav-link svg {
    width: 16px;
    height: 16px;
  }

  .header-inner {
    padding: 0 var(--space-4);
    gap: var(--space-3);
  }

  .mobile-menu-btn {
    display: flex;
  }

  .header-search {
    display: none;
  }

  .header-inner {
    padding: 0 var(--space-4);
    gap: var(--space-3);
  }

  .header-inner .site-logo {
    max-width: 150px;
    margin-right: var(--space-3);
  }

  .site-logo img.logo-full {
    height: 42px;
    width: auto;
  }

  .logo-icon {
    width: 42px;
    height: 42px;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }
}

/* Mobile */
@media (max-width: 640px) {
  :root {
    --header-height: 60px;
    --space-section: var(--space-10);
  }

  h1 {
    font-size: var(--text-2xl);
  }

  h2 {
    font-size: var(--text-xl);
  }

  h3 {
    font-size: var(--text-lg);
  }

  .container {
    padding: 0 var(--space-4);
  }

  .section {
    padding: var(--space-10) 0;
  }

  .btn {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    width: 100%;
    justify-content: center;
  }

  .btn-sm {
    width: auto;
  }

  .card {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
  }

  .header-inner .site-logo {
    max-width: 120px;
    margin-right: var(--space-2);
  }

  .site-logo img.logo-full {
    height: 36px;
    width: auto;
  }

  .logo-icon {
    width: 36px;
    height: 36px;
  }

  .logo-text {
    font-size: var(--text-lg);
  }

  .logo-text span {
    font-size: 0.65rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .footer-logo img {
    width: 140px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .sidebar-panel {
    width: 100%;
    right: -100%;
  }

  .emergency-grid {
    grid-template-columns: 1fr;
  }

  .stat-value {
    font-size: var(--text-3xl);
  }
}

/* Touch-friendly targets */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .nav-link,
  a {
    min-height: 44px;
    min-width: 44px;
  }

  .form-input,
  .form-select,
  .form-textarea {
    min-height: 48px;
    font-size: 16px; /* Prevents iOS zoom */
  }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer,
  .mobile-nav,
  .map-toolbar,
  .sidebar-panel,
  .btn,
  .no-print {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  h1, h2, h3, h4, h5, h6 {
    color: black;
  }
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */

/* Focus visible for keyboard navigation - WCAG 2.1 AA */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  z-index: 9999;
  font-weight: var(--font-semibold);
}

.skip-link:focus {
  top: var(--space-4);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-border: #000;
    --color-border-light: #000;
  }

  .btn-primary,
  .btn-secondary {
    border: 2px solid currentColor;
  }
}

/* --------------------------------------------------------------------------
   Footer Dark Background (ensure visible on all themes)
   -------------------------------------------------------------------------- */

.site-footer {
  background: #1A1A1A;
}

[data-theme="dark"] .site-footer {
  background: #0A0A0A;
}


