/**
 * CaltransBizConnect Design System
 * 
 * Implements Caltrans editorial and accessibility standards:
 * - Sans serif typography (Arial, Calibri) at 11-14pt
 * - High contrast ratios for WCAG 2.1 AA compliance
 * - Accessible color system
 * - Consistent spacing and layout tokens
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@600;700;800&display=swap');

/* ============================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================ */

:root {
  /* Typography */
  --font-family-primary: 'Arial', 'Calibri', sans-serif;
  --font-family-secondary: 'Arial', 'Calibri', sans-serif;

  --font-size-xs: 0.6875rem;
  /* 11px */
  --font-size-sm: 0.75rem;
  /* 12px */
  --font-size-base: 1rem;
  /* 16px - body text (approx 12pt) */
  --font-size-md: 1rem;
  /* 16px */
  --font-size-lg: 1.125rem;
  /* 18px */
  --font-size-xl: 1.5rem;
  /* 24px */
  --font-size-2xl: 2rem;
  /* 32px */
  --font-size-3xl: 2.5rem;
  /* 40px */

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* Colors - Caltrans Brand */
  --color-primary: #005A8C;
  /* Caltrans Blue */
  --color-primary-dark: #003D5C;
  --color-primary-light: #0077B3;

  --color-secondary: #FFCC00;
  /* Caltrans Gold (accent) */
  --color-secondary-dark: #ccaa00;
  --color-secondary-light: #ffdd44;

  --color-success: #2E7D32;
  --color-success-light: #E8F5E9;

  --color-warning: #FFCC00;
  --color-warning-text: #000000;
  --color-warning-light: #FFF9C4;

  --color-error: #C62828;
  --color-error-light: #FFEBEE;

  --color-info: #0277BD;
  --color-info-light: #E1F5FE;

  /* Neutral Colors - High Contrast */
  --color-text-primary: #000000;
  /* Black on white background per standards */
  --color-text-secondary: #000000;
  --color-text-muted: #000000;
  --color-text-inverse: #FFFFFF;

  --color-bg-primary: #FFFFFF;
  --color-bg-secondary: #F5F5F5;
  --color-bg-tertiary: #E8E8E8;
  --color-bg-dark: #1A1A1A;

  --color-border: #CCCCCC;
  --color-border-light: #E0E0E0;
  --color-border-dark: #999999;

  /* Aliases for shorter usage and backward compatibility */
  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted: #4b5563;
  /* Gray-600 for actual muted look with contrast */
  --text-inverse: var(--color-text-inverse);
  --bg-white: #ffffff;
  --bg-gray-50: #f9fafb;
  --bg-gray-100: #f3f4f6;

  /* Spacing Scale */
  --space-xs: 0.25rem;
  /* 4px */
  --space-sm: 0.5rem;
  /* 8px */
  --space-md: 1rem;
  /* 16px */
  --space-lg: 1.5rem;
  /* 24px */
  --space-xl: 2rem;
  /* 32px */
  --space-2xl: 4rem;
  /* 64px - Increased */
  --space-3xl: 6rem;
  /* 96px - Increased */
  --space-4xl: 10rem;
  /* 160px - Increased */

  /* Layout */
  --container-max-width: 1280px;
  --container-padding: var(--space-lg);

  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;

  --border-width: 1px;
  --border-width-thick: 2px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;

  /* Z-index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ============================================
   GLOBAL RESET & BASE STYLES
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family-secondary);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-md);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

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

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

h3 {
  font-size: var(--font-size-xl);
}

h4 {
  font-size: var(--font-size-lg);
}

h5 {
  font-size: var(--font-size-md);
}

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

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

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

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

a:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

strong,
b {
  font-weight: var(--font-weight-bold);
}

em,
i {
  font-style: italic;
}

/* Lists */
ul,
ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-xl);
}

li {
  margin-bottom: var(--space-sm);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  text-align: center;
  text-decoration: none;
  border: var(--border-width-thick) solid transparent;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

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

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

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--color-text-inverse);
}

.btn-secondary {
  background-color: var(--color-primary);
  color: var(--color-text-inverse) !important;
  border-color: var(--color-primary);
  text-shadow: none;
}

.btn-secondary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--color-text-inverse) !important;
}

