:root {
    --primary-blue: #0A3D62;
    --secondary-blue: #1E5A8E;
    --accent-red: #cf1b22;
    --light-blue: #E8F1F8;
    --cream: #FAF9F6;
    --text-dark: #1A2332;
    --text-light: #5A6C7D;
    --border-subtle: #D4DFE8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Work Sans', sans-serif;
    color: var(--text-dark);
    background-color: var(--cream);
    line-height: 1.6;
}

/* ── Navigation (identique à home.php) ── */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-subtle);
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

/* Logo */
.logo {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1.15;
    z-index: 1001;
    flex-shrink: 0;
}
.logo-abbr {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    color: var(--primary-blue);
    font-weight: 400;
    letter-spacing: -0.5px;
}
.logo-full {
    font-size: 0.68rem;
    color: var(--text-light);
    font-family: 'Work Sans', sans-serif;
    font-weight: 500;
    white-space: nowrap;
}

/* Nav links */
.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    align-items: center;
    flex-shrink: 1;
    min-width: 0;
}

.nav-links > li { position: relative; }

.nav-links > li > a,
.nav-links > li > span {
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    cursor: pointer;
    display: block;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.nav-links > li > a::after,
.nav-links > li > span::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 0; height: 2px;
    background: var(--accent-red);
    transition: width 0.3s ease;
}

.nav-links > li:hover > a,
.nav-links > li:hover > span { color: var(--secondary-blue); }

.nav-links > li:hover > a::after,
.nav-links > li:hover > span::after { width: 100%; }

.nav-links > li > span.active-nav { color: var(--accent-red); }
.nav-links > li > span.active-nav::after { width: 100%; }

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: 100%; left: 0;
    background: white;
    min-width: 250px;
    padding: 0.5rem 0;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(10,61,98,0.15);
    border: 1px solid var(--border-subtle);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.nav-links > li:hover .dropdown-menu {
    opacity: 1; visibility: visible; transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.dropdown-menu a:hover {
    background: var(--light-blue);
    border-left-color: var(--accent-red);
    padding-left: 1.75rem;
}

.category-icon {
    font-size: 0.75rem;
    margin-left: 0.25rem;
    opacity: 0.6;
    transition: transform 0.3s ease;
}
.nav-links > li:hover .category-icon { transform: rotate(180deg); }

/* Bouton connexion */
.login-btn {
    background: var(--accent-red);
    color: white !important;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Work Sans', sans-serif;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(199,62,29,0.3);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(199,62,29,0.4);
    background: #b51419;
    color: white !important;
}
.nav-links > li > a.login-btn::after { display: none; }

/* Mobile */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}
.mobile-menu-toggle span {
    width: 25px; height: 3px;
    background: var(--primary-blue);
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: white;
    padding: 3rem 3rem 2.5rem;
    margin-top: 80px;
    text-align: center;
}

.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    padding: 0.4rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
}


@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}


.hero h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p { 
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto; 
}


/* Tabs */
.tabs-container {
    background: white;
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 76px;
    z-index: 100;
}

.tabs {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 3rem;
    display: flex;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1.25rem 2rem;
    font-family: 'Work Sans', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover { color: var(--primary-blue); }
.tab-btn.active { color: var(--primary-blue); border-bottom-color: var(--accent-red); }
.tab-icon { font-size: 1.2rem; }

.container { max-width: 1400px; margin: 0 auto; padding: 3rem; }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.4s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.section-header { text-align: center; margin-bottom: 3rem; }

.section-title {
    font-family: 'DM Serif Display', serif;
    font-size: 2.2rem;
    color: var(--primary-blue);
    margin-bottom: 0.75rem;
}

.section-subtitle { color: var(--text-light); font-size: 1.05rem; }

/* Map Section */
.map-section {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
    align-items: start;
}

.map-container {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(10, 61, 98, 0.08);
}

.map-wrapper {
    width: 100%;
}

#france-map {
    width: 100%;
    height: 780px;
    border-radius: 12px;
    overflow: hidden;
}

/* Curseur et événements sur les départements */
.leaflet-overlay-pane svg {
    pointer-events: auto !important;
}
.leaflet-interactive {
    cursor: pointer !important;
    pointer-events: visiblePainted !important;
}

