/* css/components.css */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--bg-gradient);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.btn-close {
    padding: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
}

.btn-close:hover {
    color: var(--text-primary);
}

.form-card {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.form-header h2 {
    color: var(--text-primary);
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 200px;
}

select.form-control {
    cursor: pointer;
}

.char-counter {
    text-align: right;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 5px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.form-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border-left: 4px solid var(--danger-color);
    display: none;
}

.article-card {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    transition: var(--transition);
    margin-bottom: 20px;
}

.article-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.article-category {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-gradient);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.article-actions {
    display: flex;
    gap: 8px;
}

.article-title {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.article-preview {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.article-date {
    color: var(--text-light);
    font-size: 0.9rem;
}

.search-bar {
    background: var(--bg-primary);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.search-input {
    width: 100%;
    padding: 14px 48px 14px 50px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    border-radius: 50%;
    transition: var(--transition);
}

.btn-clear-search:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-filters {
    display: flex;
    gap: 15px;
}

.filter-select {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-filter {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-filter:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.search-results {
    margin-top: 20px;
}

.search-results-header {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.results-count {
    color: var(--text-secondary);
    font-weight: 600;
}

.search-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.search-no-results svg {
    color: var(--text-light);
    margin-bottom: 15px;
}

.search-no-results h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Article Detail View */
.article-detail {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.article-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
}

.article-detail-actions {
    display: flex;
    gap: 10px;
}

.article-detail-content {
    padding: 40px;
}

.article-detail-meta {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.article-detail-title {
    color: var(--text-primary);
    font-size: 2.5rem;
    margin-bottom: 30px;
    line-height: 1.2;
}

.article-detail-body {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-detail-body p {
    margin-bottom: 20px;
}

.article-detail-body p:last-child {
    margin-bottom: 0;
}

/* Mobile */
@media (max-width: 768px) {
    .article-detail-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .article-detail-actions {
        width: 100%;
        flex-direction: column;
    }

    .article-detail-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .article-detail-content {
        padding: 20px;
    }

    .article-detail-title {
        font-size: 1.8rem;
    }

    .article-detail-body {
        font-size: 1rem;
    }
}

/* Stats Container */
.stats-container {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-top: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 600;
}

.stat-number {
    color: var(--primary-color);
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.stat-categories {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Mobile */
@media (max-width: 768px) {
    .stats-container {
        padding: 20px;
        margin-top: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-number {
        font-size: 2.5rem;
    }
}

/* Sidebar */
.sidebar-container {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar {
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-280px);
}

/* ... reste du CSS sidebar ... */

/* SUPPRIMER OU COMMENTER L'OVERLAY */
/*
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}
*/

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-gradient);
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 1.1rem;
    margin: 0;
}

.sidebar-title svg {
    color: white;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: white;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.sidebar-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: var(--bg-gradient);
    color: white;
}

.sidebar-item.active svg {
    color: white;
}

.sidebar-item svg {
    color: var(--text-light);
    flex-shrink: 0;
}

.sidebar-item-text {
    flex: 1;
    font-weight: 500;
}

.sidebar-item-count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.sidebar-item.active .sidebar-item-count {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 15px 0;
}

.sidebar-section {
    margin-top: 10px;
}

.sidebar-section-title {
    padding: 8px 15px;
    margin-bottom: 5px;
}

.sidebar-section-text {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Ajuster le contenu principal */
.main-wrapper {
    margin-left: 280px;
    transition: margin-left 0.3s ease;
}

.main-wrapper.sidebar-collapsed {
    margin-left: 0;
}

/* Mobile Toggle Button */
.mobile-sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--bg-gradient);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    color: white;
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar-container {
        width: 280px;
    }

    .sidebar.collapsed {
        transform: translateX(-280px);
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .mobile-sidebar-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-280px);
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }
}

/* Bouton pour rouvrir la sidebar (DESKTOP) */
.sidebar-reopen-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100; /* AUGMENTER le z-index pour être AU-DESSUS de tout */
    background: var(--bg-gradient);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex !important; /* FORCER le display */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    color: white;
    transition: var(--transition);
    opacity: 0;
    pointer-events: none;
    visibility: hidden; /* AJOUTER visibility */
}

.sidebar-reopen-btn.show {
    opacity: 1;
    pointer-events: auto;
    visibility: visible; /* AJOUTER visibility */
}

.sidebar-reopen-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.sidebar-reopen-btn svg {
    color: white;
}

/* Ajuster le mobile toggle pour ne pas chevaucher */
.mobile-sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--bg-gradient);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    color: white;
}

/* Mobile */
@media (max-width: 768px) {
    .mobile-sidebar-toggle {
        display: flex;
    }

    .sidebar-reopen-btn {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .mobile-sidebar-toggle {
        display: none !important;
    }
}

/* ===== SIDEBAR CATEGORIES, FOLDERS & ARTICLES ===== */

/* Category item */
.sidebar-category-item {
    margin-bottom: 5px;
}

.sidebar-category-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-weight: 600;
}

.sidebar-category-header:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar-category-header.active {
    background: var(--bg-gradient);
    color: white;
}

.sidebar-category-header.active svg {
    color: white;
}

.sidebar-category-header.drag-over {
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed var(--primary-color);
}

/* Category expand button */
.category-expand-btn {
    background: transparent;
    border: none;
    padding: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.category-expand-btn:hover {
    color: var(--primary-color);
}

.sidebar-category-header.active .category-expand-btn {
    color: white;
}

.category-expand-spacer {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Category icon */
.category-icon {
    color: var(--primary-color);
    flex-shrink: 0;
}

.sidebar-category-header.active .category-icon {
    color: white;
}

/* Category actions */
.category-actions {
    margin-left: auto;
    display: none;
    gap: 4px;
    flex-shrink: 0;
}

.sidebar-category-header:hover .category-actions {
    display: flex;
}

.sidebar-category-header.active .category-actions {
    display: flex;
}

.btn-add-folder,
.btn-add-subfolder {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    transition: var(--transition);
}

.btn-add-folder:hover,
.btn-add-subfolder:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--primary-color);
}

.sidebar-category-header.active .btn-add-folder,
.sidebar-category-header.active .btn-add-subfolder {
    color: white;
}

.sidebar-category-header.active .btn-add-folder:hover,
.sidebar-category-header.active .btn-add-subfolder:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Category children (folders + articles directs) */
.sidebar-category-children {
    margin-left: 20px;
    margin-top: 5px;
    padding-left: 8px;
    border-left: 2px solid var(--border-color);
}

/* Folder item */
.sidebar-folder-item {
    margin-bottom: 5px;
}

.sidebar-folder-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.sidebar-folder-header:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar-folder-header.active {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-folder-header.active svg {
    color: var(--primary-color);
}

.sidebar-folder-header.drag-over {
    background: rgba(102, 126, 234, 0.2);
    border: 2px dashed var(--primary-color);
}

/* Folder expand button */
.folder-expand-btn {
    background: transparent;
    border: none;
    padding: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.folder-expand-btn:hover {
    color: var(--primary-color);
}

.sidebar-folder-header.active .folder-expand-btn {
    color: var(--primary-color);
}

.folder-expand-spacer {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Folder icon */
.folder-icon {
    color: var(--text-light);
    flex-shrink: 0;
}

.sidebar-folder-header.active .folder-icon {
    color: var(--primary-color);
}

/* Folder actions */
.folder-actions {
    margin-left: auto;
    display: none;
    gap: 4px;
    flex-shrink: 0;
}

.sidebar-folder-header:hover .folder-actions {
    display: flex;
}

.sidebar-folder-header.active .folder-actions {
    display: flex;
}

.btn-rename-folder,
.btn-delete-folder {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    transition: var(--transition);
}

.btn-rename-folder:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--primary-color);
}

.btn-delete-folder:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* Folder children (articles) */
.sidebar-folder-children {
    margin-left: 18px;
    margin-top: 5px;
    padding-left: 8px;
    border-left: 2px solid var(--border-color);
}

/* Article item */
.sidebar-article-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.sidebar-article-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar-article-item.dragging {
    opacity: 0.5;
}

.sidebar-article-item svg {
    color: var(--text-light);
    flex-shrink: 0;
}

.sidebar-article-item:hover svg {
    color: var(--primary-color);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .sidebar-category-children {
        margin-left: 12px;
        padding-left: 6px;
    }

    .sidebar-folder-children {
        margin-left: 12px;
        padding-left: 6px;
    }

    .category-actions,
    .folder-actions {
        display: flex !important;
    }

    .btn-add-folder,
    .btn-add-subfolder,
    .btn-rename-folder,
    .btn-delete-folder {
        padding: 6px;
    }
}

/* ===== MARKDOWN EDITOR ===== */

.markdown-editor {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-primary);
}

.markdown-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-secondary);
}

.markdown-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.markdown-tab:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
}

.markdown-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--bg-primary);
}

