/* Reset et base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;

    --color-bg: #f5f7fa;
    --color-surface: #ffffff;
    --color-dark: #1e293b;
    --color-dark-light: #334155;

    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-text-muted: #94a3b8;

    --color-border: #e2e8f0;
    --color-border-dark: #cbd5e1;

    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-dark);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Material Icons */
.material-symbols-outlined {
    font-size: 20px;
    vertical-align: middle;
}

.icon-sm { font-size: 16px; }

/* ==================== NAVBAR ==================== */
.navbar {
    background: var(--color-dark);
    color: white;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
}

.navbar-brand:hover {
    opacity: 0.9;
}

.navbar-brand span {
    color: #60a5fa;
}

/* Bouton retour */
.navbar-back {
    display: none; /* Caché par défaut, affiché par JS sur l'éditeur */
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    position: absolute;
    left: 24px;
}

.navbar-back:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.navbar-back .material-symbols-outlined {
    font-size: 18px;
}

/* Bouton toggle panneau droit dans la navbar */
.navbar-toggle {
    display: none; /* Caché par défaut */
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
    position: absolute;
    right: 24px;
}

/* Affiché sur l'éditeur (classe ajoutée par JS) */
.navbar-toggle.visible {
    display: flex;
}

.navbar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.navbar-toggle.active {
    background: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

.navbar-toggle .material-symbols-outlined {
    font-size: 20px;
}

/* ==================== BOUTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--color-text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: rgba(0,0,0,0.05);
    color: var(--color-text);
}

.btn-icon.danger:hover {
    color: var(--color-danger);
    background: #fef2f2;
}

/* ==================== LAYOUT ==================== */
.app-layout {
    display: grid;
    grid-template-columns: 330px 1fr 280px;
    height: calc(100vh - 56px);
}

.app-layout.two-columns {
    grid-template-columns: 1fr 330px;
}

.app-container {
    padding-top: 56px;
    min-height: 100vh;
}

/* ==================== SIDEBAR GAUCHE - RECHERCHE ==================== */
.sidebar-left {
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px 16px 0;
    flex-shrink: 0;
}

.sidebar-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-content {
    flex: 1;
    padding: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Indicateur UE sélectionnée */
.selected-unit-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #dbeafe;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-primary);
}

.selected-unit-indicator span:first-child {
    color: var(--color-success);
}

.selected-unit-indicator .btn-clear {
    margin-left: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 2px;
    display: flex;
}

.selected-unit-indicator .btn-clear:hover {
    color: var(--color-danger);
}

.no-unit-hint {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ==================== MODULE SEARCH COMPONENT ==================== */
.module-search {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.search-box {
    position: relative;
    margin-bottom: 12px;
}

.search-box input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 2px solid var(--color-border);
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.2s;
    background: white;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 20px;
}

/* Wrapper recherche + bouton tag */
.search-box-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.search-box-wrapper .search-box {
    margin-bottom: 0;
    position: relative;
}

.search-box-wrapper .search-box input {
    padding-right: 44px;
}

/* Bouton filtre par tags intégré dans la barre */
.btn-tag-filter {
    position: absolute;
    right: 2px;
    top: 2px;
    bottom: 2px;
    width: 40px;
    border: none;
    border-radius: 0 23px 23px 0;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--color-primary);
}

.btn-tag-filter:hover {
    background: rgba(59, 130, 246, 0.12);
}

.btn-tag-filter.has-tags {
    background: rgba(59, 130, 246, 0.18);
}

.btn-tag-filter .material-symbols-outlined {
    font-size: 22px;
}

.btn-tag-filter .tag-count {
    position: absolute;
    top: 4px;
    right: 6px;
    background: var(--color-primary);
    color: white;
    font-size: 9px;
    font-weight: 600;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Popup desktop pour les tags */
.tag-popup {
    position: fixed;
    width: 280px;
    max-height: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 1800;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tag-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

.tag-popup-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.btn-clear-tags {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.btn-clear-tags:hover {
    background: rgba(59, 130, 246, 0.1);
}

.tag-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
}

.tag-search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    background: transparent;
}

.tag-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
}

.tag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.tag-item:hover {
    background: #f1f5f9;
}

.tag-item.selected {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-primary);
}

.tag-item .tag-name {
    font-size: 13px;
    font-weight: 500;
}

.tag-item .tag-module-count {
    font-size: 11px;
    color: var(--color-text-muted);
    background: white;
    padding: 2px 8px;
    border-radius: 10px;
}

.tag-item.selected .tag-module-count {
    background: var(--color-primary);
    color: white;
}

/* Tags sélectionnés (sous la barre de recherche) */
.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 10px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-primary);
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.btn-remove-tag {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    color: var(--color-primary);
    opacity: 0.7;
}

