/* ========================================
   UNIFIED DARK THEME DESIGN SYSTEM
   Enterprise-Grade Dark UI for Django Application
======================================== */

:root {
  /* ========================================
     DARK THEME COLOR PALETTE
  ======================================== */
  
  /* Primary Backgrounds */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-surface: #21262d;
  --bg-elevated: #30363d;
  --bg-overlay: #161b22;
  --bg-input: #0d1117;
  --bg-hero: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
  
  /* Text Colors - High Contrast for Accessibility */
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-tertiary: #6e7681;
  --text-muted: #484f58;
  --text-inverse: #24292f;
  
  /* Accent Colors - Professional Blue */
  --accent-primary: #58a6ff;
  --accent-hover: #388bfd;
  --accent-active: #1f6feb;
  --accent-subtle: rgba(88, 166, 255, 0.1);
  --accent-muted: rgba(88, 166, 255, 0.4);
  --accent-emphasis: #1f6feb;
  
  /* Status Colors */
  --success: #3fb950;
  --success-subtle: rgba(63, 185, 80, 0.15);
  --success-muted: rgba(63, 185, 80, 0.4);
  
  --warning: #d29922;
  --warning-subtle: rgba(210, 153, 34, 0.15);
  --warning-muted: rgba(210, 153, 34, 0.4);
  
  --error: #f85149;
  --error-subtle: rgba(248, 81, 73, 0.15);
  --error-muted: rgba(248, 81, 73, 0.4);
  
  --info: #79c0ff;
  --info-subtle: rgba(121, 192, 255, 0.15);
  --info-muted: rgba(121, 192, 255, 0.4);
  
  /* Borders & Dividers */
  --border-default: #30363d;
  --border-muted: #21262d;
  --border-subtle: #484f58;
  --border-emphasis: #6e7681;
  --border-focus: var(--accent-primary);
  --border-success: var(--success);
  --border-warning: var(--warning);
  --border-error: var(--error);
  
  /* Shadows & Glows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 3px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.6);
  --glow-accent: 0 0 0 3px var(--accent-subtle);
  --glow-success: 0 0 0 3px var(--success-subtle);
  --glow-error: 0 0 0 3px var(--error-subtle);
  
  /* ========================================
     SPACING & SIZING SYSTEM
  ======================================== */
  
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  
  /* ========================================
     TYPOGRAPHY SYSTEM
  ======================================== */
  
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;
  --font-size-4xl: 36px;
  --font-size-5xl: 48px;
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  
  /* ========================================
     BORDER RADIUS SYSTEM
  ======================================== */
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* ========================================
     ANIMATION & TRANSITIONS
  ======================================== */
  
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

html {
  font-size: 16px;
  line-height: var(--line-height-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
  min-height: 100vh;
}

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

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--font-size-4xl); font-weight: var(--font-weight-bold); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-4);
}

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

a:hover {
  color: var(--accent-hover);
}

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

/* ========================================
   BUTTON SYSTEM
======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:focus {
  outline: none;
  box-shadow: var(--glow-accent);
}

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

/* Button Variants */
.btn-primary {
  background-color: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-emphasis);
  transform: translateY(-1px);
}

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

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

.btn-danger {
  background-color: var(--error);
  color: white;
  border-color: var(--error);
}

.btn-danger:hover {
  background-color: #dc2626;
  border-color: #dc2626;
  transform: translateY(-1px);
}

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

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

/* ========================================
   FORM COMPONENTS
======================================== */

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

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

.form-control {
  width: 100%;
  padding: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--glow-accent);
}

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

/* ========================================
   CARD SYSTEM
======================================== */

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
  position: relative;
}

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

.card-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-default);
  background-color: var(--bg-elevated);
}

.card-body {
  padding: var(--space-4);
}

.card-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-default);
  background-color: var(--bg-elevated);
}

/* ========================================
   NAVIGATION SYSTEM
======================================== */

.navbar {
  background-color: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 64px;
  transition: all var(--transition-normal);
}

.navbar.scrolled {
  background-color: rgba(13, 17, 23, 0.98);
  box-shadow: var(--shadow-md);
  border-bottom-color: var(--border-emphasis);
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.navbar-brand {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  text-decoration: none;
}

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

.nav-link {
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-decoration: none;
}

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

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

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

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

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

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.flex-column { flex-direction: column; }
.align-items-center { align-items: center; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }

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

.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* ========================================
   ANIMATION KEYFRAMES
======================================== */

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

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

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

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

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

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-3);
  }
  
  .navbar-content {
    padding: 0 var(--space-4);
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .card {
    margin-bottom: var(--space-4);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-2);
  }
  
  .navbar-content {
    padding: 0 var(--space-3);
  }
  
  h1 { font-size: var(--font-size-3xl); }
  h2 { font-size: var(--font-size-2xl); }
  h3 { font-size: var(--font-size-xl); }
}

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

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.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;
}

/* Focus styles for keyboard navigation */
.btn:focus-visible,
.form-control:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}