/* ==========================================================================
   FEUILLE DE STYLE COMMUNE — INTRANET MAIRIE DE SURY-LE-COMTAL
   Fichier : /css/style.css
   Centralise toutes les variables CSS (:root) et les composants partagés.
   Pour modifier le thème de tout l'intranet, changez simplement les valeurs
   dans la section 1 et 2 ci-dessous.
   ========================================================================== */

/* Google Fonts - Poppins */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");

:root {
    /* === 1. COULEURS PRINCIPALES (Identité Mairie - Vert Sury) === */
    --main-1: #6b7e62;
    --main-1-rgb: 107, 126, 98;
    --main-2: #455a3d;          /* Vert foncé (titres, dégradés, états actifs) */
    --main-3: #939a79;          /* Vert clair intermédiaire */
    --main-4: #eef2eb;          /* Vert très pâle (fonds de badges, survols doux) */
    --main-hover: #55664d;      /* Survol des boutons principaux */
    --selection-bg: rgba(var(--main-1-rgb), 0.25);

    /* === 2. COULEURS SECONDAIRES (Marron / Terre) === */
    --secondary-1: #7e6b62;
    --secondary-1-rgb: 126, 107, 98;
    --secondary-2: #ffffff;     /* Surface blanche (cartes, modales, widgets) */

    /* === 3. ARRIÈRE-PLANS & SURFACES === */
    --bg-1: #f4f7f6;            /* Fond général des pages de l'intranet */
    --bg-2: #f8fafc;            /* Fond secondaire (champs, entêtes de tableaux) */
    --bg-3: #f1f5f9;            /* Fond tertiaire (boutons neutres, pilules radio) */
    --bg-finder: #f6f5f0;       /* Fond barre de recherche */
    --bg-card: var(--secondary-2);
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --bg-code: #23241f;

    /* === 4. TYPOGRAPHIE & TEXTES === */
    --font-main: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --text-dark: #2c3e50;       /* Texte principal */
    --text-grey: #64748b;       /* Texte secondaire / sous-titres / icônes */
    --text-muted: #94a3b8;      /* Texte discret / placeholders */
    --text-white: #ffffff;
    --text-code: #f8f8f2;

    /* === 5. BORDURES, OMBRES & RAYONS === */
    --border-color: #e2e8f0;
    --border-input: #cbd5e1;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px rgba(var(--main-1-rgb), 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 15px;

    /* === 6. COULEURS SÉMANTIQUES (Statuts, Alertes, Notifications) === */
    --success: #27ae60;
    --success-dark: #3c763d;
    --success-bg: #dff0d8;
    --success-border: #d6e9c6;

    --danger: #e74c3c;
    --danger-dark: #a94442;
    --danger-bg: #fee2e2;
    --danger-border: #fca5a5;

    --warning: #f39c12;
    --warning-dark: #d68910;
    --warning-bg: #fef3c7;
    --warning-border: #fde68a;

    --info: #3498db;
    --info-dark: #2980b9;
    --info-bg: #e0f2fe;
    --info-border: #bae6fd;

    /* === 7. ALIAS DE COMPATIBILITÉ GLOBALE (Tous les modules de l'intranet) === */
    --couleur-principale: var(--main-1);
    --couleur-principale-rgb: var(--main-1-rgb);
    --couleur-secondaire: var(--secondary-1);
    --couleur-tertiaire: var(--text-grey);
    --couleur-hover: var(--main-hover);
    --vert-fonce: var(--main-1);
    --vert-claire: var(--main-3);
    --sury-green: var(--main-1);
    --sury-green-light: var(--main-4);
    --primary-color: var(--main-1);
    --primary-hover: var(--main-2);
    --primary: var(--main-1);
    --primary-dark: var(--main-2);
    --primary-light: var(--main-4);
    --bg-body: var(--bg-1);
    --bg-light: var(--bg-2);
    --bg-color: var(--bg-1);
    --app-bg: var(--bg-1);
    --input-bg: var(--bg-2);
    --text-light: var(--text-grey);
    --text-color: var(--text-dark);
    --color-white: var(--secondary-2);
    --color-light: var(--bg-3);
    --color-black: var(--text-dark);
    --color-red: var(--danger);
    --color-blue: var(--info);
    --color-gray: var(--text-grey);
    --color-grayish: var(--border-color);
    --error-color: var(--danger);
    --success-color: var(--success);
    --warning-color: var(--warning);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*,
::before,
::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Scrollbar personnalisée */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--main-1) rgba(255, 255, 255, 0.4);
}

*::-webkit-scrollbar {
    width: 12px;
}

*::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.4);
}

*::-webkit-scrollbar-thumb {
    background-color: var(--main-1);
    border-radius: 20px;
    border: 3px solid rgba(255, 255, 255, 0.4);
}

::selection {
    background: var(--selection-bg);
}

body {
    min-height: 100%;
    background: var(--bg-1);
    color: var(--text-dark);
    font-family: var(--font-main);
}