.btn-remove-tag:hover {
    opacity: 1;
}

.icon-xs {
    font-size: 14px;
}

/* Cacher popup sur mobile */
@media (max-width: 1200px) {
    .tag-popup {
        display: none;
    }
}

/* Filtres */
.search-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.search-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 2px 10px;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: white;
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-light);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.filter-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Compteur de résultats */
.search-count {
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
}

/* Liste des résultats */
.search-results-list {
    flex: 1;
    overflow-y: auto;
    padding-top: 4px;
    padding-right: 4px;
    padding-bottom: 24px;
}

/* Infinite scroll trigger */
.load-more-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    color: var(--color-text-muted);
    font-size: 13px;
}

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.module-result-card {
    background: white;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.module-result-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.module-result-card.unavailable {
    opacity: 0.6;
    background: #fafafa;
}

.module-result-card.can-add {
    cursor: grab;
}

.module-result-card.can-add:hover {
    border-color: var(--color-success);
}

.module-result-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.module-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.add-indicator {
    background: var(--color-success);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Feedback après ajout */
.add-feedback {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: feedbackPulse 0.3s ease-out;
}

.add-feedback.success {
    background: var(--color-success);
    color: white;
}

.add-feedback.duplicate {
    background: var(--color-warning);
    color: white;
}

@keyframes feedbackPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* Style carte quand module vient d'être ajouté */
.module-result-card.just-added {
    background: #f0fdf4;
    border-color: var(--color-success);
}

/* Style carte quand module déjà dans l'UE */
.module-result-card.in-unit {
    background: #f8fafc;
    border-color: var(--color-border);
    cursor: grab;
}

.module-result-card.in-unit:hover {
    transform: none;
    box-shadow: var(--shadow);
    border-color: var(--color-border-dark);
}

.in-unit-indicator {
    background: #e2e8f0;
    color: var(--color-text-light);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.in-unit-indicator:hover {
    background: #cbd5e1;
    color: var(--color-text);
}

/* Mini-tooltip pour "Déjà présent" */
.in-unit-tooltip {
    position: fixed;
    transform: translateX(-50%) translateY(-100%);
    background: var(--color-text);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 2000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.in-unit-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-text);
}

/* Toast notification */
.toast-notification {
    position: absolute;
    bottom: 16px;
    right: 12px;
    max-width: 300px;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 8px;
    background: var(--color-text);
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    animation: toast-slide-in 0.25s ease-out;
}

.toast-notification[x-cloak] {
    display: none;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.toast-notification > .material-symbols-outlined {
    opacity: 0.7;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.3;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    opacity: 0.6;
    cursor: pointer;
    padding: 2px;
    margin: -2px -4px -2px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.module-result-code {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
}

.module-result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 10px;
    line-height: 1.4;
}

.module-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.module-result-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.module-result-tags .tag {
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 15px;
    font-size: 11px;
    color: var(--color-text-light);
}

.module-result-tags .tag-duration {
    background: #e0f2fe;
    color: #0369a1;
}

/* Bouton Détails */
.btn-details {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: underline;
    flex-shrink: 0;
    transition: all 0.15s;
}

.btn-details:hover {
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.1);
}

/* Tooltip Module */
.module-tooltip {
    position: fixed;
    left: 302px;
    width: 320px;
    max-height: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    overflow: hidden;
    pointer-events: auto;
}

.module-tooltip-content {
    padding: 16px;
    overflow-y: auto;
    max-height: 400px;
}

.module-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.module-tooltip-code {
    background: #dbeafe;
    color: #1d4ed8;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
}

.module-tooltip-availability {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 12px;
}

.module-tooltip-availability.available {
    background: #ecfdf5;
    color: #059669;
}

.module-tooltip-availability.unavailable {
    background: #fef2f2;
    color: #dc2626;
}

.module-tooltip-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 12px;
    line-height: 1.4;
}

.module-tooltip-section {
    margin-bottom: 12px;
}

.module-tooltip-section:last-child {
    margin-bottom: 0;
}

.module-tooltip-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.module-tooltip-section p {
    font-size: 12px;
    color: var(--color-text);
    line-height: 1.5;
    margin: 0;
}

.module-tooltip-section ul {
    margin: 0;
    padding-left: 16px;
    font-size: 12px;
    color: var(--color-text);
}

.module-tooltip-section li {
    margin-bottom: 2px;
}

.module-tooltip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tooltip-tag {
    padding: 3px 8px;
    background: #f1f5f9;
    border-radius: 10px;
    font-size: 10px;
    color: var(--color-text-light);
}

.module-tooltip-duration {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
}

/* Transitions tooltip */
.tooltip-enter {
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.tooltip-leave {
    transition: opacity 0.1s ease, transform 0.1s ease;
}

/* Alpine.js cloak - cache les éléments avant initialisation */
[x-cloak] { display: none; }

/* Responsive tooltip - sur mobile, cacher le tooltip */
@media (max-width: 1200px) {
    .module-tooltip {
        display: none;
    }
}

/* Drawer mobile pour les détails */
.module-drawer-overlay {
    display: none;
}

.module-drawer {
    display: none;
}

@media (max-width: 1200px) {
    .module-drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 2000;
    }

    .module-drawer {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 80vh;
        background: white;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        z-index: 2001;
        overflow: hidden;
    }

    .module-drawer-content {
        padding: 0 20px;
        max-height: 80vh;
        overflow-y: auto;
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }

    .module-drawer-handle {
        display: flex;
        justify-content: center;
        padding: 12px 0 8px;
        cursor: pointer;
    }

    .module-drawer-handle span {
        width: 40px;
        height: 4px;
        background: #d1d5db;
        border-radius: 2px;
    }

    .module-drawer-header {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
    }

    .btn-close-drawer {
        margin-left: auto;
        background: none;
        border: none;
        color: var(--color-text-muted);
        cursor: pointer;
        padding: 4px;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-close-drawer:hover {
        background: #f1f5f9;
        color: var(--color-text);
    }

    /* Transitions Alpine.js */
    .translate-y-full {
        transform: translateY(100%);
    }

    .translate-y-0 {
        transform: translateY(0);
    }

    .opacity-0 {
        opacity: 0;
    }

    .opacity-100 {
        opacity: 1;
    }

    .transition {
        transition-property: transform, opacity;
    }

    .ease-out {
        transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }

    .ease-in {
        transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
    }

    .duration-200 {
        transition-duration: 200ms;
    }

    .duration-150 {
        transition-duration: 150ms;
    }

    /* Drawer tags - styles spécifiques */
    .tag-drawer .module-drawer-body {
        flex: 1;
        overflow-y: auto;
    }

    .tag-drawer .tag-search-box {
        padding: 12px 0;
        border-bottom: 1px solid var(--color-border);
        margin-bottom: 12px;
    }

    .tag-drawer .tag-list {
        max-height: none;
        padding: 0;
    }
}

/* Hints et no results */
.search-hint,
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

.search-hint .material-symbols-outlined,
.no-results .material-symbols-outlined {
    font-size: 48px;
    margin-bottom: 12px;
    color: #cbd5e1;
}

.search-hint p,
.no-results p {
    font-size: 14px;
    margin: 0;
}

.no-results {
    text-align: center;
    padding: 30px 20px;
    color: var(--color-text-muted);
    font-size: 13px;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    overflow-y: auto;
    padding: 20px;
    background: var(--color-bg);
}

/* Editor header */
.editor-header {
    margin-bottom: 16px;
    background: var(--color-surface);
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.editor-header input {
    font-size: 16px;
    font-weight: 600;
    border: none;
    background: transparent;
    padding: 6px 10px;
    border-radius: 6px;
    width: 100%;
    color: var(--color-text);
}

.editor-header input:hover {
    background: #f1f5f9;
}

.editor-header input:focus {
    outline: none;
    background: #f1f5f9;
}


/* Coefficients bar */
.coefficients-bar {
    display: flex;
    gap: 12px;
    background: var(--color-surface);
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    align-items: center;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.coefficients-bar > label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.coef-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

.coef-label {
    font-size: 12px;
    color: var(--color-text-light);
}

.coef-value {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    background: white;
}

.coef-value:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ==================== BLOCS ==================== */
.blocks-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ==================== DRAG & DROP ==================== */
.drag-handle {
    cursor: grab;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    opacity: 0.5;
    transition: opacity 0.2s, background 0.2s;
    user-select: none;
    -webkit-user-select: none;
}

.drag-handle:hover {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Empêcher la sélection de texte pendant le drag */
.sortable-chosen,
.sortable-drag {
    user-select: none;
    -webkit-user-select: none;
}

.sortable-chosen * {
    user-select: none;
    -webkit-user-select: none;
}

/* Fallback pour le drag (élément cloné) */
.sortable-fallback {
    opacity: 0.9;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* Handle pour les blocs (fond sombre) */
.block-handle {
    color: rgba(255,255,255,0.6);
}

.block-handle:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Handle pour les UE */
.ue-handle {
    color: var(--color-text-muted);
}

.ue-handle:hover {
    background: var(--color-border);
    color: var(--color-text);
}

/* Handle pour les modules */
.module-handle {
    color: var(--color-text-muted);
}

.module-handle:hover {
    background: var(--color-border);
    color: var(--color-text);
}

/* États SortableJS */
.sortable-ghost {
    opacity: 0.4;
    background: var(--color-primary);
    border-radius: var(--radius);
    transition: none;
}

.sortable-chosen {
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 100;
    cursor: grabbing;
}

.sortable-drag {
    opacity: 1;
}

/* Ghost spécifique pour les blocs */
.block-card.sortable-ghost {
    min-height: 60px;
}

/* Ghost spécifique pour les UE */
.ue-card.sortable-ghost {
    min-height: 50px;
}

/* Ghost spécifique pour les modules */
.module-card.sortable-ghost {
    min-height: 40px;
}

/* Empêcher l'interférence avec le drop HTML5 natif pendant le drag SortableJS */
.ue-card[data-sortable-dragging="true"] {
    pointer-events: none;
}

.ue-card[data-sortable-dragging="true"] .ue-handle {
    pointer-events: auto;
}

/* Bloc cible lors du drag d'une UE */
.block-card.drop-target {
    outline: 2px dashed var(--color-primary);
    outline-offset: -2px;
    background: rgba(59, 130, 246, 0.03);
}

.block-card.drop-target .block-header {
    background: rgba(59, 130, 246, 0.15);
}

/* Pendant le drag d'une UE, montrer que les blocs sont des cibles */
body.dragging-ue .block-card {
    transition: outline 0.15s, background 0.15s;
}

body.dragging-ue .block-card .ue-list {
    min-height: 80px;
    background: rgba(59, 130, 246, 0.02);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    padding-bottom: 40px;
}

/* Zone de drop en fin de liste UE */
.ue-drop-zone {
    display: none;
    height: 8px;
    margin-top: 8px;
    border-radius: var(--radius);
    transition: all 0.15s;
}

body.dragging-ue .ue-drop-zone {
    display: block;
    height: 50px;
    background: rgba(59, 130, 246, 0.05);
    border: 2px dashed var(--color-primary);
    opacity: 0.6;
}

body.dragging-ue .block-card.drop-target .ue-drop-zone {
    opacity: 1;
    background: rgba(59, 130, 246, 0.1);
}

/* Bouton Accordéon */
.btn-accordion {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

.btn-accordion:hover {
    background: rgba(255,255,255,0.1);
}

.btn-accordion .material-symbols-outlined {
    transition: transform 0.2s;
}

.btn-accordion.open .material-symbols-outlined {
    transform: rotate(0deg);
}

.btn-accordion:not(.open) .material-symbols-outlined {
    transform: rotate(-90deg);
}

/* Style pour les UE */
.ue-header .btn-accordion {
    color: var(--color-text-muted);
}

.ue-header .btn-accordion:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.block-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.block-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.block-number {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    white-space: nowrap;
}

.block-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    background: transparent;
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
}

.block-title:hover {
    background: rgba(255,255,255,0.1);
}

.block-title:focus {
    outline: none;
    background: rgba(255,255,255,0.15);
}

.block-stats {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.block-stats span {
    background: rgba(255,255,255,0.1);
    padding: 3px 10px;
    border-radius: 20px;
}

.block-header .btn-icon {
    color: var(--color-text-muted);
}

.block-header .btn-icon:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.block-content {
    padding: 16px;
}

/* ==================== UE ==================== */
.ue-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ue-card {
    background: #f8fafc;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
}

.ue-card.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ue-card.selected .ue-header {
    background: #dbeafe;
}

.ue-card.drag-over {
    border-color: var(--color-success);
    background: #ecfdf5;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.ue-header {
    background: #e2e8f0;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Bouton de sélection UE */
.btn-select-ue {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-select-ue:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-primary);
}

.btn-select-ue.active {
    background: var(--color-primary);
    color: white;
}

.ue-number {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-light);
    white-space: nowrap;
    cursor: pointer;
}

.ue-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-dark-light);
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
}

.ue-title:hover {
    background: rgba(0,0,0,0.05);
}

.ue-title:focus {
    outline: none;
    background: rgba(0,0,0,0.05);
}

.ue-stats {
    font-size: 11px;
    color: var(--color-text-light);
    background: white;
    padding: 3px 10px;
    border-radius: 20px;
}

.ue-content {
    padding: 14px;
    cursor: pointer;
}

.ue-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    color: var(--color-text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
}

.ue-hint:hover {
    color: var(--color-primary);
}

.ue-hint .material-symbols-outlined {
    font-size: 16px;
}

/* ==================== MODULES ==================== */
.modules-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.module-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all 0.2s;
    overflow: hidden;
}

.module-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.module-card.unavailable {
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
    border-color: #fecaca;
}

/* Ligne 1 : Header du module */
.module-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    gap: 8px;
}

.module-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.module-header-row .btn-accordion {
    color: var(--color-text-muted);
}

.module-header-row .btn-accordion:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.module-code {
    background: #dbeafe;
    color: #1d4ed8;
    padding: 3px 8px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.module-name {
    font-weight: 500;
    color: var(--color-text);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.module-badge-unavailable {
    background: var(--color-danger);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Ligne 2 : Durées */
.module-durations-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 8px 12px 10px;
    padding-left: 16px;
    gap: 12px;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.module-durations-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    flex: 1;
    min-width: 0;
}

/* Desktop large : tout sur une ligne si possible */
@media (min-width: 1400px) {
    .module-durations-inputs {
        display: flex;
        flex-wrap: nowrap;
    }
    .duration-inline-item {
        flex: 1;
        min-width: 0;
    }
}

/* Tablette/Desktop moyen : grille 2x2 */
@media (min-width: 601px) and (max-width: 1399px) {
    .module-durations-inputs {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile : stack vertical avec inputs justifiés */
@media (max-width: 600px) {
    .module-durations-inputs {
        grid-template-columns: 1fr;
    }
    .duration-inline-input {
        width: 100%;
        flex: 1;
    }
    .duration-inline-row {
        width: 100%;
    }
}

.duration-inline-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    border-radius: 6px;
}

.duration-inline-label {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.duration-icon {
    font-size: 13px;
}

.duration-inline-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.duration-inline-input {
    width: 88px;
    padding: 4px 6px;
    font-size: 13px;
    text-align: center;
    border: none;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 4px 4px 0 0;
    background: #f8fafc;
    font-weight: 500;
    color: var(--color-text);
}

.duration-inline-input:focus {
    outline: none;
    border-bottom-color: var(--color-primary);
}

.duration-inline-input:hover {
    border-bottom-color: #94a3b8;
}

.duration-unit {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-right: 2px;
}

.duration-arrow {
    color: #059669;
    font-size: 10px;
}

.duration-calculated {
    color: #10b981;
    font-size: 11px;
    font-weight: 500;
}

.module-total-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    background: #ecfdf5;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 500;
    flex-shrink: 0;
}

.module-total-inline .total-raw {
    color: var(--color-text-light);
    min-width: 38px;
    text-align: right;
}

.module-total-inline .total-arrow {
    color: #059669;
    font-size: 10px;
}

.module-total-inline .total-formation {
    color: #059669;
    font-weight: 600;
    min-width: 38px;
}

/* Legacy - garder pour compatibilité */
.module-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    flex-wrap: wrap;
}

.module-header .btn-accordion {
    color: var(--color-text-muted);
}

.module-header .btn-accordion:hover {
    background: var(--color-border);
    color: var(--color-text);
}

/* Détails dépliables du module */
.module-details {
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid var(--color-border);
}

.module-detail-section {
    margin-bottom: 12px;
}

.module-detail-section:last-child {
    margin-bottom: 0;
}

.module-detail-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.module-detail-content {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.5;
    margin: 0;
}

.module-skills-list {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--color-text);
}

.module-skills-list li {
    margin-bottom: 2px;
}

.module-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.module-tag {
    padding: 3px 10px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    font-size: 11px;
    color: var(--color-text-light);
}

/* Legacy styles - garder pour compatibilité */
.module-durations {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    margin-left: 30px;
}

.module-total {
    flex-shrink: 0;
    font-size: 13px;
    background: #ecfdf5;
    color: #059669;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
}

/* ==================== ADD BUTTONS ==================== */
.btn-add-ue,
.btn-add-block,
.add-btn {
    background: white;
    border: 2px dashed var(--color-border-dark);
    color: var(--color-text-muted);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    margin-top: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-ue:hover,
.btn-add-block:hover,
.add-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: #eff6ff;
}

.add-form {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.add-form .form-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
}

.add-form .form-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ==================== SIDEBAR DROITE - RECAP ==================== */
.sidebar-right {
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.recap-header {
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
}

.recap-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.recap-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--color-text-light);
    margin-top: 2px;
}

.stat-card.highlight {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.stat-card.highlight .stat-value {
    color: #059669;
}

.stat-card-wide {
    grid-column: span 2;
}

/* Duration breakdown */
.duration-breakdown {
    margin-bottom: 20px;
}

.duration-breakdown h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: 12px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.breakdown-label {
    font-size: 11px;
    color: var(--color-text-light);
    min-width: 70px;
}

.breakdown-bar-container {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    border-radius: 3px;
    background: var(--color-primary);
}

.breakdown-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text);
    min-width: 45px;
    text-align: right;
}

/* Recap footer */
.recap-footer {
    padding: 16px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recap-footer .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
}

/* ==================== PAGE INDEX ==================== */
.page-index {
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
}

/* Bouton dark (couleur #202A3C) */
.btn-dark {
    background: #202A3C;
    color: white;
}

.btn-dark:hover {
    background: #1E293B;
}

/* Toolbar : onglets + recherche */
.index-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.index-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}

