/**
 * CITADEL - In Astra Dashboard
 * Styles principaux selon la charte graphique
 */

/* =============================================
   VARIABLES CSS
   ============================================= */
:root {
    /* Couleurs primaires */
    --primary-purple: #7C3AED;
    --primary-purple-dark: #6D28D9;
    --primary-purple-light: #A78BFA;
    --primary-blue: #3B82F6;
    --primary-pink: #EC4899;
    
    /* Alias pour compatibilité */
    --primary: #7C3AED;
    --primary-light: rgba(124, 58, 237, 0.1);
    --gradient: linear-gradient(135deg, #EC4899 0%, #8B5CF6 50%, #3B82F6 100%);
    
    /* Couleurs de fond */
    --bg-main: #FFFFFF;
    --bg-subtle: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-white: #FFFFFF;
    --sidebar-active: #1E1B4B;
    --sidebar-hover: #F3F4F6;
    
    /* Gradient */
    --gradient-primary: linear-gradient(135deg, #EC4899 0%, #8B5CF6 50%, #3B82F6 100%);
    --gradient-purple: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
    
    /* Couleurs sémantiques */
    --success: #10B981;
    --success-bg: #D1FAE5;
    --warning: #F59E0B;
    --warning-bg: #FEF3C7;
    --danger: #EF4444;
    --danger-bg: #FEE2E2;
    --danger-text: #DC2626;
    --info: #3B82F6;
    --info-bg: #DBEAFE;
    
    /* Couleurs de texte */
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --text-on-dark: #FFFFFF;
    
    /* Couleurs de bordure */
    --border-default: #E5E7EB;
    --border-color: #E5E7EB;
    --border-focus: #7C3AED;
    --border-subtle: #F3F4F6;
    
    /* Espacements */
    --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;
    
    /* Rayons de bordure */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 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-card: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    
    /* Dimensions */
    --sidebar-width: 260px;
    --header-height: 64px;
    
    /* Transitions */
    --transition-fast: all 150ms ease-in-out;
    --transition-normal: all 200ms ease-in-out;
    --transition-slow: all 300ms ease-in-out;
}

/* Mode sombre */
[data-theme="dark"] {
    --bg-main: #0F172A;
    --bg-subtle: #1E293B;
    --bg-card: #1E293B;
    --bg-white: #1E293B;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border-default: #334155;
    --border-color: #334155;
    --border-subtle: #1E293B;
    --sidebar-hover: #334155;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-subtle);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    color: var(--primary-purple-dark);
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    font-family: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* =============================================
   TYPOGRAPHIE
   ============================================= */
h1, .h1 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h2, .h2 {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h3, .h3 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}

.text-lg {
    font-size: 16px;
}

.text-sm {
    font-size: 13px;
}

.text-xs {
    font-size: 12px;
}

.text-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

/* =============================================
   LAYOUT - PAGE DE LOGIN
   ============================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    padding: var(--space-6);
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-10);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-logo img {
    height: 48px;
    margin-bottom: var(--space-4);
}

.login-logo h1 {
    font-size: 24px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-secondary);
    margin-top: var(--space-2);
}

/* =============================================
   LAYOUT - DASHBOARD
   ============================================= */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition-normal);
}

.sidebar-header {
    padding: var(--space-6) var(--space-4);
    border-bottom: 1px solid var(--border-default);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-logo img {
    height: 32px;
}

.sidebar-logo span {
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-fast);
    margin-bottom: var(--space-1);
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--text-on-dark);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-default);
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-search {
    position: relative;
    width: 320px;
}

.header-search input {
    width: 100%;
    height: 40px;
    padding: 0 var(--space-4) 0 var(--space-10);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    transition: var(--transition-fast);
}

.header-search input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    background: var(--bg-card);
}

.header-search svg {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: var(--transition-fast);
    position: relative;
}

.header-icon-btn:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.header-icon-btn .badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-menu-trigger:hover {
    background: var(--sidebar-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full);
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
    display: none;
    z-index: 100;
}

.user-dropdown.show {
    display: block;
    animation: fadeIn 0.15s ease;
}

.user-dropdown a,
.user-dropdown button {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3);
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    text-align: left;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.user-dropdown .divider {
    height: 1px;
    background: var(--border-default);
    margin: var(--space-2) 0;
}

/* Page content */
.page-content {
    flex: 1;
    padding: var(--space-6);
}