a:-webkit-any-link {
    color: var(--main-1);
}

.main {
    padding: 24px;
    margin: 0;
    height: calc(100dvh - 70px);
    width: 100%;
    position: fixed;
    top: 70px;
    left: 0;
    overflow-y: auto;
}

@supports (height: -moz-calc(100dvh - 70px)) {
    .main {
        height: -moz-calc(100dvh - 70px);
    }
}

hr {
    margin: 10px 0;
    height: 5px;
    border: 0;
    background: var(--secondary-1);
    border-radius: var(--radius-lg);
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   TYPOGRAPHIE COMMUNE
   ========================================================================== */
h1 {
    color: var(--main-1);
    font-size: 28px;
    margin: 15px 0;
    text-transform: uppercase;
}

h2 {
    color: var(--secondary-1);
    font-size: 22px;
    margin: 15px 0;
    text-transform: uppercase;
}

h2 > span {
    color: var(--main-1);
    font-size: 25px;
    vertical-align: top;
}

/* ==========================================================================
   GRILLES, WIDGETS & CARTES COMMUNES
   ========================================================================== */
.dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media screen and (min-width: 768px) {
    .dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
}

.widget {
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.widget h2 {
    margin-top: 0;
}

/* ==========================================================================
   BARRES DE FILTRES & BOUTONS D'ACTION (Mutualisés depuis les 8 modules)
   ========================================================================== */
.btn {
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
    padding-bottom: 20px;
    display: flex;
    justify-content: space-evenly;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 10px;
}

.filtre {
    margin: 0 auto;
    padding-bottom: 20px;
    display: flex;
    justify-content: flex-start;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 10px;
    position: relative;
}

.btn-filtre {
    margin: 0 auto;
    padding-bottom: 20px;
    display: flex;
    justify-content: space-evenly;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 10px;
}

@media (max-width: 450px) {
    .filtre div.choix {
        flex-direction: column !important;
    }
}

@media (max-width: 675px) {
    .filtre {
        flex-direction: column !important;
        height: auto !important;
    }
    .filtre div.choix {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        gap: 10px !important;
    }
    .filtre div.choix button,
    .filtre div.choix a {
        width: 100% !important;
    }
}

button.choix,
a.choix,
input[type="button"],
input[type="submit"],
input[type="reset"],
button.action-btn {
    background: var(--main-1);
    border: 2px solid var(--main-1);
    color: var(--text-white);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 15px;
    font-weight: 600;
    padding: 0 20px;
    min-height: 45px;
    line-height: 41px;
    border-radius: var(--radius-lg);
    white-space: normal;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.3s all ease-in-out;
}

button.choix:hover,
a.choix:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
button.action-btn:hover {
    background: var(--main-hover);
    border-color: var(--main-hover);
    color: var(--text-white);
}

button.reset {
    background-color: var(--bg-3);
    color: var(--text-dark);
    border-color: var(--border-color);
}

button.reset:hover {
    background-color: var(--border-color);
    border-color: var(--border-input);
    color: var(--danger);
}

/* Barre de filtres moderne (Drive, Associations, Démarches...) */
.filtre-modern {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
}

.search-wrapper {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-wrapper input {
    width: 100%;
    padding: 15px 45px 15px 20px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.3s;
    outline: none;
    box-sizing: border-box;
    background: var(--bg-2);
    color: var(--text-dark);
}

.search-wrapper input:focus {
    border-color: var(--main-1);
    background: var(--bg-card);
    box-shadow: 0 4px 15px rgba(var(--main-1-rgb), 0.1);
}

.search-wrapper i {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.actions-wrapper {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   ONGLETS (.tabs)
   ========================================================================== */
.ongles {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 30px;
}

.tabs {
    font-size: 20px;
}

.tabs .tab-registers {
    display: flex;
    flex-direction: row;
    border-bottom: solid 1px var(--main-1);
}

@media (max-width: 700px) {
    .tabs .tab-registers {
        flex-direction: column;
    }
}

.tabs button.onglet {
    padding: 0.5em 0.5em 0.2em 0.5em;
    background-color: var(--bg-card);
    border: none;
    border-bottom: solid 5px transparent;
    font: inherit;
    margin-bottom: 10px;
}

.tabs .tab-registers button:hover {
    cursor: pointer;
}

.tabs .tab-bodies {
    padding: 0.5em;
    flex-grow: 1;
    overflow-y: auto;
}

.tabs button.active-tab {
    border-bottom: solid 5px var(--secondary-1);
    transition: transform 0.3s ease-out;
}

/* ==========================================================================
   FORMULAIRES & CHAMPS
   ========================================================================== */
#form {
    position: relative;
    width: 80vw;
    max-width: 600px;
}

.form {
    width: 100%;
    text-align: left;
}

.inputsAutorisations,
.inputsAutorisationsModif {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    flex-direction: column;
}

.inputsAutorisations > div,
.inputsAutorisationsModif > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    flex-direction: column;
}

.inputsAutorisations > div span,
.inputsAutorisationsModif > div span {
    position: relative;
}

.inputsAutorisations > div > div > div,
.inputsAutorisationsModif > div > div > div {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 10px;
    margin-left: 15px;
}

.inputsAutorisations > div > div > div:not(:last-child),
.inputsAutorisationsModif > div > div > div:not(:last-child) {
    border-bottom: 2px solid var(--secondary-1);
}

.form input[type="text"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="number"],
.form input[type="password"],
.form input[type="date"],
.form input[type="time"],
.form input[type="datetime-local"],
.form input[type="file"],
.form input[type="url"],
.form select,
.form textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 16px;
    color: var(--text-dark);
    border: 2px solid var(--main-1);
    background-color: var(--bg-card);
    outline: none;
    transition: box-shadow 0.3s, border-color 0.3s;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
    box-shadow: 0 0 8px rgba(var(--main-1-rgb), 0.2);
}

.form label,
.form h4 {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--main-1);
}

#editNumero,
#addInfos,
#editNumeroModif,
#addInfosModif,
#newFichierModif {
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    font-family: var(--font-main);
    font-size: 12px;
    color: var(--text-grey);
}