.markdown-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-wrap: wrap;
}

.markdown-toolbar-btn {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.markdown-toolbar-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.markdown-toolbar-separator {
    width: 1px;
    background: var(--border-color);
    margin: 0 4px;
}

.markdown-content {
    position: relative;
}

.markdown-textarea {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    border: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.markdown-textarea:focus {
    outline: none;
}

.markdown-preview {
    padding: 16px;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    background: var(--bg-primary);
}

.markdown-preview-empty {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding: 60px 20px;
}

/* Markdown content styling */
.markdown-content-rendered h1,
.markdown-preview h1 {
    font-size: 2em;
    font-weight: 700;
    margin-top: 24px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.markdown-content-rendered h2,
.markdown-preview h2 {
    font-size: 1.5em;
    font-weight: 700;
    margin-top: 24px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.markdown-content-rendered h3,
.markdown-preview h3 {
    font-size: 1.25em;
    font-weight: 700;
    margin-top: 20px;
    margin-bottom: 12px;
}

.markdown-content-rendered h4,
.markdown-preview h4 {
    font-size: 1.1em;
    font-weight: 700;
    margin-top: 16px;
    margin-bottom: 12px;
}

.markdown-content-rendered p,
.markdown-preview p {
    margin-bottom: 16px;
    line-height: 1.7;
}

.markdown-content-rendered ul,
.markdown-preview ul,
.markdown-content-rendered ol,
.markdown-preview ol {
    margin-bottom: 16px;
    padding-left: 32px;
}

.markdown-content-rendered li,
.markdown-preview li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.markdown-content-rendered code,
.markdown-preview code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: var(--danger-color);
}

.markdown-content-rendered pre,
.markdown-preview pre {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-bottom: 16px;
}

.markdown-content-rendered pre code,
.markdown-preview pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
    font-size: 0.9em;
}

.markdown-content-rendered blockquote,
.markdown-preview blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-content-rendered a,
.markdown-preview a {
    color: var(--primary-color);
    text-decoration: none;
}

.markdown-content-rendered a:hover,
.markdown-preview a:hover {
    text-decoration: underline;
}

.markdown-content-rendered img,
.markdown-preview img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 16px 0;
}

.markdown-content-rendered table,
.markdown-preview table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 16px;
}

