:root {
    /* Palette Moderne */
    --cyan-50: #f0fdfa;
    --cyan-100: #ccfbf1;
    --cyan-500: #14b8a6;
    --cyan-600: #0d9488;
    --cyan-900: #134e4a;
    
    --violet-50: #f5f3ff;
    --violet-100: #ede9fe;
    --violet-400: #a78bfa;
    --violet-500: #8b5cf6;
    --violet-600: #7c3aed;
    --violet-700: #6d28d9;
    --violet-900: #4c1d95;
    
    --rose-500: #f43f5e;
    --rose-600: #e11d48;
    --rose-700: #be123c;
    
    --orange-500: #f97316;

    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    
    /* Thème Clair */
    --bg-primary: var(--slate-50);
    --bg-secondary: white;
    --bg-tertiary: var(--slate-100);
    --text-primary: var(--slate-900);
    --text-secondary: var(--slate-600);
    --text-tertiary: var(--slate-400);
    --border-primary: var(--slate-200);
    
    /* Ombres */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Bords */
    --radius-lg: 0.5rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;
}

[data-theme="dark"] {
    --bg-primary: var(--slate-900);
    --bg-secondary: var(--slate-800);
    --bg-tertiary: var(--slate-700);
    --text-primary: var(--slate-100);
    --text-secondary: var(--slate-300);
    --text-tertiary: var(--slate-400);
    --border-primary: var(--slate-700);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    background-image: radial-gradient(circle at 10% 20%, rgba(203, 213, 225, 0.1) 0%, transparent 20%), radial-gradient(circle at 90% 80%, rgba(165, 180, 252, 0.1) 0%, transparent 20%);
}
[data-theme="dark"] body {
    background-image: radial-gradient(circle at 10% 20%, rgba(51, 65, 85, 0.3) 0%, transparent 20%), radial-gradient(circle at 90% 80%, rgba(124, 58, 237, 0.2) 0%, transparent 20%);
}

.container { max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; }

/* Header */
header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    backdrop-filter: blur(16px);
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-sm);
}
.header-content { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 0; gap: 2rem; }
.logo {
    display: flex; align-items: center; gap: 0.875rem; font-size: 1.75rem; font-weight: 800;
    color: var(--violet-600); text-decoration: none; transition: all 0.3s;
}
[data-theme="dark"] .logo { color: var(--violet-400); }
.logo:hover { transform: translateY(-2px); }
.logo i {
    background: linear-gradient(135deg, var(--cyan-500), var(--violet-500));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.search-bar { flex: 1; max-width: 500px; position: relative; }
.search-bar input {
    width: 100%; padding: 0.875rem 1.25rem 0.875rem 3rem;
    border: 2px solid var(--border-primary); border-radius: var(--radius-full);
    background: var(--bg-secondary); color: var(--text-primary);
    font-size: 1rem; transition: all 0.3s;
}
.search-bar input:focus { outline: none; border-color: var(--violet-400); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2); }
.search-bar::before {
    content: "\f002"; font-family: "Font Awesome 6 Free"; font-weight: 900;
    position: absolute; left: 1.25rem; top: 50%; transform: translateY(-50%);
    color: var(--text-tertiary);
}
.search-results-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-secondary); border: 2px solid var(--border-primary);
    border-top: none; border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
    max-height: 300px; overflow-y: auto; z-index: 1000; display: none;
    box-shadow: var(--shadow-md);
}
.search-result-item { padding: 1rem; border-bottom: 1px solid var(--border-primary); cursor: pointer; }
.search-result-item:hover { background: var(--bg-tertiary); }
.search-result-item:last-child { border-bottom: none; }

