/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; }
body {
    background-color: #f0f2f5;
    font-family: 'Inter', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
}

/* === CONTENEUR A4 (impression fidèle) === */
.a4-container {
    width: 210mm;
    min-height: 297mm;
    background: white;
    margin: 2rem auto;
    padding: 2rem 2.5rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
    border-radius: 6px;
    overflow: hidden;
}

/* === GRILLE DE CARTES PAR MATIÈRE === */
.grid-cards > div {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem;
    background-color: #ffffff;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.grid-cards > div:hover {
    box-shadow: 0 2px 8px rgba(30,58,138,0.10);
    transform: translateY(-1px);
}
.grid-cards h4 {
    font-weight: 700;
    color: #1e3a8a;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.grid-cards ul {
    list-style-type: disc;
    list-style-position: inside;
    font-size: 0.75rem;
    color: #374151;
}
.grid-cards li {
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

/* === ENCADRÉ FOURNITURES GÉNÉRALES === */
.general-supplies {
    background: linear-gradient(135deg, #f9fafb 0%, #f0f4ff 100%);
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

/* === BANDEAUX DIAGONAUX === */
.ribbon-container { position: relative; overflow: hidden; }
.ribbon-small {
    position: absolute; top: 18px; right: -50px; width: 200px;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white; padding: 4px 0;
    font-size: 0.55rem; font-weight: bold; text-transform: uppercase;
    transform: rotate(45deg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10; text-align: center; line-height: 1.2;
    pointer-events: none;
}
.ribbon-large {
    position: absolute; top: 60px; right: -100px; width: 400px;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white; padding: 8px 0;
    font-size: 1.1rem; font-weight: bold; text-transform: uppercase;
    transform: rotate(45deg);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 50; text-align: center; line-height: 1.2;
    pointer-events: none;
}

/* === ONGLETS & NAVIGATION === */
.main-tab-btn, .class-btn, .disc-btn {
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    outline: none;
}
.class-btn:hover, .disc-btn:hover {
    background-color: rgba(255,255,255,0.7);
}

/* === LÉGENDE DES BANDEAUX === */
.ribbon-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    color: #7f1d1d;
    margin-bottom: 0.5rem;
    align-items: center;
}
.ribbon-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.ribbon-legend .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #dc2626;
    display: inline-block;
    flex-shrink: 0;
}

/* === ANNÉE SCOLAIRE BANDEAU === */
.school-year-banner {
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

/* === NAVIGATION COLLANTE (STICKY) === */
.sticky-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #f0f2f5;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    transition: box-shadow 0.3s ease;
}
.sticky-nav nav {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* === ANIMATION FADE-IN DES CONTENUS === */
.class-content, .main-content {
    animation: fadeIn 0.25s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* === BARRE DE RECHERCHE === */
.search-container {
    position: relative;
    max-width: 210mm;
    margin: 1rem auto;
}
.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
    background-color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}
.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    width: 1.25rem;
    height: 1.25rem;
}

/* === CHECKBOXES & LISTE DE COURSES === */
ul.interactive-list {
    list-style-type: none;
    padding-left: 0;
}
ul.interactive-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}
ul.interactive-list li:hover {
    background-color: #f3f4f6;
}
ul.interactive-list li label {
    cursor: pointer;
    flex: 1;
    line-height: 1.4;
    transition: all 0.2s ease;
}
ul.interactive-list li input[type="checkbox"] {
    margin-top: 0.2rem;
    cursor: pointer;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #1e3a8a;
    flex-shrink: 0;
}
/* Style quand la case est cochée */
ul.interactive-list li.item-checked label {
    text-decoration: line-through;
    color: #9ca3af;
}

/* === BOUTON COPIER & TOAST === */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.copy-btn:hover {
    background-color: #e5e7eb;
    color: #111827;
}
.copy-btn svg {
    width: 1rem;
    height: 1rem;
}
#toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: #10b981;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 500;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}
#toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Surlignage de recherche */
.highlight {
    background-color: #fef08a;
    padding: 0 2px;
    border-radius: 2px;
}

/* === RESPONSIVE MOBILE (< 800px) === */
@media (max-width: 800px) {
    .a4-container {
        width: 100%;
        min-height: auto;
        margin: 0;
        padding: 1rem;
        box-shadow: none;
        border-radius: 0;
    }
    .grid-cards {
        grid-template-columns: 1fr !important;
    }
    .general-supplies .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    nav.flex.space-x-2,
    nav.flex.flex-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .class-btn, .disc-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* === IMPRESSION === */
@media print {
    body { background-color: white; }
    .a4-container {
        margin: 0; padding: 0;
        box-shadow: none; border-radius: 0;
        width: 100%;
    }
    .print-hidden { display: none !important; }
    .class-content { page-break-after: always; }
    .grid-cards > div:hover { box-shadow: none; transform: none; }
    .ribbon-legend { border: 1px solid #999; }
}
