/* ===== CSS VARIABLES ===== */
:root {
  /* Light Mode Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-accent: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --bg-card: #ffffff;
  --bg-modal: rgba(0, 0, 0, 0.5);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-accent: #6366f1;
  --text-white: #ffffff;
  
  --border-primary: #e2e8f0;
  --border-secondary: #cbd5e1;
  --border-accent: #6366f1;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
}

/* Dark Mode Colors */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-accent: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #9333ea 100%);
  --bg-card: #1e293b;
  --bg-modal: rgba(0, 0, 0, 0.8);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-accent: #818cf8;
  --text-white: #ffffff;
  
  --border-primary: #334155;
  --border-secondary: #475569;
  --border-accent: #818cf8;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
}

body {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-fade-out {
  animation: fadeOut 0.3s ease-out;
}

.animate-modal-in {
  animation: modalIn 0.3s ease-out;
}

.animate-modal-out {
  animation: modalOut 0.3s ease-out;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== HEADER STYLES ===== */
.header {
  background-color: var(--bg-primary);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.header-logo {
  transition: all 0.3s ease-in-out;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-height: 60px;
  width: auto;
}

.header-logo.fade-out {
  opacity: 0;
}

.header-logo.fade-in {
  opacity: 1;
}

.header-container {
  position: relative;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 0.3s ease-in-out;
}

.header-large .header-container {
  height: 120px;
}

.header-large .header-logo {
  max-height: 90px;
}



/* ===== THEME TOGGLE ===== */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 24px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 20px;
  margin-left: 16px;
  width: 64px;
  height: 32px;
}

.theme-toggle:hover {
  border-color: var(--border-accent);
}

.theme-toggle-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  background: var(--bg-accent);
  border-radius: 50%;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 2;
}

.theme-toggle[data-theme="dark"] .theme-toggle-slider {
  transform: translateX(28px);
}

.theme-toggle-option {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  position: absolute;
  top: 0;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.theme-toggle-option:first-child {
  left: 0;
}

.theme-toggle-option:last-child {
  right: 0;
}

/* Show active option */
.theme-toggle[data-theme="light"] .theme-toggle-option:first-child,
.theme-toggle[data-theme="dark"] .theme-toggle-option:last-child {
  opacity: 1;
}

/* ===== FILTER STYLES ===== */
.filter-container {
  background: var(--bg-accent);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-select {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
  width: 100%;
}

.filter-select:focus {
  outline: none;
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-label {
  color: var(--text-white);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.reset-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text-white);
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 600;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.reset-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

/* ===== CARD STYLES ===== */
.card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid var(--border-primary);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--border-accent);
}

/* ===== BUTTON STYLES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--bg-accent);
  color: var(--text-white);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
  background: var(--bg-primary);
  border-color: var(--border-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ===== FLOATING BUTTON ===== */
.floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: var(--bg-accent);
  color: var(--text-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  box-shadow: var(--shadow-xl);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 50;
}

.floating-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.4);
}

/* ===== MODAL STYLES ===== */
.modal-backdrop {
  background: var(--bg-modal);
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-primary);
}

/* ===== FORM STYLES ===== */
.form-input {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 8px;
  display: block;
}

.field-error {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1) !important;
}

.field-valid {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1) !important;
}

/* ===== BADGE STYLES ===== */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-blanc {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.badge-ambre {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.badge-vieux {
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
}

.badge-arrange {
  background: rgba(147, 51, 234, 0.1);
  color: #9333ea;
}

[data-theme="dark"] .badge-blanc {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

[data-theme="dark"] .badge-ambre {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .badge-vieux {
  background: rgba(217, 119, 6, 0.2);
  color: #fb923c;
}

[data-theme="dark"] .badge-arrange {
  background: rgba(147, 51, 234, 0.2);
  color: #a78bfa;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-primary);
  border-top: 2px solid var(--text-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 16px 24px;
  border-radius: 12px;
  color: var(--text-white);
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: 100;
  max-width: 400px;
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--error);
}

.toast-info {
  background: var(--info);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .floating-btn {
    bottom: 20px;
    right: 20px;
    width: 64px;
    height: 64px;
    font-size: 28px;
  }
  
  .filter-container {
    padding: 16px;
    border-radius: 12px;
  }
  
  .header-large .header-container {
    height: 100px;
  }
  
  .header-large .header-logo {
    max-height: 70px;
  }
  
  .modal-content {
    margin: 16px;
    border-radius: 12px;
  }
}

/* ===== DROPDOWN MENU ===== */
.dropdown-menu {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.dropdown-item {
  background: transparent;
  color: var(--text-primary);
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.hidden {
  display: none !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;
}

/* ===== SMOOTH TRANSITIONS ===== */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}