.index-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.index-tab:hover {
    color: var(--color-text);
}

.index-tab.active {
    background: white;
    color: var(--color-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-count {
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.index-tab.active .tab-count {
    background: #202A3C;
    color: white;
}

.tab-count.danger {
    background: var(--color-danger);
    color: white;
}

.index-search {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.index-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 20px;
}

.index-search input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    border: 2px solid var(--color-border);
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.2s;
    background: white;
}

.index-search input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Liste de maquettes avec header sticky */
.maquette-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.maquette-list-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 20px;
    position: sticky;
    top: 0;
    background: var(--color-bg);
    z-index: 10;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 4px;
}

.maquette-list-header .header-title {
    min-width: 300px;
    max-width: 400px;
}

.maquette-list-header .header-info {
    flex: 1;
}

.maquette-list-header .header-actions {
    flex-shrink: 0;
    text-align: right;
    min-width: 280px;
}

.maquette-card-h {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
    position: relative;
}

.maquette-card-h-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: var(--radius-lg);
}

.maquette-card-h:hover {
    box-shadow: var(--shadow-lg);
}

.maquette-card-h.trashed {
    opacity: 0.6;
    background: #fafafa;
}

.maquette-card-h.menu-open {
    z-index: 100;
}

.maquette-card-h-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 300px;
    max-width: 400px;
}

