/* === CORPUS MORPHOLOGIQUE === */

.morpho-wrapper {
    padding-bottom: 1rem;
}

.morpho-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.morpho-canvas-container {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e5e7f0;
    padding: 0.75rem;
    overflow-x: auto;
}

.morpho-canvas {
    background: #ffffff;
    border-radius: 14px;
    border: 1px dashed #e5e7f0;
    padding: 0.75rem;
    box-sizing: border-box;
    min-height: 220px;
}

/* Titre en haut du corpus */
.morpho-main-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Grille de catégories : 4 max par ligne (auto-fill gère le wrap) */
.morpho-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    align-items: flex-start;
}

/* Chaque catégorie morphologique */
.morpho-category-box {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #d1d5e5;
    padding: 0.5rem 0.6rem;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
    box-sizing: border-box;
    overflow: hidden;
}

/* Titre de catégorie */
.morpho-cat-title {
    font-size: 1rem;          /* un peu plus grand que la liste de mots */
    font-weight: 600;
    margin-bottom: 0.3rem;
    cursor: pointer;
    text-align: center;       /* centrage du titre dans le cadre */
}


.morpho-cat-title:hover {
    color: #4f46e5;
}

/* Mots dans une catégorie */
.morpho-cat-words {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.9rem;
}

.morpho-word {
    cursor: pointer;
}

.morpho-word:hover {
    text-decoration: underline;
}

/* Poignée de redimensionnement en bas à droite */
.morpho-resizer {
    position: absolute;
    width: 14px;
    height: 14px;
    bottom: 6px;
    right: 6px;
    border-radius: 4px;
    background: #e5e7eb;
    cursor: se-resize;
}

/* Sidebar / panneaux */
.morpho-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.morpho-panel {
    border-radius: 14px;
    border: 1px solid #e5e7f0;
    background: #f9fafb;
    padding: 0.75rem 0.85rem;
}

.morpho-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

/* Panneau interconnexions */
.morpho-links-panel {
    min-height: 80px;
    max-height: 220px;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7f0;
    padding: 0.5rem 0.6rem;
    box-sizing: border-box;
}

.morpho-links-panel-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.morpho-links-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.morpho-links-list li {
    font-size: 0.85rem;
    padding: 0.25rem 0.35rem;
    border-radius: 8px;
    cursor: pointer;
}

.morpho-links-list li:hover {
    background: #eef2ff;
}

/* Éditeurs de catégories (panneau de droite) */
.morpho-editor-block {
    margin-bottom: 0.6rem;
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e5e7f0;
}

.morpho-editor-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.3rem;
}

.morpho-editor-header input[type="text"] {
    flex: 1;
}

.morpho-editor-block textarea {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}

.morpho-editor-block textarea:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.15);
}

/* Impression A4 – même logique que fleurs / hyperonymie / grille */
@media print {
    @page {
        /* A4 paysage comme les autres corpus */
        size: A4 landscape;
        margin: 1cm;
    }

    body {
        background: #ffffff !important;
    }

    /* On masque header / footer / sidebar / breadcrumb */
    header,
    footer,
    .app-header,
    .app-footer,
    .breadcrumb,
    .morpho-sidebar {
        display: none !important;
    }

    .app-main {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    /* On évite la mise en colonnes avec la sidebar */
    .morpho-layout {
        display: block !important;
        grid-template-columns: none !important;
    }

    /* Le bloc principal occupe toute la largeur de la page,
       sans card ni cadre qui rétrécit le corpus */
    .morpho-wrapper,
    .morpho-canvas-container,
    .morpho-canvas {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }

    /* On garde juste une marge intérieure pour le contenu du corpus */
    .morpho-canvas {
        padding: 0.4cm !important;
        box-sizing: border-box;
        overflow: visible !important;
    }

    /* On enlève tout scroll pour l’impression */
    .morpho-canvas-container {
        overflow: visible !important;
    }

    /* 🔹 Grille identique à l’aperçu :
       les catégories se placent côte à côte puis passent en dessous */
    .morpho-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 0.75rem !important;
        align-items: flex-start;
    }

    /* On neutralise les dimensions sauvegardées des catégories
       pour qu’elles laissent la grille décider */
    .morpho-category-box {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
    }
}

