/**
 * SAS PROUTEAU Space - Styles Ultimate
 * Version: 3.0.0
 * 
 * Architecture CSS professionnelle avec:
 * - Variables CSS personnalisables
 * - Design iOS 17 / macOS Sonoma
 * - Mode sombre complet
 * - Animations fluides 60 FPS
 * - Responsive design
 * - Accessibilité WCAG 2.1 AA
 * - Support impression
 * 
 * @package SASP_Space_Ultimate
 * @since 3.0.0
 */

/* ============================================================================
   SOMMAIRE
   ============================================================================
   1. VARIABLES GLOBALES
   2. RESET & BASE
   3. CONTAINER PRINCIPAL
   4. SIDEBAR NAVIGATION
   5. SYSTÈME DE FENÊTRES
   6. WIDGETS
   7. NOTIFICATIONS
   8. MODALS
   9. FORMULAIRES
   10. ANIMATIONS
   11. UTILITAIRES
   12. RESPONSIVE
   13. THÈME SOMBRE
   14. ACCESSIBILITÉ
   15. IMPRESSION
   ============================================================================ */

/* ============================================================================
   1. VARIABLES GLOBALES
   ============================================================================ */
:root {
  /* === Couleurs principales === */
  --primary-color: #667eea;
  --primary-hover: #5a6fd8;
  --primary-light: #8b9df6;
  --primary-dark: #4f5fbb;
  
  --secondary-color: #10b981;
  --secondary-hover: #059669;
  --secondary-light: #34d399;
  
  --accent-color: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-light: #a78bfa;
  
  /* === Couleurs de feedback === */
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --info-color: #3b82f6;
  
  /* === Couleurs de surface === */
  --background-color: #f8fafc;
  --surface-color: #ffffff;
  --border-color: rgba(0, 0, 0, 0.1);
  --text-color: #1e293b;
  --text-muted: #64748b;
  
  /* === Sidebar === */
  --sidebar-width: 80px;
  --sidebar-expanded-width: 250px;
  --sidebar-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  
  /* === Ombres === */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);
  
  /* === Fenêtres === */
  --window-border-radius: 16px;
  --window-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  --window-blur: blur(20px);
  
  /* === iOS Glass Effect === */
  --ios-glass: rgba(255, 255, 255, 0.8);
  --ios-glass-dark: rgba(30, 30, 30, 0.8);
  --ios-border-light: rgba(255, 255, 255, 0.2);
  --ios-border-dark: rgba(0, 0, 0, 0.2);
  
  /* === Espacements === */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  
  /* === Bordures === */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* === Transitions === */
  --transition-speed: 0.3s;
  --transition-fast: 0.15s;
  --transition-slow: 0.5s;
  
  /* === Courbes d'animation === */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* === Z-index === */
  --z-sidebar: 10000;
  --z-modal: 10002;
  --z-notification: 10003;
  --z-tooltip: 10004;
  --z-window-base: 1000;
  
  /* === Typographie === */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
  
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  
  --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;
}

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

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* ============================================================================
   3. CONTAINER PRINCIPAL
   ============================================================================ */
#sasprouteau-space {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--background-color);
  overflow: hidden;
  z-index: 999;
  font-family: var(--font-sans);
}

.sasp-space-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  position: relative;
}

/* ============================================================================
   4. SIDEBAR NAVIGATION
   ============================================================================ */
.sasprouteau-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: white;
  transition: width var(--transition-speed) var(--ease-smooth);
  z-index: var(--z-sidebar);
  box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.sasprouteau-sidebar:hover {
  width: var(--sidebar-expanded-width);
}

/* Header de la sidebar */
.sidebar-header {
  padding: var(--spacing-lg) var(--spacing-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 80px;
  display: flex;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  opacity: 0;
  transition: opacity var(--transition-speed);
  white-space: nowrap;
}

.sasprouteau-sidebar:hover .logo-container {
  opacity: 1;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: contain;
  flex-shrink: 0;
}

.company-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

/* Recherche dans la sidebar */
.sidebar-search {
  margin: var(--spacing-lg) var(--spacing-md);
  position: relative;
  opacity: 0;
  transition: opacity var(--transition-speed);
}

.sasprouteau-sidebar:hover .sidebar-search {
  opacity: 1;
}

.sidebar-search input {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-xl) var(--spacing-md) var(--spacing-md);
  border: none;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: var(--font-size-sm);
  transition: background var(--transition-fast);
}

.sidebar-search input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.25);
}

