/*
Theme Name: AccessDoc Éducatif
Theme URI: https://accessdoc.education
Author: Votre Nom
Author URI: https://votresite.com
Description: Thème éducatif avec éditeur de documents intégré pour enseignants et parents
Version: 1.0.0
License: GPL v2 or later
Text Domain: accessdoc
*/

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
    --radius: 10px;
    --header-height: 110px;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
   
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    padding-top: var(--header-height);
    height: 100vh;
   
}

/* ===== SKIP LINK ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 8px 8px;
    z-index: 10000;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus {
    top: 0;
}

/* ===== HEADER MODERNE ===== */
.site-header {
    background: #ffffff;
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid var(--gray-200);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    width: 100%;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.97);
}

.header-top {
    padding: 0.4rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    background: #ffffff;
}

.header-top-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ===== SITE BRANDING ===== */
.site-branding {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.site-branding .custom-logo {
    max-height: 32px !important;
    width: auto !important;
}

.site-branding .logo-icon {
    font-size: 1.3rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.35rem;
    border-radius: var(--radius);
}

.site-branding h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.site-branding h1 span {
    color: var(--primary);
}

/* ===== USER INFO ===== */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.75rem;
}

.user-info .user-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-700);
    line-height: 1.2;
}

.user-info .user-role {
    font-size: 0.6rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ===== MENU MODERNE ===== */
.main-navigation {
    padding: 0.25rem 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid var(--gray-100);
}

.nav-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

/* ===== BOUTONS MODERNES ===== */
.menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    min-height: 32px;
    white-space: nowrap;
    line-height: 1.2;
    position: relative;
}

.menu-btn i {
    font-size: 0.75rem;
    width: 0.9rem;
    text-align: center;
    color: var(--gray-400);
    transition: color 0.2s ease;
}

.menu-btn:hover {
    background: var(--gray-100);
    color: var(--gray-900);
    transform: translateY(-1px);
}

.menu-btn:hover i {
    color: var(--primary);
}

.menu-btn:active {
    transform: scale(0.97);
}

.menu-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== BARRE D'OUTILS TINYMCE ===== */
.tinymce-toolbar-container {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 4px 16px;
    min-height: 42px;
    display: none;
   
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    position: relative;
    z-index: 10;
}

/* Forcer l'affichage de la toolbar TinyMCE */
.tinymce-toolbar-container .tox-tinymce {
    visibility: visible !important;
    display: flex !important;
}

.tinymce-toolbar-container .tox-toolbar {
    background: transparent !important;
    padding: 2px 0 !important;
}

.tinymce-toolbar-container .tox-tbtn {
    height: 28px !important;
    padding: 0 6px !important;
    border-radius: 4px !important;
}

.tinymce-toolbar-container .tox-tbtn:hover {
    background: var(--gray-100) !important;
}

.tinymce-toolbar-container .tox-tbtn__select-label {
    font-size: 12px !important;
}

.tinymce-toolbar-container .tox-tbtn--enabled {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
}

.tinymce-toolbar-container .tox-tbtn--enabled .tox-icon {
    color: var(--primary) !important;
}

/* Supprimer le style visibility hidden de TinyMCE */
.tox-tinymce-inline {
    visibility: visible !important;
}

/* ===== MAIN CONTENT ===== */
.site-main {
    flex: 1;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.5rem 1.5rem 1.5rem;
    width: 100%;
   
    
    display: flex;
    flex-direction: column;
}

/* ===== ZONE ÉDITION ===== */
.editor-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* Suppression du style A4 - conteneur plein écran */
.a4-page {
    background: #ffffff;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    padding: 2rem 2.5rem;
    max-width: 1200px;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .a4-page {
        padding: 1.5rem;
        border-radius: 8px;
    }
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-100);
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
}

.editor-header .doc-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
}
.editor-header .doc-title i {
    color: var(--primary);
    margin-right: 0.5rem;
}

.editor-header .doc-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.7rem;
    color: var(--gray-500);
}

.editor-header .doc-meta span {
    background: var(--gray-100);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

/* ===== TINYMCE - SCROLL UNIQUEMENT ICI ===== */
.tinymce-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    position: relative;
    min-height: 0;
}

.tinymce-editor-wrapper {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    position: relative;
    min-height: 0;
    height: 100%;
}

.tinymce-editor-wrapper::-webkit-scrollbar {
    width: 8px;
}

.tinymce-editor-wrapper::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

.tinymce-editor-wrapper::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

.tinymce-editor-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.tinymce-editor-area {
    padding: 1.5rem;
    background: #ffffff;
    min-height: 100%;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--gray-900);
    outline: none;
}

.tinymce-editor-area:focus {
    box-shadow: inset 0 0 0 2px var(--primary);
}

.tinymce-editor-area p {
    margin-bottom: 0.75rem;
}

.scroll-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.1s;
    border-radius: 0 0 8px 8px;
    pointer-events: none;
    z-index: 5;
}