.maquette-card-h-title:hover {
    color: var(--color-primary);
}

.maquette-card-h-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
    min-width: 0;
}

.maquette-card-h-info .info-item {
    white-space: nowrap;
    min-width: 50px;
}

.maquette-card-h-info .info-item.highlight {
    color: #059669;
    font-weight: 500;
}

.maquette-card-h-info .info-item.muted {
    color: var(--color-text-muted);
}

.maquette-card-h-info .info-sep {
    color: var(--color-border-dark);
}

.maquette-card-h-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.maquette-card-h-secondary {
    position: relative;
    z-index: 100;
}

/* Dropdown menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 180px;
    z-index: 1000;
    padding: 4px;
}


.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    font-size: 13px;
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
    text-align: left;
}

.dropdown-item:hover {
    background: #f1f5f9;
}

.dropdown-item.danger {
    color: var(--color-danger);
}

.dropdown-item.danger:hover {
    background: #fef2f2;
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

/* Utilitaires responsive */
.btn-label {
    display: inline;
}

.hide-tablet {
    display: inline-flex;
}

.show-tablet {
    display: none;
}

/* Tablette large (< 1100px) : cacher les labels des boutons, garder les icônes */
@media (max-width: 1100px) {
    .maquette-card-h-actions .btn-label {
        display: none;
    }

    .maquette-card-h-actions .btn {
        padding: 6px 8px;
    }

    .maquette-list-header .header-actions {
        min-width: 180px;
    }
}

