/* ============================================
   SYSTÈME 90 - PREMIUM DESIGN SYSTEM v4.2
   Design cohérent, moderne et accessible
   ============================================ */

/* ============================================
   1. VARIABLES CSS - Design Tokens
   ============================================ */
:root {
  /* Palette de couleurs principale */
  --color-noir: #0A0A0A;
  --color-or: #D4AF37;
  --color-or-hover: #C19B2F;
  --color-or-light: #E5C45F;
  --color-creme: #F5F5F0;
  --color-gris: #888888;
  --color-gris-clair: #B8B8B8;
  --color-gris-fonce: #444444;
  
  /* Couleurs de fond */
  --bg-primary: #0A0A0A;
  --bg-secondary: #1A1A1A;
  --bg-tertiary: #2A2A2A;
  --bg-card: #1A1A1A;
  --bg-hover: #2A2A2A;
  --bg-input: rgba(255, 255, 255, 0.03);
  
  /* Couleurs de statut */
  --color-success: #4CAF50;
  --color-success-light: rgba(76, 175, 80, 0.1);
  --color-warning: #FF9800;
  --color-warning-light: rgba(255, 152, 0, 0.1);
  --color-danger: #F44336;
  --color-danger-light: rgba(244, 67, 54, 0.1);
  --color-info: #2196F3;
  --color-info-light: rgba(33, 150, 243, 0.1);
  
  /* Typographie */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  
  /* Tailles de police */
  --font-xs: 0.75rem;      /* 12px */
  --font-sm: 0.875rem;     /* 14px */
  --font-base: 1rem;       /* 16px */
  --font-lg: 1.125rem;     /* 18px */
  --font-xl: 1.25rem;      /* 20px */
  --font-2xl: 1.5rem;      /* 24px */
  --font-3xl: 1.875rem;    /* 30px */
  --font-4xl: 2.25rem;     /* 36px */
  
  /* Espacement */
  --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: 3rem;       /* 48px */
  --space-3xl: 4rem;       /* 64px */
  
  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
  --shadow-or: 0 4px 12px rgba(212, 175, 55, 0.2);
  --shadow-or-lg: 0 10px 30px rgba(212, 175, 55, 0.3);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  
  /* Breakpoints (pour référence) */
  --breakpoint-mobile: 480px;
  --breakpoint-tablet: 768px;
  --breakpoint-desktop: 1024px;
  --breakpoint-wide: 1280px;
}

/* ============================================
   2. RESET & BASE STYLES
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-regular);
  font-size: var(--font-base);
  line-height: 1.6;
  color: var(--color-creme);
  background: var(--bg-primary);
  overflow-x: hidden;
}

/* ============================================
   3. TYPOGRAPHIE - Hiérarchie claire
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  color: var(--color-creme);
}

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

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

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

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

/* ============================================
   4. BOUTONS - Styles cohérents
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  font-size: var(--font-base);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

/* Bouton primaire (Or) */
.btn-primary,
.btn-gold {
  background: var(--color-or);
  color: var(--color-noir);
  box-shadow: var(--shadow-or);
}

.btn-primary:hover,
.btn-gold:hover {
  background: var(--color-or-hover);
  box-shadow: var(--shadow-or-lg);
  transform: translateY(-1px);
}

.btn-primary:active,
.btn-gold:active {
  transform: translateY(0);
}

/* Bouton secondaire */
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--color-creme);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--color-or);
}

/* Bouton outline */
.btn-outline {
  background: transparent;
  color: var(--color-or);
  border: 1px solid var(--color-or);
}

.btn-outline:hover {
  background: var(--color-or);
  color: var(--color-noir);
}

/* Bouton ghost */
.btn-ghost {
  background: transparent;
  color: var(--color-creme);
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
}

/* Bouton danger */
.btn-danger {
  background: var(--color-danger);
  color: white;
}

.btn-danger:hover {
  background: #D32F2F;
}

/* Tailles de boutons */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--font-sm);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: var(--font-lg);
}

/* Bouton icône uniquement */
.btn-icon {
  padding: 0.75rem;
  width: auto;
  height: auto;
  aspect-ratio: 1;
}

/* Bouton pleine largeur */
.btn-block {
  width: 100%;
}

/* ============================================
   5. CARDS - Conteneurs cohérents
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

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

.card-title {
  font-size: var(--font-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-creme);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-title i {
  color: var(--color-or);
}

.card-body {
  color: var(--color-gris-clair);
}

/* Variantes de cards */
.card-flat {
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

/* ============================================
   6. FORMULAIRES - Inputs cohérents
   ============================================ */
.form-group {
  margin-bottom: var(--space-lg);
}

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

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: var(--font-base);
  font-family: var(--font-primary);
  color: var(--color-creme);
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-or);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
  background: var(--bg-secondary);
}

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

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

/* Input avec icône */
.form-input-icon {
  position: relative;
}

.form-input-icon i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-gris);
  pointer-events: none;
}

.form-input-icon .form-input {
  padding-left: 3rem;
}