.page-header {
    margin-bottom: var(--space-6);
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.page-subtitle {
    color: var(--text-secondary);
}

/* =============================================
   COMPOSANTS - CARTES
   ============================================= */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: var(--space-6);
    transition: var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* =============================================
   COMPOSANTS - BOUTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary-purple);
    color: var(--text-on-dark);
}

.btn-primary:hover {
    background: var(--primary-purple-dark);
    filter: brightness(1.1);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-subtle);
}

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

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

.btn-danger {
    background: var(--danger);
    color: var(--text-on-dark);
}

.btn-danger:hover {
    background: var(--danger-text);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

/* =============================================
   COMPOSANTS - FORMULAIRES
   ============================================= */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

/* Styles pour tous les inputs, textarea, select dans les formulaires */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="tel"],
.form-group input[type="search"],
.form-group input[type="date"],
.form-group textarea,
.form-group select,
.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="password"],
.modal-content input[type="number"],
.modal-content input[type="url"],
.modal-content textarea,
.modal-content select,
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.15s ease;
}

.form-group textarea,
.modal-content textarea,
.form-textarea {
    height: auto;
    min-height: 100px;
    padding: 12px;
    resize: vertical;
}

.form-group select,
.modal-content select,
.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus,
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.modal-content input::placeholder,
.modal-content textarea::placeholder {
    color: var(--text-muted);
}

/* Form row pour éléments côte à côte */
.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: var(--space-1);
}

/* =============================================
   COMPOSANTS - BADGES & PILLS
   ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge-purple {
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary-purple);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.pill:hover {
    border-color: var(--primary-purple);
    color: var(--primary-purple);
}

.pill.active {
    background: var(--sidebar-active);
    border-color: var(--sidebar-active);
    color: var(--text-on-dark);
}

.pill .count {
    background: var(--bg-subtle);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
}

.pill.active .count {
    background: rgba(255, 255, 255, 0.2);
}

/* =============================================
   COMPOSANTS - GRILLES
   ============================================= */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* =============================================
   WIDGETS - KPI COUNTERS
   ============================================= */
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    box-shadow: var(--shadow-card);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.kpi-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

.kpi-trend {
    font-size: 12px;
    font-weight: 500;
    margin-top: var(--space-2);
}

.kpi-trend.up {
    color: var(--success);
}

.kpi-trend.down {
    color: var(--danger);
}

/* =============================================
   WIDGETS - QUOTE
   ============================================= */
.quote-card {
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    color: white;
    position: relative;
    overflow: hidden;
}

.quote-card::before {
    content: '"';
    position: absolute;
    top: -20px;
    left: 20px;
    font-size: 120px;
    font-family: Georgia, serif;
    opacity: 0.2;
}

.quote-content {
    position: relative;
    z-index: 1;
}

.quote-text {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: var(--space-4);
}

.quote-author {
    font-size: 14px;
    opacity: 0.9;
}

/* =============================================
   WIDGETS - ANNONCES
   ============================================= */
.announcement-item {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--info);
    background: var(--bg-subtle);
    margin-bottom: var(--space-3);
    transition: var(--transition-fast);
}

.announcement-item:hover {
    background: var(--border-subtle);
}

.announcement-item.important {
    border-left-color: var(--warning);
}

.announcement-item.urgent {
    border-left-color: var(--danger);
    background: var(--danger-bg);
}

.announcement-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.announcement-title {
    font-weight: 600;
    color: var(--text-primary);
}

.announcement-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.announcement-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.announcement-pinned {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 11px;
    color: var(--primary-purple);
    font-weight: 500;
}

/* =============================================
   WIDGETS - OUTILS
   ============================================= */
.tool-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-default);
    transition: var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

.tool-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-purple);
    transform: translateY(-2px);
}

.tool-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tool-icon svg,
.tool-icon img {
    width: 24px;
    height: 24px;
    color: white;
}

.tool-info {
    flex: 1;
    min-width: 0;
}

.tool-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.tool-description {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* =============================================
   WIDGETS - TABLEAU
   ============================================= */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-default);
}

.table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-subtle);
}

.table td {
    font-size: 14px;
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-subtle);
}

/* =============================================
   WIDGETS - WIKI
   ============================================= */
.wiki-nav {
    border-right: 1px solid var(--border-default);
    padding-right: var(--space-4);
}

.wiki-nav-item {
    display: block;
    padding: var(--space-2) var(--space-3);
    color: var(--text-secondary);
    font-size: 14px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-1);
    transition: var(--transition-fast);
}

.wiki-nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.wiki-nav-item.active {
    background: var(--primary-purple);
    color: white;
}

