/* 
  PWD Digital Management and Empowerment System - Core CSS Stylesheet
  Includes Themes (Light, Dark, High-Contrast) and Accessible Text Scales
*/

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

:root {
  /* Font Family Variables */
  --font-display: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Default Font Sizes (Adjusted dynamically via body classes) */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.25rem;
  --fs-4xl: 3rem;

  /* Spacing Variables */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  /* Light Theme (Default) Palette - Steron Brand Logo Colors */
  --primary-hsl: 142, 72%, 29%;
  --primary: #166534; /* Rich Emerald Green */
  --primary-hover: #15803d;
  --primary-light: #f0fdf4;
  --secondary: #d97706; /* Steron Logo Warm Gold */
  --secondary-hover: #b45309;
  --accent-blue: #0284c7; /* Steron Logo Ocean Blue */
  --accent-blue-hover: #0369a1;
  
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-sidebar: #0f172a;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #ffffff;
  
  --border-color: #e2e8f0;
  --focus-ring: rgba(22, 101, 52, 0.4);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.12);
  
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme overrides */
body.dark-mode {
  --bg-app: #090d16;
  --bg-card: #131b2e;
  --bg-input: #1e293b;
  --bg-sidebar: #0b1120;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --border-color: #2e3c54;
  --focus-ring: rgba(34, 197, 94, 0.6);
  --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.6);
  
  --primary-light: rgba(22, 101, 52, 0.2);
}

/* High Contrast Theme overrides */
body.high-contrast {
  --primary: #ffff00; /* Bright yellow */
  --primary-hover: #ffffff;
  --primary-light: #111111;
  --secondary: #00ffff; /* Cyan */
  --secondary-hover: #ffffff;
  
  --bg-app: #000000;
  --bg-card: #000000;
  --bg-input: #111111;
  --bg-sidebar: #000000;
  
  --text-main: #ffffff;
  --text-muted: #ffff00;
  --text-light: #ffffff;
  
  --border-color: #ffffff;
  --focus-ring: #00ffff;
  --shadow-md: none;
  --shadow-lg: none;
  
  border: 1px solid #ffffff;
}

/* Text Scales classes */
body.text-lg {
  --fs-xs: 0.9rem;
  --fs-sm: 1rem;
  --fs-base: 1.15rem;
  --fs-md: 1.25rem;
  --fs-lg: 1.4rem;
  --fs-xl: 1.65rem;
  --fs-2xl: 2.1rem;
  --fs-3xl: 2.5rem;
  --fs-4xl: 3.3rem;
}

body.text-xl {
  --fs-xs: 1.1rem;
  --fs-sm: 1.25rem;
  --fs-base: 1.4rem;
  --fs-md: 1.55rem;
  --fs-lg: 1.7rem;
  --fs-xl: 2rem;
  --fs-2xl: 2.5rem;
  --fs-3xl: 3rem;
  --fs-4xl: 3.8rem;
}

/* Base resets & styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  background-color: var(--bg-app);
  color: var(--text-main);
  transition: var(--transition-smooth);
  min-height: 100vh;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: var(--space-3);
}

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

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

/* Accessible focus outlines for screen reader users and keyboard navigators */
*:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* UI Layout Components */
.page-container {
  display: flex;
  min-height: 100vh;
}

/* Top Accessibility Control Bar */
.accessibility-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-2) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--fs-xs);
  z-index: 100;
}

.accessibility-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.accessibility-btn {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  min-height: 36px;
  min-width: 44px; /* Accessible touch target size minimal limit */
  justify-content: center;
  transition: var(--transition-smooth);
}
.accessibility-btn:hover {
  background: var(--primary);
  color: var(--text-light);
  border-color: var(--primary);
}
.accessibility-btn.active {
  background: var(--primary);
  color: var(--text-light);
  border-color: var(--primary);
}

/* Header & Navigation */
.navbar {
  background: rgba(var(--primary-hsl), 0.05);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-4) var(--space-8);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.brand-logo-img {
  height: 38px;
  max-height: 38px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.navbar-brand .accent {
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: var(--space-6);
  list-style: none;
  align-items: center;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--fs-sm);
  padding: var(--space-2) 0;
  position: relative;
}
.nav-link:hover, .nav-link.active {
  color: var(--primary);
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* Dashboard Layout */
.dashboard-sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  color: var(--text-light);
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  transition: var(--transition-smooth);
}

.dashboard-sidebar .sidebar-header {
  padding-bottom: var(--space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: var(--space-6);
}

.dashboard-sidebar .sidebar-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--text-light);
  text-decoration: none;
}

.dashboard-sidebar .sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
}

.dashboard-sidebar .sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--border-radius-sm);
  color: #94a3b8;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition-smooth);
  font-size: var(--fs-sm);
}

.dashboard-sidebar .sidebar-link:hover, 
.dashboard-sidebar .sidebar-link.active {
  background: var(--primary);
  color: var(--text-light);
}

.dashboard-sidebar .user-profile-badge {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-profile-badge img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}

.user-profile-badge .user-info {
  display: flex;
  flex-direction: column;
}

.user-profile-badge .user-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-light);
}

.user-profile-badge .user-role {
  font-size: var(--fs-xs);
  color: #94a3b8;
  text-transform: capitalize;
}

.dashboard-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 100vh;
}

.dashboard-content {
  padding: var(--space-8);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Dashboard Analytics Grid */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}
.analytics-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.analytics-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

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

.analytics-card .card-title {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.analytics-card .card-value {
  font-size: var(--fs-3xl);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

/* Premium UI Panels (Forms, Tables, Lists) */
.glass-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-8);
  position: relative;
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  box-shadow: var(--shadow-lg);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin-top: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background: var(--bg-card);
}