/* Leaflet tooltip style AMSU */
.leaflet-tooltip.dept-tooltip {
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    font-family: 'Work Sans', sans-serif;
    font-size: 0.85rem;
    box-shadow: 0 4px 16px rgba(10,61,98,0.25);
}
.leaflet-tooltip.dept-tooltip::before { border-top-color: var(--primary-blue); }

.leaflet-container { background: #F0F6FA; }
.leaflet-control-zoom a {
    color: var(--primary-blue) !important;
    border-color: var(--border-subtle) !important;
}
.leaflet-control-attribution { display: none; }

.map-wrapper object, .map-wrapper svg { width: 100%; height: 100%; }

.map-tooltip {
    position: absolute;
    background: var(--primary-blue);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) translateY(-100%);
    transition: opacity 0.2s;
    z-index: 100;
}

.map-tooltip.visible { opacity: 1; }
.tooltip-count { display: block; font-size: 0.8rem; opacity: 0.8; margin-top: 0.25rem; }

.map-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-light); }
.legend-color { width: 16px; height: 16px; border-radius: 4px; }
.legend-color.available { background: var(--secondary-blue); }
.legend-color.empty { background: var(--light-blue); }
.legend-color.selected { background: var(--accent-red); }
/* Dept Panel — overlay flottant sur la carte */
.dept-documents-panel {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(10, 61, 98, 0.08);
    max-height: 780px;
    overflow-y: auto;
    position: sticky;
    top: 140px;
}

.dept-documents-panel::-webkit-scrollbar { width: 4px; }
.dept-documents-panel::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.panel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-light);
}

.placeholder-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.5; }
.panel-placeholder h3 { font-size: 1rem; color: var(--primary-blue); margin-bottom: 0.4rem; }
.panel-placeholder p { font-size: 0.85rem; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-blue);
    margin-bottom: 1.5rem;
}

.panel-header h3 { font-size: 1.3rem; color: var(--primary-blue); }

.doc-count {
    background: var(--light-blue);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--secondary-blue);
    font-weight: 600;
}

.documents-list { display: flex; flex-direction: column; gap: 1rem; }

.dept-doc-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--light-blue);
    border-radius: 12px;
    transition: all 0.3s;
}

.dept-doc-item:hover { transform: translateX(5px); background: #d8e8f3; }
.dept-doc-icon { font-size: 2rem; }
.dept-doc-info { flex: 1; }
.dept-doc-info h4 { font-size: 0.95rem; color: var(--text-dark); margin-bottom: 0.25rem; }
.dept-doc-category { font-size: 0.8rem; color: var(--text-light); }

.dept-doc-actions {
    display: flex;
    gap: 0.5rem;
}

.dept-doc-actions a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
}

.dept-doc-actions a:hover { background: var(--primary-blue); transform: scale(1.1); }

.no-dept-docs {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.no-dept-docs span { font-size: 3rem; display: block; margin-bottom: 1rem; }

/* Filters */
.filters-bar {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    opacity: 0.5;
}

.search-box input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Work Sans', sans-serif;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--secondary-blue);
    box-shadow: 0 0 0 3px rgba(30, 90, 142, 0.1);
}

.clear-search {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-light);
    cursor: pointer;
}

.filters-group { display: flex; gap: 1rem; flex-wrap: wrap; }

.filter-select {
    padding: 0.9rem 1.25rem;
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: 'Work Sans', sans-serif;
    background: white;
    cursor: pointer;
    min-width: 180px;
    transition: all 0.3s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--secondary-blue);
}

/* Documents Grid */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.document-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(10, 61, 98, 0.06);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.document-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(10, 61, 98, 0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: var(--light-blue);
}

.doc-type {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.5rem;
    background: white;
}