/* Tablette (< 910px) : infos sous le titre, actions en haut à droite */
@media (max-width: 910px) {
    .maquette-card-h-actions .hide-tablet {
        display: none;
    }

    .maquette-card-h-secondary .show-tablet {
        display: flex;
    }

    .maquette-list-header {
        display: none;
    }

    .maquette-card-h {
        flex-wrap: wrap;
        gap: 8px;
        position: relative;
        padding-right: 90px;
    }

    .maquette-card-h-title {
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    .maquette-card-h-info {
        flex-wrap: wrap;
        width: 100%;
    }

    .maquette-card-h-info .info-item {
        min-width: 0;
    }

    .maquette-card-h-actions {
        position: absolute;
        top: 12px;
        right: 12px;
    }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-light);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
}

.empty-state-icon {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.empty-state-hint {
    font-size: 13px;
    margin-top: 8px;
}

/* Responsive index */
@media (max-width: 768px) {
    .index-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .index-search {
        max-width: none;
    }
}


/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 20px;
}

.badge-danger {
    background: var(--color-danger);
    color: white;
}

/* ==================== FLOATING ACTION BUTTONS (FAB) ==================== */
.floating-buttons {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    z-index: 1500;
    padding: 0 20px;
    pointer-events: none;
}

/* Sur grand écran : boutons dans la navbar ou en haut */
.floating-buttons--desktop {
    display: flex;
    position: fixed;
    top: 70px;
    bottom: auto;
    left: 0;
    right: 0;
    z-index: 1500;
    padding: 0 20px;
    pointer-events: none;
    justify-content: space-between;
}