.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn-warning {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.btn-warning:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.btn-large {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-md);
}

.btn-small {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-size-sm);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.required::after {
  content: " *";
  color: var(--color-error);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius-sm);
  transition: border-color var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 90, 140, 0.1);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--color-error);
}

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

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

.form-help {
  display: block;
  margin-top: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.form-error {
  display: block;
  margin-top: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--color-error);
}

/* Checkboxes and Radio Buttons */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin-right: var(--space-sm);
}

.checkbox-group,
.radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.checkbox-label,
.radio-label {
  display: flex;
  align-items: center;
  font-weight: var(--font-weight-normal);
  cursor: pointer;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background-color: var(--color-bg-primary);
  border: var(--border-width) solid var(--color-border-light);
  border-radius: var(--border-radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Premium Standardized Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: white;
  padding: var(--space-2xl) var(--space-xl);
  border-radius: var(--border-radius-lg);
  margin-bottom: var(--space-xl);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="rgba(255,255,255,0.1)"/><stop offset="100%" stop-color="rgba(255,255,255,0)"/></linearGradient></defs><rect width="100" height="100" fill="url(%23grad)"/></svg>');
  background-size: cover;
  opacity: 0.3;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-content h1 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-sm);
  color: white;
}

.hero-content p {
  font-size: var(--font-size-md);
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.9);
}

/* Standardized Content Card */
.content-card,
.standard-card {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
}

.standard-card.hoverable:hover {
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transform: translateY(-2px);
  transition: all var(--transition-base);
}

/* Title Hierarchy Utilities */
.page-title,
h1 {
  font-size: var(--font-size-2xl);
  /* 32px */
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  line-height: 1.2;
}

.section-header,
h2 {
  font-size: var(--font-size-xl);
  /* 24px */
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  line-height: 1.3;
}

.card-title,
h3 {
  font-size: var(--font-size-lg);
  /* 18px */
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  line-height: 1.4;
}

.card-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: var(--border-width) solid var(--color-border-light);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-xs);
}

.card-body {
  margin-bottom: var(--space-md);
}

.card-footer {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: var(--border-width) solid var(--color-border-light);
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */

.alert {
  padding: var(--space-md);
  border-radius: var(--border-radius-md);
  border-left: 4px solid;
  margin-bottom: var(--space-lg);
}

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

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

/* Ensure black text on gold/yellow backgrounds for accessibility (WCAG AA) */
.bg-yellow,
.bg-warning,
.badge-warning,
.btn-yellow,
.button-yellow,
button.yellow,
[class*="yellow-btn"],
[class*="warning-btn"] {
  color: #000000 !important;
  text-shadow: none;
}

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

.alert-info {
  background-color: var(--color-info-light);
  border-color: var(--color-info);
  color: var(--color-text-primary);
}

/* Alert icons - not relying on color alone */
.alert::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: var(--space-sm);
  vertical-align: middle;
}

/* ============================================
   BADGES & TAGS
   ============================================ */

.badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  border-radius: var(--border-radius-sm);
}

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

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

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

.badge-warning {
  background-color: var(--color-warning);
  color: #000000;
}

/* ============================================
   PROGRESS INDICATORS
   ============================================ */

.progress-bar {
  width: 100%;
  height: 24px;
  background-color: var(--color-bg-tertiary);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--color-primary);
  transition: width var(--transition-slow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-inverse);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

/* ============================================
   TABLES
   ============================================ */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-lg);
}

th,
td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: var(--border-width) solid var(--color-border-light);
}

th {
  font-weight: var(--font-weight-bold);
  background-color: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

tr:hover {
  background-color: var(--color-bg-secondary);
}

/* ============================================
   ACCESSIBILITY UTILITIES
   ============================================ */

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

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-sm) var(--space-md);
  text-decoration: none;
  z-index: var(--z-tooltip);
}

.skip-link:focus {
  top: 0;
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.container {
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

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

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-bold {
  font-weight: var(--font-weight-bold);
}

.mb-0 {
  margin-bottom: 0;
}

.mb-sm {
  margin-bottom: var(--space-sm);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.mb-xl {
  margin-bottom: var(--space-xl);
}

.mt-0 {
  margin-top: 0;
}

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mt-xl {
  margin-top: var(--space-xl);
}

.hidden {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}