.wiki-nav-item.child {
    margin-left: var(--space-4);
    font-size: 13px;
}

.wiki-content {
    max-width: 800px;
}

.wiki-content h1 {
    margin-bottom: var(--space-6);
}

.wiki-content h2 {
    margin-top: var(--space-8);
    margin-bottom: var(--space-4);
}

.wiki-content h3 {
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
}

.wiki-content p {
    margin-bottom: var(--space-4);
    line-height: 1.7;
}

.wiki-content ul,
.wiki-content ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
}

.wiki-content li {
    margin-bottom: var(--space-2);
}

.wiki-content code {
    background: var(--bg-subtle);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'Fira Code', monospace;
    font-size: 13px;
}

.wiki-content a {
    color: var(--primary-purple);
    text-decoration: underline;
}

/* =============================================
   WHITEBOARD
   ============================================= */
.whiteboard-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: var(--bg-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-default);
}

.whiteboard-canvas {
    width: 100%;
    height: 100%;
    position: relative;
}

.sticky-note {
    position: absolute;
    min-width: 180px;
    min-height: 120px;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    cursor: move;
    user-select: none;
    font-size: 14px;
    line-height: 1.4;
}

.sticky-note:hover {
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.sticky-note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.sticky-note-author {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.7;
}

.sticky-note-actions {
    display: flex;
    gap: var(--space-1);
}

.sticky-note-actions button {
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: rgba(0,0,0,0.1);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticky-note-content {
    outline: none;
}

.whiteboard-toolbar {
    position: absolute;
    bottom: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4);
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: var(--space-2);
}

.color-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
}

.color-btn:hover,
.color-btn.active {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

/* =============================================
   BIBLIOTHÈQUE
   ============================================= */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
}

.file-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    text-align: center;
    transition: var(--transition-fast);
    cursor: pointer;
}

.file-card:hover {
    border-color: var(--primary-purple);
    box-shadow: var(--shadow-md);
}

.file-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-3);
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-purple);
}

.file-icon svg {
    width: 28px;
    height: 28px;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.folder-card {
    background: var(--bg-subtle);
    border: 1px dashed var(--border-default);
}

.folder-card .file-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

/* =============================================
   MODALES
   ============================================= */

/* Container principal de la modale */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

/* Fond semi-transparent (overlay interne) */
.modal > .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Contenu de la modale (boîte blanche) */
.modal > .modal-content,
.modal-content {
    position: relative;
    z-index: 2;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(-20px);
    transition: all 0.2s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal.show > .modal-content,
.modal.show .modal-content {
    transform: scale(1) translateY(0);
}

/* Tailles de modale */
.modal-content.modal-sm { max-width: 400px; }
.modal-content.modal-lg { max-width: 650px; }
.modal-content.modal-xl { max-width: 900px; }

/* Header de la modale */
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
}

.modal-header h2,
.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

/* Bouton fermer */
.modal-close,
.modal-header .btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.modal-close:hover,
.modal-header .btn-icon:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

/* Body de la modale */
.modal-body,
.modal-content > form {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-content > form .form-group {
    margin-bottom: 16px;
}

/* Footer de la modale */
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-default);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-subtle);
}

/* Support pour modal-overlay comme container principal (structure alternative) */
div.modal-overlay:not(.modal > .modal-overlay) {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

div.modal-overlay:not(.modal > .modal-overlay).show {
    opacity: 1;
    visibility: visible;
}

div.modal-overlay:not(.modal > .modal-overlay) > .modal {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: all 0.2s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    opacity: 1;
    visibility: visible;
}

div.modal-overlay:not(.modal > .modal-overlay).show > .modal {
    transform: scale(1);
}

/* =============================================
   TOASTS / NOTIFICATIONS
   ============================================= */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

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

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

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

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

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

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

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

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
}

.toast-close:hover {
    background: var(--sidebar-hover);
}

/* =============================================
   UTILITAIRES
   ============================================= */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

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

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

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

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

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

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

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

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-default);
    border-top-color: var(--primary-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        padding: 0 var(--space-4);
    }
    
    .header-search {
        width: 200px;
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .header-search {
        display: none;
    }
    
    .user-info {
        display: none;
    }
    
    .page-content {
        padding: var(--space-4);
    }
    
    .modal {
        margin: var(--space-4);
        max-width: calc(100% - 32px);
    }
}

/* =============================================
   IMPRESSION
   ============================================= */
@media print {
    .sidebar,
    .header,
    .btn,
    .toast-container {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
