﻿/* ===================================
   VARIABLES – PALETTE OFFICIELLE
   =================================== */
:root {
    --primary-1: #7d6c93;   /* prune/gris */
    --primary-2: #e5a275;   /* ocre rosé */
    --secondary: #0f5f73;   /* bleu/vert assombri pour contraste */
    --light-1: #f3f3ee;
    --white: #ffffff;
    --focus-ring: #ffbf47;

    --text-dark: #2b2b2b;
    --text-light: #ffffff;

    --header-height: 62px;
    --header-height-mobile: 52px;

    --radius: 10px;
    --shadow: 0 3px 10px rgba(0,0,0,0.12);
}

/* ===================================
   GLOBAL
   =================================== */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--light-1);
    color: var(--text-dark);
    line-height: 1.6;
}

a {
    color: var(--secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    text-decoration-thickness: 2px;
}

a:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

body.nav-open {
    overflow: hidden;
}

.nav-backdrop {
    display: none;
}

.nav-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2190;
    pointer-events: none;
}

/* ===================================
   HEADER & NAVIGATION
   =================================== */
header {
    background: var(--primary-1);
    color: var(--text-light);
    padding: 0;
    height: var(--header-height);
    position: relative;
    z-index: 1200;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    box-shadow: var(--shadow);
    overflow: visible;
}

/* Garde une hauteur identique sur toutes les pages */
header,
.viewer-header {
    min-height: var(--header-height);
}

.top-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: 2px solid var(--white);
    color: var(--white);
    font-weight: bold;
    border-radius: 8px;
    padding: 8px 12px;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 14px;
    align-items: center;
    justify-content: center;
    overflow-x: visible;
    width: 100%;
}

.nav-menu li a {
    color: var(--white);
    font-weight: bold;
    font-size: 1.1rem;
    text-decoration: none;
    transition: color 0.2s ease, text-shadow 0.15s ease;
}

.nav-menu li a:hover {
    color: #f3cbb0;
    text-decoration: none;
}

.nav-menu li a.active,
.nav-menu li a[aria-current="page"] {
    color: #f3cbb0;
}

.nav-menu li a:active {
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.nav-menu li {
    white-space: nowrap;
}

.nav-menu li a:focus-visible {
    color: #f3cbb0;
    outline: none;
}

.nav-toggle:focus,
.nav-toggle:focus-visible {
    outline: 3px solid var(--focus-ring);
    border-radius: 4px;
}

.logo-right {
    margin-left: auto;
}

/* LOGO À DROITE DU MENU */
.logo-right img {
    height: 38px;
    width: auto;
}

@media (max-width: 960px), screen and (hover: none) and (pointer: coarse) and (max-device-width: 932px) {
    header {
        height: var(--header-height-mobile);
    }

    header,
    .viewer-header {
        min-height: var(--header-height-mobile);
    }

    .logo-right img {
        height: 30px;
    }

    .nav-menu {
        gap: 12px;
        font-size: 0.9rem;
    }
}

/* ===================================
   MENU DÉROULANT WEBSIG
   =================================== */
.dropdown {
    position: relative;
}

.dropdown input[type="checkbox"] {
    display: none;
}

.dropbtn {
    background: transparent;
    border: 0;
    color: var(--white);
    font-weight: bold;
    cursor: pointer;
    display: inline-block;
    padding: 5px 0;
    font: inherit;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    min-width: 160px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    margin-top: 8px;
    z-index: 9999;
    overflow: hidden;
}

.auth-note {
    background: #fff7e6;
    border-left: 4px solid #b36b00;
    padding: 12px 14px;
    border-radius: 8px;
}

.auth-only[hidden] {
    display: none !important;
}

.admin-only[hidden] {
    display: none !important;
}

.dropdown-content a {
    padding: 12px 16px;
    display: block;
    color: var(--text-dark);
}

.dropdown-content a:hover {
    background: var(--light-1);
}

.dropdown.open .dropdown-content {
    display: block;
}

/* ===================================
   HERO – texte au-dessus / fond bleu / image arrondie
   =================================== */

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 20px 40px 20px;
    gap: 25px;
    text-align: center;

    /* Fond dégradé */
    background: linear-gradient(to right, #66537f, #245f6f);
    color: var(--white);
}

.hero-text {
    background: rgba(0, 0, 0, 0.2);
    padding: 14px 18px;
    border-radius: 12px;
    width: 100%;
    max-width: 1100px;
    box-sizing: border-box;
}

.hero-text h1 {
    font-size: 2.4rem;
    margin: 0;
    font-weight: bold;
    color: var(--white);
}

.hero-text p {
    font-size: 1.3rem;
    margin-top: 8px;
    color: var(--white);
}

.hero-text--with-logo {
    position: relative;
    display: block;
    padding-left: 150px;
    padding-right: 150px;
}

.hero-welcome-content {
    max-width: 760px;
    margin: 0 auto;
}

.hero-welcome-logo {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0;
}

.hero-welcome-logo--left {
    left: 16px;
    right: auto;
}

.hero-welcome-logo img {
    width: 120px;
    max-width: 120px;
    height: auto;
    display: block;
}

.hero-mice-layout {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(110px, 140px) 1fr minmax(110px, 140px);
    gap: 12px;
    align-items: stretch;
}

.hero-mice-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hero-mice-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 16px;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16);
}