.doc-type.type-pdf { background: #fef2f2; }
.doc-type.type-doc { background: #eff6ff; }
.doc-type.type-excel { background: #f0fdf4; }
.doc-type.type-image { background: #fefce8; }

.doc-location {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.doc-location.national { color: var(--secondary-blue); font-weight: 600; }

.card-body { padding: 1.5rem; flex: 1; }

.doc-title {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.doc-description {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.doc-category {
    background: var(--light-blue);
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
    color: var(--secondary-blue);
    font-weight: 500;
}

.doc-date { color: var(--text-light); }

.card-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

.btn-view, .btn-download {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-view {
    background: var(--light-blue);
    color: var(--primary-blue);
}

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

.btn-download {
    background: var(--accent-red);
    color: white;
}

.btn-download:hover { background: #a01519; }

/* No Results */
.no-results, .no-documents {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    grid-column: 1 / -1;
}

.no-results-icon, .no-docs-icon { font-size: 4rem; margin-bottom: 1.5rem; opacity: 0.6; }
.no-results h3, .no-documents h3 { font-size: 1.4rem; color: var(--primary-blue); margin-bottom: 0.5rem; }
.no-results p, .no-documents p { color: var(--text-light); margin-bottom: 1.5rem; }

.btn-reset-filters {
    padding: 0.75rem 1.5rem;
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-reset-filters:hover { background: #a01519; }

/* Footer */
footer {
    background: var(--primary-blue);
    color: white;
    padding: 3rem 3rem 2rem;
    margin-top: 5rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    font-weight: 400;
}

.footer-section p,
.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    line-height: 2;
    font-size: 0.95rem;
}

.footer-section a:hover {
    color: white;
    text-decoration: underline;
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}
/* ── Notes grid ── */
.notes-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.note-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 4px 20px rgba(10,61,98,0.07);
    border-left: 4px solid var(--secondary-blue);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.note-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(10,61,98,0.12); }

.note-card-meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem;
}
.note-card-date {
    color: var(--secondary-blue); font-size: 0.78rem;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.note-card-cat {
    background: var(--light-blue); color: var(--primary-blue);
    font-size: 0.75rem; font-weight: 600; padding: 2px 10px; border-radius: 20px;
}
.note-card-dept { color: var(--text-light); font-size: 0.8rem; }
.note-card-title {
    color: var(--primary-blue); font-size: 1.1rem;
    font-weight: 700; line-height: 1.3; margin: 0;
}
.note-card-excerpt { color: var(--text-light); font-size: 0.92rem; line-height: 1.65; margin: 0; }
.note-card-full {
    border-top: 1px solid var(--border-subtle); padding-top: 0.85rem;
    color: var(--text-dark); font-size: 0.92rem; line-height: 1.75;
}
.note-card-full * { max-width: 100%; }

/* Responsive nav */
@media (max-width: 1200px) {
    .logo-full { display: none; }
}

/* Mobile */
@media (max-width: 1024px) {
    .map-section { grid-template-columns: 1fr; }
    .dept-documents-panel { min-height: auto; }
}

@media (max-width: 968px) {
    .nav-container { padding: 1rem 1.5rem; }
    .mobile-menu-toggle { display: flex; }
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        flex-direction: column;
        padding: 5rem 2rem 2rem;
        gap: 0;
        transform: translateX(100%);
        transition: transform 0.3s;
    }
    .nav-links.active { transform: translateX(0); }
    .nav-links > li { border-bottom: 1px solid var(--border-subtle); }
    .nav-links > li > a, .nav-links > li > span { padding: 1rem 0; }
    .dropdown-menu { position: static; box-shadow: none; opacity: 1; visibility: visible; transform: none; display: none; }
    .nav-links > li.mobile-dropdown-open .dropdown-menu { display: block; }
    
    .hero { flex-direction: column; padding: 4rem 1.5rem 3rem; }
    .hero h1 { font-size: 2rem; }
    .hero-visual { display: none; }
    
    .tabs { padding: 0 1.5rem; }
    .tab-btn { padding: 1rem; font-size: 0.9rem; }
    .tab-text { display: none; }
    
    .container { padding: 2rem 1.5rem; }
    .section-title { font-size: 1.8rem; }
    
    .filters-bar { flex-direction: column; }
    .search-box { min-width: 100%; }
    .filters-group { width: 100%; }
    .filter-select { flex: 1; min-width: auto; }
    
    .documents-grid { grid-template-columns: 1fr; }
    
    .footer-content { grid-template-columns: 1fr; gap: 2rem; }
    .footer-bottom { flex-direction: column; gap: 1rem; text-align: center; }
}