/* Buttons */
.nav-buttons { display: flex; gap: 1rem; align-items: center; }
.btn {
    display: inline-flex; align-items: center; gap: 0.625rem; padding: 0.75rem 1.5rem;
    border: none; border-radius: var(--radius-full); font-weight: 500;
    cursor: pointer; transition: all 0.3s; text-decoration: none;
    white-space: nowrap; box-shadow: var(--shadow-sm);
}
.btn-primary { background: linear-gradient(135deg, var(--violet-500), var(--violet-600)); color: white; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: linear-gradient(135deg, var(--violet-600), var(--violet-700)); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-outline { background: transparent; border: 2px solid var(--border-primary); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-tertiary); border-color: var(--text-secondary); }
.btn-danger { background: linear-gradient(135deg, var(--rose-500), var(--rose-600)); color: white; }
.btn-danger:hover { background: linear-gradient(135deg, var(--rose-600), var(--rose-700)); transform: translateY(-2px); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* Layout */
.main-layout { display: grid; grid-template-columns: 320px 1fr; gap: 2rem; padding: 2rem 0; }

/* Sidebar */
.sidebar {
    background: var(--bg-secondary); border-radius: var(--radius-2xl); padding: 1.75rem;
    height: fit-content; border: 1px solid var(--border-primary); position: sticky; top: 110px;
    box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.sidebar::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--cyan-500), var(--violet-500));
}
.sidebar-section { margin-bottom: 2rem; }
.sidebar-section:last-child { margin-bottom: 0; }
.sidebar-title {
    font-size: 1.125rem; font-weight: 700; margin-bottom: 1.25rem;
    color: var(--text-primary); display: flex; align-items: center; gap: 0.75rem;
    padding-bottom: 0.75rem; border-bottom: 2px solid var(--border-primary);
}
.categories-list, .tags-list, .recent-pages-list { list-style: none; }
.categories-list li, .recent-pages-list li { margin-bottom: 0.5rem; }
.categories-list a, .recent-pages-list a {
    display: flex; align-items: center; gap: 0.875rem; padding: 0.75rem;
    color: var(--text-secondary); text-decoration: none; border-radius: var(--radius-lg);
    transition: all 0.3s; font-weight: 500;
}
.categories-list a:hover, .recent-pages-list a:hover {
    background: var(--bg-tertiary); color: var(--violet-600); transform: translateX(6px);
}
[data-theme="dark"] .categories-list a:hover, [data-theme="dark"] .recent-pages-list a:hover {
    color: var(--violet-400);
}
.tag-badge { background: var(--bg-tertiary); padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; margin-left: auto; }
.tags-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags-list a {
    display: inline-flex; background: linear-gradient(135deg, var(--cyan-50), var(--violet-50));
    border-radius: var(--radius-full); padding: 0.375rem 1rem; font-size: 0.875rem;
    font-weight: 500; transition: all 0.3s; border: 1px solid var(--border-primary);
    color: var(--text-secondary); text-decoration: none;
}
[data-theme="dark"] .tags-list a { background: linear-gradient(135deg, var(--cyan-900), var(--violet-900)); }
.tags-list a:hover {
    background: linear-gradient(135deg, var(--cyan-500), var(--violet-500));
    color: white; transform: translateY(-3px) scale(1.05); box-shadow: var(--shadow-md);
}

/* Content Area */
.content-area {
    background: var(--bg-secondary); border-radius: var(--radius-2xl); padding: 2.5rem;
    box-shadow: var(--shadow-md); border: 1px solid var(--border-primary); position: relative;
    overflow: hidden; min-height: 600px;
}
.content-area::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--violet-500), var(--cyan-500));
}
.welcome-message { text-align: center; padding: 4rem 2rem; }
.welcome-message h1 {
    font-size: 3rem; font-weight: 800; margin-bottom: 2.5rem;
    background: linear-gradient(135deg, var(--violet-600), var(--cyan-500));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    line-height: 1.2; position: relative;
}
.welcome-message h1::after {
    content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
    width: 100px; height: 4px; background: linear-gradient(90deg, var(--violet-500), var(--cyan-500));
    border-radius: var(--radius-full);
}
.welcome-message p { font-size: 1.25rem; color: var(--text-secondary); margin-bottom: 2.5rem; max-width: 650px; margin-left: auto; margin-right: auto; line-height: 1.7; }
.welcome-actions { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }

/* Modals */
.modal {
    display: none; /* Changé par JS */
    position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px);
}
.modal.active { display: flex; align-items: center; justify-content: center; animation: fadeIn 0.3s; }
.modal-content {
    background: var(--bg-secondary); border-radius: var(--radius-2xl);
    width: 90%; max-width: 500px; box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-primary); position: relative; overflow: hidden;
    animation: slideIn 0.4s;
}
.modal-content.large { max-width: 800px; }
.modal-header { padding: 1.75rem; border-bottom: 1px solid var(--border-primary); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1.375rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.modal-body { padding: 1.75rem; }
.modal-body p { margin-bottom: 1.5rem; color: var(--text-secondary); line-height: 1.7; }
.modal-body p strong { color: var(--text-primary); }
.modal-footer { padding: 1.75rem; border-top: 1px solid var(--border-primary); display: flex; gap: 1rem; justify-content: flex-end; }
.btn-close { background: none; border: none; font-size: 1.75rem; cursor: pointer; color: var(--text-tertiary); padding: 0; transition: all 0.3s; }
.btn-close:hover { color: var(--text-primary); transform: rotate(90deg); }

/* Form Elements */
.form-group { margin-bottom: 1.75rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-primary); }
.form-input, .form-textarea {
    width: 100%; padding: 1rem; border: 2px solid var(--border-primary); border-radius: var(--radius-lg);
    background: var(--bg-primary); color: var(--text-primary); font-size: 1rem;
    transition: all 0.3s;
}
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--violet-400); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2); }
.form-textarea { min-height: 400px; resize: vertical; font-family: 'Monaco', monospace; }
.editor-actions { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 2rem; }