.markdown-content-rendered th,
.markdown-preview th,
.markdown-content-rendered td,
.markdown-preview td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.markdown-content-rendered th,
.markdown-preview th {
    background: var(--bg-secondary);
    font-weight: 700;
}

.markdown-content-rendered hr,
.markdown-preview hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 24px 0;
}

/* Mobile */
@media (max-width: 768px) {
    .markdown-toolbar {
        padding: 6px;
        gap: 2px;
    }

    .markdown-toolbar-btn {
        padding: 4px 8px;
        font-size: 0.85rem;
    }

    .markdown-textarea {
        min-height: 300px;
        font-size: 0.9rem;
    }

    .markdown-preview {
        min-height: 300px;
    }
}

/* ===== PASTILLES COULEURS ===== */

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.color-dot-small {
    width: 8px;
    height: 8px;
    border-width: 1px;
}

.category-color-dot,
.folder-color-dot {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.category-color-dot:hover,
.folder-color-dot:hover {
    transform: scale(1.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===== COLOR PICKER MODAL ===== */

.color-picker-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.3);
}

.color-picker-modal.show {
    display: block;
}

.color-picker-content {
    position: absolute;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    min-width: 200px;
    border: 1px solid var(--border-color);
}

.color-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.color-picker-header span {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.color-picker-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.color-picker-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.color-picker-color {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.color-picker-color:hover {
    transform: scale(1.15);
    border-color: var(--text-primary);
}

/* ===== AJUSTEMENTS SIDEBAR AVEC PASTILLES ===== */

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-folder-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-article-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Cacher l'icône dossier/fichier SVG car on a les pastilles */
.sidebar-category-header .category-icon,
.sidebar-folder-header .folder-icon {
    display: none;
}

/* Mobile */
@media (max-width: 768px) {
    .color-picker-content {
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%);
    }

    .color-picker-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .color-picker-color {
        width: 40px;
        height: 40px;
    }
}

/* ===== BADGES ARTICLES ===== */

.article-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.article-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.article-folder {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.article-folder svg {
    flex-shrink: 0;
}

/* Form row - deux colonnes */
.form-row {
    display: flex;
    gap: 20px;
}

.form-group-half {
    flex: 1;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

