/* =====================================================
   Markdown Editor Styles
   Styles pour l'éditeur markdown avec preview
   ===================================================== */

/* ===== Structure de base ===== */
.md-editor-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.md-editor,
.md-editor-area {
    position: relative;
    width: 100%;
    height: 100%;
}

.md-editor-split {
    display: flex;
    gap: 0;
    height: 100%;
    min-height: 600px;
}

.md-editor-panel {
    flex: 1;
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.md-editor-panel.preview {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
}

/* ===== Bouton plein écran ===== */
.md-editor-fullscreen-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--gray-700);
    transition: all var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.md-editor-fullscreen-btn:hover {
    background: var(--gray-50);
    color: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

/* ===== Mode plein écran ===== */
.md-editor-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: var(--white);
    padding: 0;
    margin: 0;
}

.md-editor-fullscreen .md-editor-split {
    height: 100vh;
    min-height: 100vh;
}

.md-editor-fullscreen .md-editor-fullscreen-btn {
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
}

/* ===== Séparateur redimensionnable ===== */
.md-editor-resizer {
    position: relative;
    width: 10px;
    background: var(--gray-100);
    cursor: col-resize;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.md-editor-resizer:hover {
    background: var(--gray-200);
}

.md-editor-resizer-handle {
    width: 3px;
    height: 40px;
    background: var(--gray-400);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.md-editor-resizer:hover .md-editor-resizer-handle {
    background: var(--primary);
    height: 60px;
}

/* ===== Zone de texte ===== */
.md-editor-panel textarea {
    width: 100%;
    height: 100%;
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    padding: 1rem;
    box-sizing: border-box;
}

/* Scrollbar pour le textarea */
.md-editor-panel textarea::-webkit-scrollbar {
    width: 6px;
}

.md-editor-panel textarea::-webkit-scrollbar-track {
    background: transparent;
}

.md-editor-panel textarea::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.md-editor-panel textarea::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===== Zone de preview ===== */
.md-editor-panel.preview {
    background: var(--white);
    border-left: 1px solid var(--gray-200);
}

.md-editor-preview {
    width: 100%;
    height: 100%;
}

.md-editor-fullscreen .md-editor-panel.preview {
    border-left: 1px solid var(--gray-300);
}

/* Scrollbar pour le panneau preview */
.md-editor-panel.preview::-webkit-scrollbar {
    width: 6px;
}

.md-editor-panel.preview::-webkit-scrollbar-track {
    background: transparent;
}

.md-editor-panel.preview::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.md-editor-panel.preview::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===== Menu Slash (commandes rapides au clavier) ===== */
.md-slash-menu {
    position: fixed;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 600px;
    overflow: hidden;
    z-index: 10000;
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: 1fr;
}

.md-slash-menu-categories {
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.md-slash-menu-items {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    height: 100%;
}

.md-slash-menu-category {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.md-slash-menu-category:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.md-slash-menu-category.active {
    background: var(--white);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.md-slash-menu-category-icon {
    font-size: 1rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.md-slash-menu-category-label {
    flex: 1;
}

.md-slash-menu-category-count {
    font-size: 0.75rem;
    background: var(--gray-200);
    color: var(--gray-600);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.md-slash-menu-category.active .md-slash-menu-category-count {
    background: var(--primary-100);
    color: var(--primary);
}

.md-slash-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-left: 3px solid transparent;
}

.md-slash-menu-item:hover {
    background: var(--gray-50);
}

.md-slash-menu-item.selected {
    background: var(--primary-50);
    border-left-color: var(--primary);
}

.md-slash-menu-icon {
    font-size: 1.25rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.md-slash-menu-item.selected .md-slash-menu-icon {
    background: var(--primary-100);
    color: var(--primary);
}

.md-slash-menu-text {
    flex: 1;
    min-width: 0;
}

.md-slash-menu-label {
    font-weight: 500;
    color: var(--gray-900);
    font-size: 0.875rem;
    line-height: 1.3;
}

.md-slash-menu-description {
    font-size: 0.75rem;
    color: var(--gray-600);
    line-height: 1.3;
    margin-top: 0.125rem;
}

.md-slash-menu-item.selected .md-slash-menu-label {
    color: var(--primary);
}

.md-slash-menu-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Scrollbar pour les colonnes du menu slash */
.md-slash-menu-categories::-webkit-scrollbar,
.md-slash-menu-items::-webkit-scrollbar {
    width: 6px;
}

.md-slash-menu-categories::-webkit-scrollbar-track,
.md-slash-menu-items::-webkit-scrollbar-track {
    background: transparent;
}

.md-slash-menu-categories::-webkit-scrollbar-thumb,
.md-slash-menu-items::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.md-slash-menu-categories::-webkit-scrollbar-thumb:hover,
.md-slash-menu-items::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .md-editor-split {
        flex-direction: column;
    }

    .md-editor-resizer {
        width: 100%;
        height: 10px;
        cursor: row-resize;
    }

    .md-editor-resizer-handle {
        width: 40px;
        height: 3px;
    }

    .md-editor-resizer:hover .md-editor-resizer-handle {
        width: 60px;
        height: 3px;
    }

    .md-slash-menu {
        width: calc(100vw - 2rem);
        flex-direction: column;
    }

    .md-slash-menu-categories {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        display: flex;
        overflow-x: auto;
        padding: 0;
    }

    .md-slash-menu-category {
        flex-direction: column;
        text-align: center;
        padding: 0.5rem;
        min-width: 80px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .md-slash-menu-category.active {
        border-left: none;
        border-bottom-color: var(--primary);
    }

    .md-slash-menu-items {
        max-height: 250px;
    }
}