/* Page/Article Styles (Généré par JS) */
.page-header { border-bottom: 1px solid var(--border-primary); padding-bottom: 1.5rem; margin-bottom: 2rem; }
.page-actions { display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }
.page-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.page-card {
    background: var(--bg-primary); border: 1px solid var(--border-primary); border-radius: var(--radius-2xl);
    padding: 1.5rem; cursor: pointer; transition: all 0.3s;
}
.page-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--violet-400); }
.page-title { font-size: 1.25rem; margin-bottom: 0.5rem; color: var(--text-primary); font-weight: 600; }
.page-meta { font-size: 0.85rem; color: var(--text-tertiary); display: flex; gap: 1rem; margin-bottom: 1rem; }
.page-excerpt { color: var(--text-secondary); font-size: 0.95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Markdown Content */
.markdown-content { line-height: 1.8; color: var(--text-primary); }
.markdown-content h1 {
    font-size: 2.5rem; margin: 1rem 0 1.5rem 0; padding-bottom: 1rem; font-weight: 800;
    border-bottom: 2px solid var(--border-primary);
    background: linear-gradient(135deg, var(--violet-600), var(--cyan-500));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.markdown-content h2 { font-size: 1.8rem; margin: 2rem 0 1rem; color: var(--text-primary); border-bottom: 1px solid var(--border-primary); padding-bottom: 0.5rem; }
.markdown-content h3 { font-size: 1.4rem; margin: 1.5rem 0 1rem; }
.markdown-content p { margin-bottom: 1.2rem; }
.markdown-content ul, .markdown-content ol { margin: 1.2rem 0; padding-left: 2rem; }
.markdown-content li { margin-bottom: 0.5rem; }
.markdown-content pre {
    background: #1e293b; color: #e2e8f0; padding: 1.5rem; border-radius: var(--radius-2xl);
    overflow-x: auto; margin: 1.5rem 0; max-width: 100%;
}
[data-theme="light"] .markdown-content pre { background: var(--slate-100); color: var(--slate-800); }
.markdown-content code {
    font-family: 'Monaco', monospace; background: var(--bg-tertiary); padding: 0.2rem 0.4rem; border-radius: 4px;
}
.markdown-content pre code { background: transparent; padding: 0; }
.markdown-content blockquote {
    border-left: 4px solid var(--violet-500); padding: 0.5rem 1rem; margin: 1rem 0;
    background-color: var(--bg-tertiary); border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.markdown-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.markdown-content th, .markdown-content td { padding: 0.75rem; border: 1px solid var(--border-primary); }
.markdown-content th { background-color: var(--bg-tertiary); }

/* History */
.history-item { display: flex; justify-content: space-between; padding: 1rem; border-bottom: 1px solid var(--border-primary); align-items: center; }
.history-item:last-child { border-bottom: none; }
.history-actions { display: flex; gap: 0.5rem; }

/* Error state (PHP) */
.error-container {
    background: linear-gradient(135deg, #fef2f2, #fee2e2); border: 1px solid #fecaca;
    color: #dc2626; padding: 1.25rem; margin: 1.25rem; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.error-container::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--rose-500), var(--orange-500));
}
.error-container h3 { margin: 0 0 0.75rem 0; font-size: 1.25rem; font-weight: 600; }
.error-container ul { margin: 0.75rem 0; padding-left: 1.75rem; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Responsive */
@media (max-width: 1024px) {
    .main-layout { grid-template-columns: 1fr; gap: 1.75rem; }
    .sidebar { order: 2; position: static; top: auto; }
    .content-area { order: 1; }
}
@media (max-width: 768px) {
    .header-content { flex-direction: column; gap: 1.25rem; padding: 1rem 0; }
    .search-bar { max-width: 100%; width: 100%; }
    .nav-buttons { width: 100%; justify-content: center; }
    .btn { width: 100%; justify-content: center; }
    .welcome-message h1 { font-size: 2.25rem; }
    .welcome-actions { flex-direction: column; }
    .main-layout { padding: 1.5rem 0; }
}