#editNumero:hover,
#addInfos:hover,
#editNumeroModif:hover,
#addInfosModif:hover,
#newFichierModif:hover {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    padding: 2px 5px;
}

/* Boutons radio personnalisés en pilules */
input[type="radio"] {
    position: absolute;
    opacity: 0;
}

input[type="radio"] + label {
    display: inline-block;
    padding: 8px 18px;
    margin-right: 15px;
    background-color: var(--bg-3);
    color: var(--text-grey);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

input[type="radio"]:hover + label {
    background-color: var(--border-color);
}

input[type="radio"]:checked + label {
    background-color: var(--main-1);
    color: var(--text-white);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   NOTIFICATIONS & MODALES
   ========================================================================== */
.notifications-container {
    position: fixed;
    top: calc(10px + 70px);
    right: 10px;
    z-index: 9999;
}

.notification {
    max-width: 250px;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-weight: bold;
    display: flex;
    align-items: center;
    animation: slide-in 0.5s ease-in-out;
}

.succes {
    background-color: var(--success-bg);
    color: var(--success-dark);
    border: 1px solid var(--success-border);
}

.normal {
    background-color: var(--bg-3);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.erreur {
    background-color: var(--danger-bg);
    color: var(--danger-dark);
    border: 1px solid var(--danger-border);
    margin-bottom: 15px;
}

.valid {
    background: var(--success);
    margin-bottom: 15px;
    color: var(--text-white);
    margin-top: 10px;
    border-radius: var(--radius-lg);
    padding-left: 15px;
}

.notification button,
.notification1 button {
    background-color: var(--danger);
    color: var(--text-white);
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    margin-left: 5px;
    cursor: pointer;
}

@keyframes slide-in {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(0);
    }
}

.notification1 {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slide-in 0.5s ease-in-out;
}

.succes1 {
    background-color: var(--bg-2);
    border-left: 10px solid var(--success-dark);
}

.normal1 {
    background-color: var(--bg-2);
    border-left: 10px solid var(--text-dark);
}

.erreur1 {
    background-color: var(--bg-2);
    border-left: 10px solid var(--danger-dark);
}

.centered-div {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--bg-card);
    text-align: center;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: var(--radius-lg);
    max-height: 80dvh;
    height: auto;
    overflow: auto;
    box-shadow: var(--shadow-lg);
}

.addProgrammeFermer {
    position: absolute;
    right: 15px;
    top: 15px;
    background: transparent;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
}

.addProgrammeFermer:hover {
    background: var(--main-1);
    border: 1px solid var(--main-1);
    color: var(--text-white);
    font-size: 15px;
    border-radius: var(--radius-lg);
}

/* DIV Cache / Overlay Modale */
#messageDiv {
    position: fixed;
    top: 0;
    left: 0;
    padding: 10px;
    height: 100dvh;
    width: 100vw;
    color: var(--text-white);
    display: none;
    z-index: 100;
    background-color: var(--bg-overlay);
    backdrop-filter: blur(10px);
}

#messageDiv .card-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   CODE, TABLEAUX & BOUTON AIDE
   ========================================================================== */
pre,
pre.ql-syntax {
    background-color: var(--bg-code);
    color: var(--text-code);
    overflow: visible;
    white-space: pre-wrap;
    margin-bottom: 5px;
    margin-top: 5px;
    padding: 5px 10px;
    border-radius: 3px;
}

tr:nth-child(even) {
    background-color: var(--bg-2);
}

tr:nth-child(odd) {
    background-color: var(--secondary-2);
}

div.help {
    position: fixed;
    right: 25px;
    bottom: 25px;
    font-size: 35px;
}

div.help a {
    color: var(--main-1);
}