.fab {
    pointer-events: auto;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.fab:active {
    transform: scale(0.95);
}

.fab.active {
    background: var(--color-dark);
}

.fab .material-symbols-outlined {
    font-size: 24px;
}

.fab-left {
    position: absolute;
    left: 20px;
}

.fab-right {
    position: absolute;
    right: 20px;
}

/* ==================== SIDEBAR COLLAPSE (Desktop) ==================== */

/* Transition fluide des sidebars */
.sidebar-left,
.sidebar-right {
    transition: width 0.3s ease, min-width 0.3s ease, opacity 0.3s ease;
}

/* État réduit des sidebars sur desktop */
.sidebar-left.collapsed,
.sidebar-right.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border: none;
    opacity: 0;
}

/* Grille adaptative quand sidebars collapsed */
.app-layout.left-collapsed {
    grid-template-columns: 0 1fr 280px;
}

.app-layout.right-collapsed {
    grid-template-columns: 330px 1fr 0;
}

.app-layout.both-collapsed {
    grid-template-columns: 0 1fr 0;
}

/* ==================== DRAWER OVERLAY ==================== */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1600;
}

/* ==================== DRAWER CLOSE BUTTON ==================== */
.drawer-close {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.drawer-close:hover {
    background: var(--color-border);
    color: var(--color-text);
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1200px) {
    /* Cacher le toggle navbar sur petit écran (remplacé par boutons flottants) */
    .navbar-toggle,
    .navbar-toggle.visible {
        display: none;
    }

    .navbar-back {
        padding: 8px;
        left: 16px;
    }

    /* Afficher les boutons flottants */
    .floating-buttons {
        display: flex;
        justify-content: space-between;
    }

    /* Overlay visible quand drawer ouvert */
    .drawer-overlay[style*="display: block"],
    .drawer-overlay:not([style*="display: none"]):not([style=""]) {
        display: block;
    }

    /* Afficher le bouton de fermeture dans les drawers */
    .drawer-close {
        display: flex;
    }

    /* Layout passe en colonne simple - ignorer les classes collapsed */
    .app-layout,
    .app-layout.left-collapsed,
    .app-layout.right-collapsed,
    .app-layout.both-collapsed,
    .app-layout.two-columns {
        grid-template-columns: 1fr;
    }

    /* Sidebars deviennent des drawers */
    .sidebar-left,
    .sidebar-right {
        position: fixed;
        top: 56px;
        bottom: 0;
        width: 320px;
        max-width: 85vw;
        z-index: 1700;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    .sidebar-left {
        left: 0;
    }

    .sidebar-right {
        right: 0;
        left: auto;
        transform: translateX(100%);
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* Réinitialiser l'état collapsed sur mobile - ne pas cacher les sidebars */
    .sidebar-left.collapsed,
    .sidebar-right.collapsed {
        width: 320px;
        max-width: 85vw;
        overflow: visible;
        opacity: 1;
        border-left: 1px solid var(--color-border);
        border-right: 1px solid var(--color-border);
    }

    /* État ouvert des drawers */
    .sidebar-left.drawer-open,
    .sidebar-right.drawer-open {
        transform: translateX(0);
    }

    /* Header des sidebars en mode drawer */
    .sidebar-header,
    .recap-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* Fix liste résultats coupée en mobile */
    .search-results-list {
        padding-bottom: 120px;
    }

    /* Espace en bas pour les FABs ne bloquent pas le contenu */
    .main-content {
        padding-bottom: 100px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }

    /* Cacher le label du bouton retour en mobile */
    .navbar-back-label {
        display: none;
    }

    .page-index {
        padding: 20px 16px;
    }

    .editor-header input {
        min-width: auto;
        width: 100%;
    }

    .coefficients-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .coef-item {
        width: 100%;
        justify-content: space-between;
    }

    .coef-value {
        flex: 1;
        max-width: 120px;
    }

    .module-durations {
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
    }

    .module-total {
        text-align: center;
    }

    /* FABs plus petits sur mobile */
    .fab {
        width: 48px;
        height: 48px;
    }

    .fab .material-symbols-outlined {
        font-size: 22px;
    }

    /* Drawers plus larges sur mobile */
    .sidebar-left,
    .sidebar-right {
        width: 100%;
        max-width: 100vw;
    }
}

/* ==================== MODAL (nouvelle structure) ==================== */
/* Structure: .modal > .modal-overlay + .modal-content */
.modal:has(.modal-content) {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal:has(.modal-content) .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    z-index: 1;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Taille par défaut */
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
}

/* Petite modal (explicite) */
.modal-content.modal-content--sm {
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
}

/* Grande modal */
.modal-content.modal-content--lg {
    width: 95vw;
    height: 90vh;
    max-width: 1600px;
    max-height: 90vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

/* Header style warning (par défaut pour export modal) */
.modal-header--warning {
    background: #fef3c7;
}

.modal-header--warning h3 {
    color: #92400e;
}

.modal-header--warning .material-symbols-outlined {
    color: #f59e0b;
}

/* Header style primary (pour preview modal) */
.modal-header--primary {
    background: linear-gradient(135deg, #1E3A5F 0%, #2E5077 100%);
}

.modal-header--primary h3 {
    color: white;
}

.modal-header--primary .material-symbols-outlined {
    color: white;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-muted);
    line-height: 1;
}

.modal-header--primary .modal-close {
    color: rgba(255, 255, 255, 0.7);
}

.modal-header--primary .modal-close:hover {
    color: white;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-body--no-padding {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.modal-body p {
    margin: 0 0 16px;
    color: var(--color-text);
}

.modal-body-hint {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 8px;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
}

.modal-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.modal-error {
    color: var(--color-danger);
    font-size: 12px;
    margin-top: 8px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    background: #f8fafc;
    flex-shrink: 0;
}

/* Change sections in modal */
.change-section {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
}

.change-section h4 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    font-size: 13px;
}

.change-section ul {
    margin: 0;
    padding-left: 20px;
}

.change-section li {
    margin-bottom: 4px;
    font-size: 13px;
}

.change-section li small {
    color: var(--color-text-muted);
}

.change-section.danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.change-section.danger h4 {
    color: #dc2626;
}

.change-section.warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.change-section.warning h4 {
    color: #d97706;
}

.change-section.info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.change-section.info h4 {
    color: #2563eb;
}

/* ==================== PREVIEW CONTENT ====================*/

/* Stats du preview */
.preview-stats {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.preview-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.preview-stat.highlight {
    background: linear-gradient(135deg, #1E3A5F 0%, #2E5077 100%);
}

.preview-stat.highlight .preview-stat-value,
.preview-stat.highlight .preview-stat-label {
    color: white;
}

.preview-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-dark);
}

.preview-stat-label {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Conteneur du tableau */
.preview-table-container {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

/* Tableau de prévisualisation */
.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: white;
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    overflow: hidden;
}

.preview-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.preview-table th {
    background: linear-gradient(135deg, #1E3A5F 0%, #2E5077 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 12px 10px;
    text-align: left;
    border: none;
    white-space: nowrap;
}

.preview-table td {
    padding: 10px;
    border: 1px solid #e2e8f0;
    vertical-align: top;
}

.preview-table tr.row-alt td {
    background: #fafbfc;
}

.preview-table tr.row-unavailable td {
    background: #FEF3E2;
}

/* Cellules spéciales */
.preview-table .cell-block {
    background: #E8F4FD;
    font-weight: 700;
    color: #1E3A5F;
    text-align: center;
    vertical-align: middle;
    min-width: 120px;
}

.preview-table .cell-unit {
    background: #F5F9FC;
    font-weight: 500;
    vertical-align: middle;
    min-width: 140px;
}

.preview-table .cell-code {
    font-weight: 700;
    font-family: monospace;
    font-size: 11px;
    text-align: center;
    color: #1E3A5F;
}

.preview-table .cell-module {
    min-width: 180px;
}

.preview-table .cell-skills {
    min-width: 200px;
    max-width: 300px;
}

.preview-table .cell-skills ul {
    margin: 0;
    padding-left: 16px;
    font-size: 11px;
    color: var(--color-text-light);
}

.preview-table .cell-skills li {
    margin-bottom: 2px;
}

.preview-table .cell-duration {
    text-align: center;
    white-space: nowrap;
    font-family: monospace;
}

.preview-table .cell-bold {
    font-weight: 700;
}

.preview-table .cell-availability {
    text-align: center;
    font-weight: 600;
}

.preview-table .cell-availability.available {
    color: #27AE60;
}

.preview-table .cell-availability.unavailable {
    background: #FEF3E2;
    color: #92610E;
}

/* Ligne total */
.preview-table .row-total td {
    background: linear-gradient(135deg, #1E3A5F 0%, #2E5077 100%);
    color: white;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    border: none;
}

/* Loading et erreur */
.preview-loading,
.preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

.preview-error {
    color: var(--color-danger);
}

.preview-error .material-symbols-outlined {
    font-size: 48px;
}