/* Messages de validation */
.form-error {
  margin-top: var(--space-sm);
  font-size: var(--font-sm);
  color: var(--color-danger);
}

.form-success {
  margin-top: var(--space-sm);
  font-size: var(--font-sm);
  color: var(--color-success);
}

.form-help {
  margin-top: var(--space-sm);
  font-size: var(--font-sm);
  color: var(--color-gris);
}

/* ============================================
   7. BADGES & PILLS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: var(--font-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-primary {
  background: rgba(212, 175, 55, 0.2);
  color: var(--color-or);
  border: 1px solid var(--color-or);
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.badge-warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
  border: 1px solid var(--color-warning);
}

.badge-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.badge-info {
  background: var(--color-info-light);
  color: var(--color-info);
  border: 1px solid var(--color-info);
}

/* ============================================
   8. LOADING STATES - Skeleton & Spinners
   ============================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  gap: var(--space-md);
  color: var(--color-gris);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-or);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

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

/* Skeleton screens */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

.skeleton-text {
  height: 1rem;
  margin-bottom: var(--space-sm);
}

.skeleton-title {
  height: 2rem;
  margin-bottom: var(--space-lg);
}

.skeleton-card {
  height: 200px;
}

/* ============================================
   9. TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-tooltip);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: toast-slide-in 0.3s ease-out;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

.toast-error {
  border-left: 4px solid var(--color-danger);
}

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

.toast-info {
  border-left: 4px solid var(--color-info);
}

.toast-icon {
  flex-shrink: 0;
  font-size: var(--font-xl);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: var(--font-sm);
  color: var(--color-gris-clair);
}

.toast-close {
  background: none;
  border: none;
  color: var(--color-gris);
  cursor: pointer;
  padding: 0.25rem;
  font-size: var(--font-lg);
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--color-creme);
}

/* ============================================
   10. MODALS
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-modal);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  animation: modal-slide-up 0.3s ease-out;
}

@keyframes modal-slide-up {
  from {
    opacity: 0;
    transform: translate(-50%, -40%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xl);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
  font-size: var(--font-2xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-creme);
}

.modal-close {
  background: none;
  border: none;
  color: var(--color-gris);
  font-size: var(--font-2xl);
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--color-creme);
}

.modal-body {
  padding: var(--space-xl);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-xl);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   10.5. SEARCH MODAL - Recherche globale
   ============================================ */
.search-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  animation: fade-in 0.3s ease-out;
}

.search-modal-content {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.search-header {
  padding: var(--space-xl) 0;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-card);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: var(--space-md) var(--space-lg);
  transition: border-color var(--transition-base);
}

.search-input-wrapper:focus-within {
  border-color: var(--color-or);
}

.search-icon {
  color: var(--color-or);
  font-size: var(--font-xl);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-creme);
  font-size: var(--font-lg);
  font-family: var(--font-primary);
  outline: none;
}

.search-input::placeholder {
  color: var(--color-gris);
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg) 0;
}

.search-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  text-align: center;
}

.search-section {
  margin-bottom: var(--space-2xl);
}

.search-section-title {
  font-size: var(--font-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-or);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.search-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.search-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--color-or);
  transform: translateX(4px);
}

.search-item-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.1);
  border-radius: var(--radius-lg);
  color: var(--color-or);
  font-size: var(--font-xl);
  flex-shrink: 0;
}

.search-item-content {
  flex: 1;
  min-width: 0;
}

.search-item-title {
  font-size: var(--font-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-creme);
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-item-meta {
  font-size: var(--font-sm);
  color: var(--color-gris);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  text-align: center;
  color: var(--color-gris);
}

.search-empty i {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .search-modal-content {
    padding: var(--space-md);
  }
  
  .search-input {
    font-size: var(--font-base);
  }
  
  .search-item {
    padding: var(--space-sm);
  }
  
  .search-item-icon {
    width: 40px;
    height: 40px;
    font-size: var(--font-lg);
  }
}

/* ============================================
   11. UTILITIES - Classes utilitaires
   ============================================ */

/* Espacement */
.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); }

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

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Grid */
.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); }

/* Texte */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

.text-sm { font-size: var(--font-sm); }
.text-base { font-size: var(--font-base); }
.text-lg { font-size: var(--font-lg); }
.text-xl { font-size: var(--font-xl); }

/* Couleurs */
.text-or { color: var(--color-or); }
.text-creme { color: var(--color-creme); }
.text-gris { color: var(--color-gris); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }

/* État caché */
.hidden { display: none !important; }

/* ============================================
   12. RESPONSIVE - Mobile-First
   ============================================ */

/* Tablette (768px+) */
@media (min-width: 768px) {
  .modal {
    width: 80%;
  }
  
  .grid-cols-md-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-md-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  .toast-container {
    top: var(--space-2xl);
    right: var(--space-2xl);
  }
  
  .grid-cols-lg-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-cols-lg-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Mobile uniquement (< 768px) */
@media (max-width: 767px) {
  .modal {
    width: 95%;
    max-height: 95vh;
  }
  
  .toast-container {
    top: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
  }
  
  .btn-block-mobile {
    width: 100%;
  }
}