.sidebar-search input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.sidebar-search i {
  position: absolute;
  right: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

/* Navigation */
.sidebar-nav {
  margin-top: var(--spacing-xl);
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - 200px);
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.nav-menu {
  list-style: none;
}

.nav-item {
  margin: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-link {
  display: flex;
  align-items: center;
  padding: var(--spacing-md);
  color: white;
  text-decoration: none;
  gap: var(--spacing-md);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.nav-link:hover {
  transform: translateX(2px);
}

.nav-link i {
  font-size: 20px;
  min-width: 30px;
  text-align: center;
  flex-shrink: 0;
}

.nav-text {
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition-speed);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.sasprouteau-sidebar:hover .nav-text {
  opacity: 1;
}

/* Badge de notification sur les items */
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--error-color);
  color: white;
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-speed);
}

.sasprouteau-sidebar:hover .nav-badge {
  opacity: 1;
}

/* ============================================================================
   5. SYSTÈME DE FENÊTRES
   ============================================================================ */
.window {
  position: absolute;
  background: var(--ios-glass);
  backdrop-filter: var(--window-blur);
  -webkit-backdrop-filter: var(--window-blur);
  border-radius: var(--window-border-radius);
  box-shadow: var(--window-shadow),
              0 0 0 1px var(--ios-border-light) inset;
  overflow: hidden;
  resize: both;
  min-width: 300px;
  min-height: 200px;
  max-width: 90vw;
  max-height: 90vh;
  z-index: var(--z-window-base);
  transition: var(--transition-speed) var(--ease-smooth);
  transform-style: preserve-3d;
  perspective: 1000px;
}

/* Animation d'apparition */
@keyframes windowAppear {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(20px) rotateX(-10deg);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0) rotateX(0);
    filter: blur(0);
  }
}

.window {
  animation: windowAppear 0.4s var(--ease-bounce);
}

/* Classes d'état de fenêtre */
.window-opening {
  animation: windowAppear 0.4s var(--ease-bounce);
}

.window-open {
  /* État stable */
}

.window-closing {
  animation: windowDisappear 0.3s var(--ease-smooth) forwards;
}

@keyframes windowDisappear {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0) rotateX(0);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.8) translateY(20px) rotateX(-10deg);
    filter: blur(10px);
  }
}

.window-active {
  z-index: calc(var(--z-window-base) + 100);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.2),
              0 0 0 1px rgba(102, 126, 234, 0.3) inset,
              0 0 30px rgba(102, 126, 234, 0.1);
}

.window-minimized {
  height: 52px !important;
  min-height: 52px;
  transform: translateY(calc(100vh - 100px));
  opacity: 0.7;
}

.window-minimized .window-content {
  display: none;
}

.window-maximized {
  width: calc(100vw - 40px) !important;
  height: calc(100vh - 40px) !important;
  top: 20px !important;
  left: 20px !important;
  border-radius: var(--radius-lg) !important;
  transition: all var(--transition-speed) var(--ease-smooth);
}

/* En-tête de fenêtre */
.window-header {
  position: relative;
  height: 52px;
  padding: 0 var(--spacing-lg);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.7) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  user-select: none;
  transition: all var(--transition-fast);
  z-index: 10;
}

.window-header:hover {
  background: rgba(255, 255, 255, 0.8);
}

.window-header.dragging {
  background: rgba(255, 255, 255, 0.9) !important;
  cursor: grabbing;
}

.window-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-color);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.window-title i {
  color: var(--primary-color);
  font-size: 16px;
}

/* Contrôles de fenêtre (boutons macOS) */
.window-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-shrink: 0;
}

.window-control {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast) var(--ease-smooth);
  position: relative;
  overflow: hidden;
  font-size: 12px;
  color: white;
}

.window-control::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--transition-fast);
  border-radius: 50%;
}

.window-control:hover::before {
  opacity: 0.1;
}

.window-control.close {
  background: #ff5f57;
}

.window-control.close:hover {
  background: #ff3b30;
  transform: scale(1.1);
}

.window-control.minimize {
  background: #ffbd2e;
}

.window-control.minimize:hover {
  background: #ffaa00;
  transform: scale(1.1);
}

.window-control.maximize {
  background: #28ca42;
}

.window-control.maximize:hover {
  background: #00c853;
  transform: scale(1.1);
}

/* Contenu de fenêtre */
.window-content {
  height: calc(100% - 52px);
  overflow: auto;
  background: rgba(255, 255, 255, 0.4);
  position: relative;
  padding: var(--spacing-lg);
}

.window-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.window-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.window-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  transition: background var(--transition-fast);
}

.window-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Loader de fenêtre */
.window-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  min-height: 200px;
  color: var(--text-muted);
}

