/* ============================================================
   NEXUS — Base CSS Premium
   Reset, typographie, variables, animations, skeleton loaders
   Version corrigée avec accessibilité renforcée
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
    /* Palette principale — Dark mode par défaut */
    --color-bg-primary: #0a0e14;
    --color-bg-secondary: #121820;
    --color-bg-tertiary: #1a2028;
    --color-bg-hover: #222a34;

    /* Surface */
    --color-surface: #151c24;
    --color-surface-hover: #1a222c;
    --color-border: #2a333e;
    --color-border-light: #38424e;

    /* Texte — Amélioration du contraste WCAG */
    --color-text-primary: #e6edf3;
    --color-text-secondary: #b0b9c4;  /* Augmenté pour meilleur contraste */
    --color-text-tertiary: #8b95a1;   /* Augmenté pour meilleur contraste */
    --color-text-disabled: #5a636e;   /* Augmenté pour meilleur contraste */

    /* Couleurs d'état */
    --color-success: #2ea043;
    --color-success-bg: rgba(46, 160, 67, 0.12);
    --color-warning: #d29922;
    --color-warning-bg: rgba(210, 153, 34, 0.12);
    --color-error: #f85149;
    --color-error-bg: rgba(248, 81, 73, 0.12);
    --color-info: #58a6ff;
    --color-info-bg: rgba(88, 166, 255, 0.12);

    /* Accent */
    --color-accent: #00d4aa;
    --color-accent-hover: #00e5b8;
    --color-accent-bg: rgba(0, 212, 170, 0.12);

    /* Typographie */
    --font-family-base: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-family-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;

    /* Espacement */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Rayons */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Ombres */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;

    /* Z-index */
    --z-sidebar: 100;
    --z-header: 90;
    --z-modal: 200;
    --z-notification: 300;
    --z-tooltip: 400;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    min-height: 100vh;
    min-height: 100dvh; /* Support mobile moderne */
    overflow-x: hidden;
}

/* ---------- Sélection ---------- */
::selection {
    background: var(--color-accent-bg);
    color: var(--color-text-primary);
}

/* ---------- Typographie ---------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-sm);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-secondary);
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

/* ---------- Code ---------- */
code {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    background-color: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
}

pre {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    background-color: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    overflow-x: auto;
}

pre code {
    padding: 0;
    background: transparent;
}

/* ---------- Listes ---------- */
ul, ol {
    list-style-position: inside;
    margin-bottom: var(--spacing-sm);
}

li {
    margin-bottom: var(--spacing-xs);
}

/* ---------- Images ---------- */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ---------- Formulaires ---------- */
input,
button,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

/* Focus accessible — uniquement au clavier */
input:focus,
textarea:focus,
select:focus {
    outline: none;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ---------- Accessibilité ---------- */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.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;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-light);
}

/* ========================================================================
   ANIMATIONS
   ======================================================================== */

/* Fade In */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Slide In Up */
@keyframes slideInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Slide In Right */
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* Pulse */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Skeleton Loading */
@keyframes skeletonShimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}

/* Spin */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Classes d'animation ---------- */
.fade-in {
    animation: fadeIn var(--transition-base) ease;
}

.slide-in-up {
    animation: slideInUp var(--transition-base) ease;
}

.slide-in-right {
    animation: slideInRight var(--transition-base) ease;
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================================================
   SKELETON LOADERS
   ======================================================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 25%,
        var(--color-bg-hover) 50%,
        var(--color-bg-tertiary) 75%
    );
    background-size: 200px 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 60%; }
.skeleton-text.long { width: 80%; }

.skeleton-title {
    height: 20px;
    width: 50%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 100px;
    border-radius: var(--radius-lg);
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-button {
    height: 32px;
    width: 100px;
    border-radius: var(--radius-md);
}

/* ========================================================================
   TRANSITIONS DE PAGE
   ======================================================================== */

.page-transition-enter {
    animation: fadeIn var(--transition-base) ease, slideInUp var(--transition-base) ease;
}

.page-transition-exit {
    animation: fadeIn var(--transition-fast) ease reverse;
}

/* ========================================================================
   REDUCED MOTION
   ======================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .skeleton {
        animation: none !important;
        background: var(--color-bg-tertiary);
    }
}

/* ========================================================================
   ICÔNES ET SVG — Sans !important
   ======================================================================== */

.nav-item-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.header-button svg {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;
}

.sidebar-brand-logo {
    width: 24px;
    height: 24px;
    display: block;
    flex-shrink: 0;
}

/* ========================================================================
   NOTIFICATIONS — Utilisation des variables CSS
   ======================================================================== */

.notification-success {
    border-left-color: var(--color-success);
}

.notification-info {
    border-left-color: var(--color-info);
}

.notification-warning {
    border-left-color: var(--color-warning);
}

.notification-error,
.notification-security {
    border-left-color: var(--color-error);
}

/* Icônes de notification */
.notification-success .notification-icon {
    color: var(--color-success);
}

.notification-info .notification-icon {
    color: var(--color-info);
}

.notification-warning .notification-icon {
    color: var(--color-warning);
}

.notification-error .notification-icon,
.notification-security .notification-icon {
    color: var(--color-error);
}

/* ========================================================================
   RESPONSIVE — Hauteur viewport mobile
   ======================================================================== */

@media (max-width: 768px) {
    body {
        min-height: 100vh;
        min-height: 100dvh;
    }
}

/* ========================================================================
   IMPRESSION
   ======================================================================== */

@media print {
    body {
        background: white;
        color: black;
    }
    
    .sidebar,
    .header,
    .notification-container {
        display: none !important;
    }
}