.custom-table th {
  background: rgba(var(--primary-hsl), 0.03);
  padding: var(--space-4);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text-main);
  border-bottom: 2px solid var(--border-color);
}

.custom-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-color);
  font-size: var(--fs-sm);
  color: var(--text-main);
}

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

.custom-table tr:hover td {
  background: rgba(var(--primary-hsl), 0.01);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
}

.badge-pending {
  background: #fef3c7;
  color: #d97706;
}
body.dark-mode .badge-pending {
  background: rgba(217, 119, 6, 0.2);
  color: #fbbf24;
}

.badge-active, .badge-approved, .badge-allocated, .badge-delivered, .badge-hired, .badge-resolved {
  background: #d1fae5;
  color: #059669;
}
body.dark-mode .badge-active, body.dark-mode .badge-approved, body.dark-mode .badge-allocated, body.dark-mode .badge-delivered, body.dark-mode .badge-hired, body.dark-mode .badge-resolved {
  background: rgba(5, 150, 105, 0.2);
  color: #34d399;
}

.badge-rejected, .badge-suspended {
  background: #fee2e2;
  color: #dc2626;
}
body.dark-mode .badge-rejected, body.dark-mode .badge-suspended {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
  min-height: 48px; /* Accessible click target */
  text-align: center;
}

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

.btn-secondary {
  background: var(--secondary);
  color: var(--text-light);
}
.btn-secondary:hover {
  background: var(--secondary-hover);
  color: var(--text-light);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background: rgba(var(--primary-hsl), 0.05);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: #dc2626;
  color: var(--text-light);
}
.btn-danger:hover {
  background: #b91c1c;
  color: var(--text-light);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: var(--space-6);
}

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

.form-control, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--border-radius-md);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  min-height: 48px; /* Accessible touch input */
  transition: var(--transition-smooth);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}

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

/* Landing Page / Index Page Specifics */
.hero-section {
  padding: var(--space-12) var(--space-8);
  text-align: center;
  background: linear-gradient(135deg, rgba(var(--primary-hsl), 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.hero-section::after {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(var(--primary-hsl), 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-title {
  font-size: var(--fs-4xl);
  font-weight: 800;
  margin-bottom: var(--space-4);
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: var(--fs-lg);
  max-width: 800px;
  margin: 0 auto var(--space-8) auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-8);
  padding: var(--space-12) var(--space-8);
  max-width: 1200px;
  margin: 0 auto;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: var(--space-8);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: var(--transition-smooth);
}
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.feature-icon {
  width: 60px;
  height: 60px;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: var(--fs-xl);
  margin-bottom: var(--space-6);
}

/* Login/Register Wrapper */
.auth-wrapper {
  max-width: 480px;
  width: 100%;
  margin: var(--space-12) auto;
  padding: 0 var(--space-4);
  box-sizing: border-box;
}

/* Multi-step Registration Tab styling */
.register-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: var(--space-6);
}

.register-tab {
  flex: 1;
  text-align: center;
  padding: var(--space-3) 0;
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition-smooth);
}
.register-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Custom Grid Utility */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

/* Skip link for Accessibility */
.skip-link {
  position: absolute;
  top: -60px;
  left: 10px;
  background: var(--secondary);
  color: #ffffff;
  padding: 8px 16px;
  z-index: 10000;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 10px;
}

/* Home Page Slideshow & Hero Carousel */
.hero-slideshow-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: var(--space-6) auto var(--space-8) auto;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #0f172a;
}

.slides-wrapper {
  position: relative;
  min-height: 440px;
}

.slide-item {
  display: none;
  position: relative;
  width: 100%;
  height: 440px;
  animation: fadeInSlide 0.6s ease-in-out;
}

.slide-item.active {
  display: block;
}

@keyframes fadeInSlide {
  from { opacity: 0.4; transform: scale(1.01); }
  to { opacity: 1; transform: scale(1); }
}

.slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.7);
}

.slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-8);
  background: linear-gradient(0deg, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0) 100%);
  color: #ffffff;
}

.slide-title {
  font-size: var(--fs-2xl);
  color: #ffffff;
  margin-bottom: var(--space-2);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.slide-desc {
  font-size: var(--fs-sm);
  color: #e2e8f0;
  max-width: 750px;
  margin-bottom: var(--space-4);
}

/* Slide Navigation Arrows */
.slide-prev, .slide-next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  padding: 12px;
  color: white;
  font-weight: bold;
  font-size: 20px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.3s ease;
  user-select: none;
  z-index: 10;
}

.slide-prev { left: 16px; }
.slide-next { right: 16px; }

.slide-prev:hover, .slide-next:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* Slide Indicator Dots */
.slide-dots {
  position: absolute;
  bottom: 16px;
  right: 24px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.dot {
  cursor: pointer;
  height: 12px;
  width: 12px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  display: inline-block;
  transition: background-color 0.3s ease;
}

.dot.active, .dot:hover {
  background-color: var(--secondary);
  transform: scale(1.2);
}

/* Events & News Grid Display */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-6);
}

.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

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

.event-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #0f172a;
}

.event-card-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.event-card-title {
  font-size: var(--fs-md);
  margin-bottom: var(--space-2);
}

.event-meta {
  font-size: var(--fs-xs);
  color: var(--secondary);
  font-weight: 600;
  margin-bottom: var(--space-3);
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .page-container {
    flex-direction: column;
  }
  .dashboard-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .navbar {
    padding: var(--space-4);
    flex-direction: column;
    gap: var(--space-4);
  }
  .slides-wrapper, .slide-item {
    height: 320px;
  }
  .slide-title {
    font-size: var(--fs-lg);
  }
}

/* Accessible Screen Reader Text Only (Visually Hidden) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