.window-loader i {
  font-size: 32px;
  animation: spin 1s linear infinite;
}

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

/* Poignées de redimensionnement */
.window-resize-handle {
  position: absolute;
  background: transparent;
  z-index: 100;
}

.window-resize-handle.n {
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  cursor: ns-resize;
}

.window-resize-handle.s {
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  cursor: ns-resize;
}

.window-resize-handle.e {
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: ew-resize;
}

.window-resize-handle.w {
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: ew-resize;
}

.window-resize-handle.ne {
  top: 0;
  right: 0;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
}

.window-resize-handle.nw {
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  cursor: nwse-resize;
}

.window-resize-handle.se {
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  cursor: nwse-resize;
}

.window-resize-handle.sw {
  bottom: 0;
  left: 0;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
}

/* ============================================================================
   6. WIDGETS
   ============================================================================ */
.widgets-container {
  position: absolute;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.widget {
  position: absolute;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--spacing-lg);
  pointer-events: auto;
  transition: all var(--transition-speed) var(--ease-smooth);
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 200px;
  min-height: 150px;
}

.widget:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  cursor: move;
  user-select: none;
}

.widget-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-color);
}

.widget-controls {
  display: flex;
  gap: var(--spacing-xs);
}

.widget-control {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-size: 12px;
}

.widget-control:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-color);
  transform: scale(1.1);
}

.widget-control.remove:hover {
  background: var(--error-color);
  color: white;
}

.widget-content {
  font-size: var(--font-size-sm);
  color: var(--text-color);
}

/* Bouton d'ouverture de la bibliothèque de widgets */
.widget-library-btn {
  position: fixed;
  bottom: var(--spacing-xl);
  right: var(--spacing-xl);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow-xl);
  transition: all var(--transition-speed) var(--ease-smooth);
  z-index: calc(var(--z-sidebar) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget-library-btn:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
  background: var(--primary-hover);
}

/* Modal de bibliothèque de widgets */
.widget-library-modal .modal-content {
  max-width: 900px;
  max-height: 80vh;
}

.widgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
}

.widget-item {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  text-align: center;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.widget-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.widget-item-icon {
  font-size: 32px;
  color: var(--primary-color);
  margin-bottom: var(--spacing-md);
}

.widget-item-info h4 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-color);
  margin-bottom: var(--spacing-xs);
}

.widget-category {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.add-widget-btn {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
}

.widget-item:hover .add-widget-btn {
  opacity: 1;
}

.add-widget-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.1);
}

/* ============================================================================
   7. NOTIFICATIONS
   ============================================================================ */
.notifications-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 350px;
  height: 100%;
  background: white;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  z-index: var(--z-notification);
  transition: right var(--transition-speed) var(--ease-smooth);
  overflow-y: auto;
}

.notifications-panel.open {
  right: 0;
}

.notifications-bell {
  position: relative;
  cursor: pointer;
  color: white;
  font-size: 20px;
  padding: var(--spacing-md);
  transition: all var(--transition-fast);
}

.notifications-bell:hover {
  transform: scale(1.1);
}

.notification-count {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--error-color);
  color: white;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  padding: 0 4px;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: -100px;
  right: var(--spacing-xl);
  min-width: 300px;
  max-width: 500px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  z-index: calc(var(--z-notification) + 1);
  transition: all var(--transition-speed) var(--ease-smooth);
  border-left: 4px solid var(--info-color);
}

.toast.show {
  bottom: var(--spacing-xl);
  animation: slideInUp 0.3s var(--ease-smooth);
}

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

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

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

.toast.toast-error {
  border-left-color: var(--error-color);
}

.toast i {
  font-size: 20px;
  flex-shrink: 0;
}

.toast.toast-success i {
  color: var(--success-color);
}

.toast.toast-warning i {
  color: var(--warning-color);
}

.toast.toast-error i {
  color: var(--error-color);
}

.toast.toast-info i {
  color: var(--info-color);
}

.notification-content {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--text-color);
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.notification-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-color);
}

/* ============================================================================
   8. MODALS
   ============================================================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-speed) var(--ease-smooth);
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2xl);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalAppear 0.3s var(--ease-bounce);
}

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

.modal-header {
  padding: var(--spacing-xl);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-color);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 24px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-color);
}

.modal-body {
  padding: var(--spacing-xl);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--spacing-xl);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ============================================================================
   9. FORMULAIRES
   ============================================================================ */
.sasp-form-group {
  margin-bottom: var(--spacing-lg);
}

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