.hero-mice-card h3 {
    margin: 0;
    font-size: 2rem;
    line-height: 1;
    color: #ffffff;
}

.hero-mice-card p {
    margin: 6px 0 0;
    font-size: 0.95rem;
    color: #ffffff;
}

.hero-image {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.hero-image img {
    width: 100%;
    border-radius: 25px;
    object-fit: cover;
    display: block;
    box-shadow: var(--shadow);
}

/* ===================================
   CONTENU
   =================================== */

.info-content {
    margin: auto;
    padding: 25px 15px;
}

.card-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: 0.2s;
}

.card:hover {
    transform: translateY(-4px);
}

.card h3 {
    margin-top: 0;
    color: var(--primary-1);
}

.map-shell {
    display: block;
}

.map-panel {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.map-panel--intro {
    padding: 20px;
}

.map-panel--canvas {
    padding: 16px;
}

.map-note {
    margin: 0;
    max-width: 420px;
}

.map-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 16px;
}

.map-toolbar h2 {
    margin: 0 0 8px;
}

.map-toolbar-text {
    margin: 0;
}

.map-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.map-route-status {
    margin: 0;
    font-weight: 600;
    color: var(--secondary);
}

.map-route-status.is-error {
    color: #9f2d2d;
}

.map-action {
    border: 0;
    border-radius: 999px;
    background: var(--secondary);
    color: var(--white);
    padding: 10px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.map-action:hover {
    background: #0b4b5b;
}

.map-action:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.leaflet-map {
    height: 76vh;
    min-height: 620px;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #d7e3ea;
}

.leaflet-control-layers {
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.leaflet-control-layers-expanded {
    padding: 12px 14px;
}

.map-legend {
    background: rgba(255, 255, 255, 0.96);
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    max-width: 220px;
}

.map-legend h3 {
    margin: 0 0 10px;
    font-size: 1rem;
    color: var(--primary-1);
}

.legend-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-item img {
    max-width: 100%;
    height: auto;
    border: 1px solid #d9d5cc;
    border-radius: 6px;
    background: #fff;
}

/* ===================================
   FOOTER
   =================================== */
footer {
    background: var(--primary-2);
    padding: 20px;
    text-align: center;
    color: var(--text-dark);
    margin-top: 40px;
}

/* ===================================
   RESPONSIVE NAVIGATION
   =================================== */
@media (max-width: 960px), screen and (hover: none) and (pointer: coarse) and (max-device-width: 932px) {
    .top-nav {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: relative;
        z-index: 2200;
    }

    .nav-menu {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        right: auto;
        margin: 0;
        padding: 72px 14px 20px;
        flex-direction: column;
        gap: 4px;
        align-items: stretch;
        width: min(320px, 86vw);
        background: rgba(125, 108, 147, 0.98);
        border-radius: 0 14px 14px 0;
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
        transform: translateX(-108%);
        transition: transform 0.24s ease;
        z-index: 2201;
        overflow-y: auto;
        pointer-events: none;
    }

    .nav-menu.open {
        transform: translateX(0);
        pointer-events: auto;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu li a {
        display: block;
        width: 100%;
        padding: 10px 8px;
        pointer-events: auto;
        cursor: pointer;
    }

    .logo-right {
        margin-left: 0;
    }

    .dropdown-content {
        position: static;
        margin-top: 6px;
        min-width: 200px;
    }

    .map-shell {
        display: block;
    }

    .map-toolbar {
        flex-direction: column;
    }

    .leaflet-map {
        height: 60vh;
        min-height: 360px;
    }

    .hero-text--with-logo {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding-left: 0;
        padding-right: 0;
    }

    .hero-welcome-content {
        order: 1;
    }

    .hero-welcome-logo--left {
        order: 0;
    }

    .hero-welcome-logo {
        position: static;
        transform: none;
        margin-top: 0;
        order: 2;
    }

    .hero-welcome-logo img {
        width: 100px;
        max-width: 100px;
    }

    .hero-mice-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .hero-mice-col {
        flex-direction: row;
        gap: 10px;
    }

    .hero-mice-card {
        min-height: 84px;
    }
}

@media (max-width: 700px) {
    .profil-grid {
        grid-template-columns: 1fr;
    }
}


/* ===================================
   PAGES INFO (aide, qui-sommes-nous, contact)
   =================================== */
.hero--small {
    padding: 30px 20px;
    min-height: unset;
}

.info-content {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

.info-content h2 {
    color: var(--primary-1);
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 0.4rem;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--light-1);
}

.info-content p,
.info-content li {
    line-height: 1.75;
    color: var(--text-dark);
}

.info-content a {
    color: var(--secondary);
}

.info-content ul {
    padding-left: 1.4em;
}

.info-content .card {
    margin: 22px 0;
    border: 1px solid #dfe6ee;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.info-content .card h2 {
    margin-top: 0;
}

.contact-link {
    display: inline-block;
    margin: 6px 0 16px;
    padding: 10px 20px;
    background: var(--primary-1);
    color: var(--white) !important;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: bold;
    transition: background 0.2s;
}

.contact-link:hover {
    background: var(--secondary);
}

.info-content table {
    overflow-x: auto;
}

.info-content table th,
.info-content table td {
    word-break: break-word;
    overflow-wrap: break-word;
}

.site-footer {
    background: var(--text-dark);
    color: rgba(255,255,255,0.75);
    padding: 20px 0;
    text-align: center;
    font-size: 0.88rem;
    margin-top: auto;
}

.site-footer a {
    color: var(--primary-2);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* ===================================
   PAGE D'ACCUEIL – SÉLECTION PROFIL
   =================================== */
.profil-section {
    padding: 38px 0 50px;
    background: var(--light-1);
}

.profil-heading {
    text-align: center;
    font-size: 1.8rem;
    color: var(--primary-1);
    margin: 0 0 12px;
}

.profil-subtext {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 40px;
    color: var(--text-dark);
    font-size: 1.05rem;
    line-height: 1.6;
}

.profil-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.profil-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 36px 20px 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    color: var(--white);
}

.profil-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.2);
    text-decoration: none;
}

.profil-card h3 {
    margin: 16px 0 10px;
    font-size: 1.25rem;
    color: var(--white);
}

.profil-card p {
    font-size: 0.9rem;
    flex-grow: 1;
    color: rgba(255,255,255,0.88);
    line-height: 1.55;
    margin: 0 0 14px;
}

.profil-icon {
    width: 68px;
    height: 68px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profil-icon svg {
    width: 34px;
    height: 34px;
    stroke: var(--white);
}

.profil-badge {
    display: inline-block;
    padding: 4px 14px;
    background: rgba(255,255,255,0.22);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: bold;
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.4);
    letter-spacing: 0.03em;
}

.profil-public      { background: linear-gradient(135deg, #0f5f73, #0e7a8e); }
.profil-collectivite { background: linear-gradient(135deg, #4a6fa5, #3558a0); }
.profil-association { background: linear-gradient(135deg, #5a9e6b, #4a8c5a); }
.profil-admin       { background: linear-gradient(135deg, #7d6c93, #65567e); }

/* Carte verrouillée (profil non autorisé pour la session active) */
.profil-card--locked {
    opacity: 0.45;
    filter: grayscale(60%);
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    box-shadow: var(--shadow) !important;
}
.profil-card--locked .profil-badge {
    background: rgba(0,0,0,0.25);
    border-color: rgba(255,255,255,0.2);
}


/* ===================================
   PAGE D'ACCUEIL – SECTIONS SECONDAIRES
   =================================== */
.qui-section {
    padding: 50px 0;
    background: var(--white);
}

.contact-section {
    padding: 50px 0;
    background: var(--light-1);
}

.qui-section h2,
.contact-section h2 {
    color: var(--primary-1);
    font-size: 1.6rem;
    margin: 0 0 16px;
}

.qui-section p,
.contact-section p {
    line-height: 1.7;
    max-width: 800px;
}

/* ===================================
   PAGE DE CONNEXION
   =================================== */
.login-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #66537f, #245f6f);
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    padding: 44px 40px;
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    margin: 0 0 6px;
    color: var(--primary-1);
    font-size: 1.7rem;
    text-align: center;
}

.login-subtitle {
    text-align: center;
    color: #666;
    margin: 0 0 28px;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

/* ===================================
   DOCUMENTATION BUTTON
   =================================== */
.documentation-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px 0px 20px;
    background: var(--light-1);
    min-height: auto;
}

.btn-documentation {
    display: inline-block;
    padding: 18px 48px;
    background: linear-gradient(135deg, var(--primary-1), #8b7aa3);
    color: var(--text-light);
    text-decoration: none;
    border-radius: 16px;
    font-weight: 600;
    font-size: 1.05rem;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 6px 20px rgba(125, 108, 147, 0.35);
    border: none;
    letter-spacing: 0.3px;
}

.btn-documentation:hover {
    background: linear-gradient(135deg, var(--primary-2), #f0b589);
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(229, 162, 117, 0.4);
}

.btn-documentation:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(125, 108, 147, 0.3);
}

.btn-documentation:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
    border-radius: 16px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
    background: var(--white);
}

.form-group input:focus {
    border-color: var(--primary-1);
    outline: none;
    box-shadow: 0 0 0 3px rgba(125,108,147,0.15);
}

.btn-login {
    width: 100%;
    padding: 13px;
    background: var(--primary-1);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    margin-top: 6px;
}

.btn-login:hover {
    background: #65567e;
}

.btn-login:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.login-error {
    display: none;
    background: #fdecea;
    border-left: 4px solid #c0392b;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    color: #7d2b2b;
    font-size: 0.92rem;
}

.login-error.visible {
    display: block;
}

.login-back {
    display: block;
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
}

/* ===================================
   PAGES PROFIL – LAYOUT VIEWER
   =================================== */
html.viewer-html,
body.viewer-body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.viewer-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    padding: 0;
    box-sizing: border-box;
    z-index: 2100;
    background: var(--primary-1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    overflow: visible;
    isolation: isolate;
}

.viewer-header .top-nav {
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    gap: 12px;
}

.viewer-header .nav-menu {
    flex-wrap: nowrap;
    gap: 18px;
    overflow-x: auto;
}

.viewer-header .logo-right img {
    height: 38px;
}

.viewer-main {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.mviewer-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

@media (max-width: 960px), screen and (hover: none) and (pointer: coarse) and (max-device-width: 932px) {
    .login-card {
        padding: 30px 24px;
    }

    .viewer-header {
        height: var(--header-height-mobile);
    }

    .viewer-main {
        top: var(--header-height-mobile);
    }

    .viewer-header .top-nav {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        padding: 0 12px;
    }

    .viewer-header .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        position: relative;
        z-index: 2200;
    }
}