/* ============================================================ */
/* RESPONSIVE */
/* ============================================================ */

@media (max-width: 1200px) {
    .menu-btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
    }
    .menu-btn i {
        font-size: 0.7rem;
        width: 0.8rem;
    }
    :root {
        --header-height: 105px;
    }
}

@media (max-width: 1024px) {
    .header-top-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 0.3rem;
    }
    .user-info {
        justify-content: flex-end;
    }
    .nav-inner {
        justify-content: center;
    }
    :root {
        --header-height: 125px;
    }
}

@media (max-width: 768px) {
    .header-top {
        padding: 0.2rem 0.8rem;
    }
    .main-navigation {
        padding: 0.15rem 0.8rem;
    }
    .menu-btn {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
        min-height: 26px;
    }
    .menu-btn i {
        display: none;
    }
    .site-branding h1 {
        font-size: 0.9rem;
    }
    .site-branding .custom-logo {
        max-height: 24px !important;
    }
    .a4-page {
        padding: 1rem 1.25rem;
    }
    :root {
        --header-height: 100px;
    }
}

@media (max-width: 480px) {
    .header-top {
        padding: 0.15rem 0.5rem;
    }
    .main-navigation {
        padding: 0.1rem 0.5rem;
    }
    .menu-btn {
        font-size: 0.55rem;
        padding: 0.15rem 0.3rem;
        min-height: 22px;
    }
    .site-branding h1 {
        font-size: 0.8rem;
    }
    .site-branding .custom-logo {
        max-height: 20px !important;
    }
    .user-info .avatar {
        width: 24px;
        height: 24px;
        font-size: 0.6rem;
    }
    .user-info .user-name {
        font-size: 0.65rem;
    }
    .user-info .user-role {
        font-size: 0.5rem;
    }
    .a4-page {
        padding: 0.75rem 1rem;
    }
    :root {
        --header-height: 85px;
    }
}

/* ===== ACCESSIBILITÉ ===== */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ============================================================ */
/* MODALES XXL */
/* ============================================================ */

.modal-backdrop {
    z-index: 1040 !important;
}

.modal {
    z-index: 1050 !important;
    padding-top: 80px !important;
}

.modal-dialog-xxl {
    max-width: 1400px !important;
    width: 96% !important;
    margin: 0 auto !important;
    margin-top: 20px !important;
}

@media (min-width: 1600px) {
    .modal-dialog-xxl {
        max-width: 1500px !important;
        width: 92% !important;
    }
}

@media (max-width: 992px) {
    .modal-dialog-xxl {
        max-width: 98% !important;
        width: 98% !important;
        margin: 10px auto !important;
    }
    .modal {
        padding-top: 70px !important;
    }
}

@media (max-width: 576px) {
    .modal-dialog-xxl {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    .modal-content-xxl {
        border-radius: 0 !important;
    }
    .modal {
        padding-top: 60px !important;
    }
}

.modal-content-xxl {
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35) !important;
    border: none !important;
    max-height: calc(100vh - 160px) !important;
    display: flex !important;
    flex-direction: column !important;
}

.modal-header-xxl {
    padding: 1.5rem 2.5rem !important;
    border-radius: 16px 16px 0 0 !important;
    flex-shrink: 0 !important;
}

.modal-header-xxl h5 {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
}

.modal-header-xxl .btn-close {
    filter: brightness(0) invert(1) !important;
    opacity: 0.8 !important;
    font-size: 1.5rem !important;
}

.modal-header-xxl .btn-close:hover {
    opacity: 1 !important;
}

.modal-body-xxl {
    padding: 2rem 2.5rem !important;
    overflow-y: auto !important;
    flex: 1 !important;
    max-height: calc(100vh - 280px) !important;
}

.modal-body-xxl p {
    font-size: 1.1rem !important;
    line-height: 1.6 !important;
    margin-bottom: 1.5rem !important;
}

.modal-body-xxl .shortcode-container {
    min-height: 200px !important;
    width: 100% !important;
}

.modal-footer-xxl {
    padding: 1.5rem 2.5rem !important;
    border-radius: 0 0 16px 16px !important;
    flex-shrink: 0 !important;
    border-top: 1px solid rgba(0,0,0,0.08) !important;
}

.modal-footer-xxl .btn {
    font-size: 1.1rem !important;
    padding: 0.6rem 2rem !important;
    min-height: 48px !important;
}

.modal-footer-xxl .btn-secondary {
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #334155 !important;
}

.modal-footer-xxl .btn-secondary:hover {
    background: #e2e8f0 !important;
}

.modal.fade .modal-dialog-xxl {
    transform: translateY(-30px) scale(0.95) !important;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out !important;
}

.modal.show .modal-dialog-xxl {
    transform: translateY(0) scale(1) !important;
}

.modal-body-xxl::-webkit-scrollbar {
    width: 8px;
}

.modal-body-xxl::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.modal-body-xxl::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.modal-body-xxl::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}