.sasp-form-input,
.sasp-form-textarea,
.sasp-form-select {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-family: var(--font-sans);
  color: var(--text-color);
  background: white;
  transition: all var(--transition-fast);
}

.sasp-form-input:focus,
.sasp-form-textarea:focus,
.sasp-form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.sasp-button {
  padding: var(--spacing-md) var(--spacing-xl);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  text-decoration: none;
}

.sasp-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.sasp-button:active {
  transform: translateY(0);
}

.sasp-button--primary {
  background: var(--primary-color);
  color: white;
}

.sasp-button--primary:hover {
  background: var(--primary-hover);
}

.sasp-button--secondary {
  background: var(--secondary-color);
  color: white;
}

.sasp-button--secondary:hover {
  background: var(--secondary-hover);
}

.sasp-button--outline {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

.sasp-button--outline:hover {
  background: var(--primary-color);
  color: white;
}

/* ============================================================================
   10. ANIMATIONS
   ============================================================================ */
.fade-in {
  animation: fadeIn 0.5s var(--ease-smooth);
}

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

.slide-in {
  animation: slideIn 0.3s var(--ease-smooth);
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.pulse {
  animation: pulse 2s infinite;
}

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

/* ============================================================================
   11. UTILITAIRES
   ============================================================================ */
.text-center {
  text-align: center;
}

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

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

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-sm {
  gap: var(--spacing-sm);
}

.gap-md {
  gap: var(--spacing-md);
}

.gap-lg {
  gap: var(--spacing-lg);
}

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

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

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

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

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

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

/* ============================================================================
   12. RESPONSIVE
   ============================================================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 60px;
    --sidebar-expanded-width: 200px;
  }
  
  .sasprouteau-sidebar:hover {
    width: var(--sidebar-expanded-width);
  }
  
  .widget {
    min-width: 250px !important;
  }
  
  .window {
    min-width: 300px !important;
    min-height: 200px !important;
  }
  
  .widget-library-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
  
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }
  
  .widgets-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--spacing-md);
  }
}

@media (max-width: 480px) {
  :root {
    --sidebar-width: 0;
    --sidebar-expanded-width: 100%;
  }
  
  .sasprouteau-sidebar {
    transform: translateX(-100%);
  }
  
  .sasprouteau-sidebar:hover,
  .sasprouteau-sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .window-maximized {
    width: 100vw !important;
    height: 100vh !important;
    top: 0 !important;
    left: 0 !important;
    border-radius: 0 !important;
  }
}

/* ============================================================================
   13. THÈME SOMBRE
   ============================================================================ */
[data-theme="dark"] {
  --background-color: #0f172a;
  --surface-color: #1e293b;
  --border-color: rgba(255, 255, 255, 0.1);
  --text-color: #f1f5f9;
  --text-muted: #94a3b8;
}

[data-theme="dark"] .window {
  background: var(--ios-glass-dark);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
              0 0 0 1px var(--ios-border-dark) inset;
}

[data-theme="dark"] .window-header {
  background: linear-gradient(
    180deg,
    rgba(40, 40, 40, 0.9) 0%,
    rgba(30, 30, 30, 0.7) 100%
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .window-header:hover {
  background: rgba(50, 50, 50, 0.9);
}

[data-theme="dark"] .window-content {
  background: rgba(30, 30, 30, 0.4);
}

[data-theme="dark"] .window-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .window-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .widget {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .modal-content,
[data-theme="dark"] .notifications-panel,
[data-theme="dark"] .toast {
  background: var(--surface-color);
  color: var(--text-color);
}

[data-theme="dark"] .sasp-form-input,
[data-theme="dark"] .sasp-form-textarea,
[data-theme="dark"] .sasp-form-select {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

/* ============================================================================
   14. ACCESSIBILITÉ
   ============================================================================ */
.window:focus,
.widget:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.window-control:focus,
.sasp-button:focus,
.modal-close:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Réduire les animations pour les préférences utilisateur */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   15. IMPRESSION
   ============================================================================ */
@media print {
  .sasprouteau-sidebar,
  .widget-library-btn,
  .notifications-bell,
  .notifications-panel,
  .modal-backdrop,
  .window-controls,
  .widget-controls,
  .toast {
    display: none !important;
  }
  
  .window,
  .widget {
    position: static !important;
    box-shadow: none !important;
    background: white !important;
    border: 1px solid #ddd !important;
    page-break-inside: avoid;
    margin: 20px 0;
  }
  
  #sasprouteau-space {
    position: static;
    overflow: visible;
  }
}

/* ============================================================================
   FIN DU FICHIER - SASPROUTEAU SPACE ULTIMATE v3.0.0
   ============================================================================ */