/*
 * Atout Médical — CSS minimaliste
 * Principes : lisible, accessible (WCAG AA), léger (pas de framework)
 * Taille cible : < 10 Ko
 */

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

:root {
    --couleur-primaire:   #1a5276;
    --couleur-secondaire: #2980b9;
    --couleur-succes:     #1e8449;
    --couleur-erreur:     #c0392b;
    --couleur-avertis:    #d35400;
    --couleur-texte:      #1a1a1a;
    --couleur-fond:       #f8f9fa;
    --couleur-bord:       #ced4da;
    --rayon-bord:         4px;
    --espacement:         1rem;
    --max-largeur:        1200px;
    --police:             system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html {
    font-size: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--police);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--couleur-texte);
    background: var(--couleur-fond);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   ACCESSIBILITÉ
   ============================================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--couleur-primaire);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

:focus-visible {
    outline: 3px solid var(--couleur-secondaire);
    outline-offset: 2px;
}

/* ============================================================
   HEADER & NAV
   ============================================================ */
header {
    background: var(--couleur-primaire);
    color: white;
    padding: 0 var(--espacement);
}

header nav {
    max-width: var(--max-largeur);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 3.5rem;
}

.nav-marque__lien {
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-marque__logo {
    flex-shrink: 0;
    display: block;
    border-radius: 4px;
    overflow: hidden;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 0.25rem;
}

header nav ul a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: var(--rayon-bord);
    transition: background 0.15s;
}

header nav ul a:hover,
header nav ul a.actif {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* ============================================================
   MAIN & FOOTER
   ============================================================ */
main {
    flex: 1;
    max-width: var(--max-largeur);
    width: 100%;
    margin: 0 auto;
    padding: calc(var(--espacement) * 1.5) var(--espacement);
}

footer {
    background: #e9ecef;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: auto;
}

/* ============================================================
   TITRES & TYPOGRAPHIE
   ============================================================ */
h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.375rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.125rem; }

.page-entete {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--couleur-bord);
}

.periode { color: #6c757d; font-size: 0.9rem; }

/* ============================================================
   BOUTONS
   ============================================================ */
.bouton {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 1rem;
    border-radius: var(--rayon-bord);
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-family: var(--police);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.bouton--primaire {
    background: var(--couleur-primaire);
    color: white;
}
.bouton--primaire:hover { background: #154360; }

.bouton--secondaire {
    background: white;
    color: var(--couleur-primaire);
    border-color: var(--couleur-bord);
}
.bouton--secondaire:hover { background: #f0f4f8; }

.bouton--danger {
    background: var(--couleur-erreur);
    color: white;
}
.bouton--danger:hover { background: #a93226; }

.bouton--petit { padding: 0.25rem 0.6rem; font-size: 0.85rem; }

/* ============================================================
   FORMULAIRES
   ============================================================ */
.champ {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 1rem;
}

label { font-weight: 500; font-size: 0.95rem; }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--couleur-bord);
    border-radius: var(--rayon-bord);
    font-size: 1rem;
    font-family: var(--police);
    background: white;
    color: var(--couleur-texte);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--couleur-secondaire);
    outline: none;
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.25);
}

.form-navigation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-navigation input[type="number"] {
    width: 5rem;
}

/* ============================================================
   TABLEAUX
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.95rem;
}

th, td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--couleur-bord);
}

th {
    background: #e9ecef;
    font-weight: 600;
    color: #495057;
}

tbody tr:hover { background: #f0f4f8; }

/* Couleurs par statut */
.statut--install-e   { border-left: 3px solid var(--couleur-succes); }
.statut--pr-vue      { border-left: 3px solid var(--couleur-secondaire); }
.statut--pause       { border-left: 3px solid var(--couleur-avertis); }
.statut--d-sinstall-e{ border-left: 3px solid #6c757d; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge--install-e    { background: #d5f5e3; color: #1e8449; }
.badge--pr-vue       { background: #d6eaf8; color: #1a5276; }
.badge--pause        { background: #fde8d8; color: #d35400; }
.badge--d-sinstall-e { background: #e9ecef; color: #6c757d; }

/* ============================================================
   ALERTES
   ============================================================ */
.alerte {
    padding: 0.75rem 1rem;
    border-radius: var(--rayon-bord);
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alerte--succes {
    background: #d5f5e3;
    border-color: var(--couleur-succes);
    color: #1e5631;
}

.alerte--erreur {
    background: #fdecea;
    border-color: var(--couleur-erreur);
    color: #922b21;
}

/* ============================================================
   NAVIGATION SEMAINES
   ============================================================ */
.nav-semaines {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.bouton--action {
    background: #c0392b;
    color: white;
    font-weight: 600;
}
.bouton--action:hover { background: #922b21; }

.actions-page {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* ============================================================
   ÉTAT VIDE
   ============================================================ */
.vide {
    color: #6c757d;
    font-style: italic;
    padding: 2rem;
    text-align: center;
    background: white;
    border: 1px dashed var(--couleur-bord);
    border-radius: var(--rayon-bord);
}

/* ============================================================
   FORMULAIRES AVANCÉS
   ============================================================ */
.formulaire { max-width: 860px; }

.formulaire-groupe {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 1.5rem;
}

.formulaire-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--couleur-bord);
}

.champ-erreur {
    color: var(--couleur-erreur);
    font-size: 0.875rem;
    margin-top: 0.2rem;
}

.champ-aide {
    color: #6c757d;
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

.label-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.label-checkbox input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--couleur-primaire);
}

.form-filtres { margin-bottom: 1rem; }

.filtres-groupe {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}

.filtres-groupe label { font-size: 0.9rem; }

.filtres-groupe select,
.filtres-groupe input[type="text"] {
    width: auto;
    min-width: 140px;
}

.photo-actuelle {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: var(--rayon-bord);
}

/* ============================================================
   FICHES DÉTAIL
   ============================================================ */
.fiche-entete {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.fiche-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--couleur-bord);
}

.fiche-section:last-child { border-bottom: none; }

.fiche-deux-colonnes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.definition-liste {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.5rem;
    list-style: none;
}

.definition-liste dt {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.1rem;
}

.definition-liste dd { font-weight: 500; }

.photo-miniature {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 0.4rem;
}

.planning-cellule-photo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

.photo-planning {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}

.photo-vitrine {
    border-radius: var(--rayon-bord);
    max-width: 100%;
    height: auto;
    border: 1px solid var(--couleur-bord);
}

/* ============================================================
   GRILLE VITRINES (index en cartes)
   ============================================================ */
.grille-vitrines {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.carte-vitrine {
    background: white;
    border: 1px solid var(--couleur-bord);
    border-radius: var(--rayon-bord);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.carte-vitrine__image {
    height: 150px;
    overflow: hidden;
    background: #f0f4f8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carte-vitrine__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carte-vitrine__image--vide {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: #adb5bd;
    font-size: 2rem;
}

.carte-vitrine__corps { padding: 0.875rem; }

.carte-vitrine__titre {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.carte-vitrine__titre a {
    color: var(--couleur-primaire);
    text-decoration: none;
}

.carte-vitrine__titre a:hover { text-decoration: underline; }

.carte-vitrine__meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.carte-vitrine__meta dt { color: #6c757d; }
.carte-vitrine__meta dd { font-weight: 500; }

.carte-vitrine__actions { margin-top: auto; }

/* ============================================================
   FIL D'ARIANE
   ============================================================ */
.fil-ariane {
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.fil-ariane ol {
    list-style: none;
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    padding: 0;
}

.fil-ariane ol li::after { content: ' /'; color: #adb5bd; }
.fil-ariane ol li:last-child::after { content: ''; }

.fil-ariane a { color: var(--couleur-secondaire); }

/* ============================================================
   UTILITAIRES COULEUR TEXTE
   ============================================================ */
.texte-gris    { color: #6c757d; }
.texte-succes  { color: var(--couleur-succes); font-weight: 600; }
.texte-erreur  { color: var(--couleur-erreur); font-weight: 600; }

.badge--type {
    background: #e8f4fd;
    color: #1a5276;
}

/* ============================================================
   PAGE LOGIN
   ============================================================ */
.page-login {
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-conteneur {
    background: white;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

.login-logo {
    margin-bottom: 1rem;
}

.login-titre {
    font-size: 1.75rem;
    font-weight: 700;
    color: #4a6fa5;
    margin-bottom: 0.25rem;
}

.login-sous-titre {
    color: #9aa5b4;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.login-form { text-align: left; }

.login-champ {
    margin-bottom: 1.25rem;
}

.login-champ label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: #333;
}

.login-champ input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid #e0e4ea;
    border-radius: 12px;
    font-size: 1rem;
    background: #f5f7fa;
    font-family: var(--police);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-champ input:focus {
    outline: none;
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192,57,43,0.12);
    background: white;
}

.login-remember { margin-bottom: 1.75rem; }

.login-bouton {
    width: 100%;
    padding: 0.9rem;
    background: #c0392b;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--police);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.login-bouton:hover {
    background: #a93226;
    transform: translateY(-1px);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { margin-top: 1.5rem; }

.pagination nav { display: flex; justify-content: center; }

/* Surcharge du composant Blade de pagination Laravel */
.pagination .flex { display: flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }

/* ============================================================
   TABLEAU ACTIONS
   ============================================================ */
.actions-cellule {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* ============================================================
   BURGER MENU
   ============================================================ */
[x-cloak] { display: none !important; }

.nav-burger { display: none; position: relative; }

.burger-bouton {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.burger-bouton span {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    border-radius: 2px;
}

.burger-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid var(--couleur-bord);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 180px;
    z-index: 200;
    padding: 0.5rem 0;
}

.burger-menu a,
.burger-menu button {
    display: block;
    width: 100%;
    padding: 0.65rem 1.25rem;
    color: #2ea2cc;
    text-decoration: none;
    font-size: 0.95rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--police);
}

.burger-menu a:hover,
.burger-menu button:hover {
    background: #f0f8ff;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    /* Nav */
    header nav {
        height: auto;
        padding: 0.5rem 0;
        gap: 0.5rem;
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    header nav ul { gap: 0; }
    header nav ul a { padding: 0.3rem 0.5rem; font-size: 0.85rem; }
    .nav-marque__lien { font-size: 1rem; }
    .nav-marque__nom { display: none; }
    .nav-utilisateur--desktop { display: none !important; }
    .nav-burger { display: flex !important; align-items: center; flex-shrink: 0; }

    /* Semaines/mois : empiler */
    .nav-semaines { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

    /* Boutons de navigation mois/semaine */
    .nav-semaines .bouton--secondaire {
        background: #fec20d;
        color: #1a1a1a;
        border-color: #fec20d;
        font-weight: 600;
    }

    /* Bouton nouvelle affectation */
    .bouton--action {
        background: #c0392b;
        color: white;
        flex: 1;
        justify-content: center;
    }

    /* Boutons Vue liste / Vue calendrier */
    .actions-page { flex-wrap: wrap; gap: 0.5rem; }
    .vue-toggle { width: 100%; display: flex; }
    .vue-toggle .bouton {
        flex: 1;
        justify-content: center;
    }

    /* Miniature photo */
    .photo-miniature {
        width: 36px;
        height: 36px;
        object-fit: cover;
        border-radius: 4px;
        vertical-align: middle;
        margin-right: 0.4rem;
    }

    /* Tables responsives (carte par ligne) */
    table { border: none; }
    table thead { display: none; }
    table tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid var(--couleur-bord);
        border-radius: 6px;
        padding: 0.5rem;
        background: white;
    }
    table tbody td {
        display: flex;
        align-items: baseline;
        gap: 0.5rem;
        padding: 0.35rem 0.5rem;
        border: none;
        font-size: 0.9rem;
    }
    table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        min-width: 90px;
        flex-shrink: 0;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }
    .actions-cellule { flex-wrap: wrap; }

    /* Formulaire de navigation */
    .form-navigation { flex-wrap: wrap; gap: 0.4rem; }
}

/* ============================================================
   CALENDRIER MENSUEL
   ============================================================ */
.vue-toggle {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.calendrier {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.calendrier-semaine {
    border: 1px solid var(--couleur-bordure);
    border-radius: 6px;
    padding: 0.75rem;
    background: #fff;
    position: relative;
    min-height: 8rem;
}

.calendrier-semaine.hors-mois {
    background: #f8f8f8;
    opacity: 0.6;
}

.calendrier-semaine-entete {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--couleur-bordure);
    padding-bottom: 0.4rem;
}

.semaine-numero {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--couleur-primaire);
    text-decoration: none;
}
.semaine-numero:hover { text-decoration: underline; }

.semaine-dates {
    font-size: 0.75rem;
    color: var(--couleur-texte-leger, #666);
}

.calendrier-affectations {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.calendrier-affectations li {
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

.aff-pharmacie { font-weight: 600; }
.aff-vitrine   { font-style: italic; opacity: 0.85; }

.calendrier-vide {
    color: var(--couleur-texte-leger, #999);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 1rem;
}

.calendrier-ajouter {
    position: absolute;
    bottom: 0.4rem;
    right: 0.5rem;
    font-size: 1.1rem;
    color: var(--couleur-primaire);
    text-decoration: none;
    line-height: 1;
    opacity: 0.5;
}
.calendrier-ajouter:hover { opacity: 1; }

/* Utilisateurs */
.ligne-inactive td { opacity: 0.55; }
.badge--actif   { background: #d4edda; color: #155724; }
.badge--inactif { background: #f8d7da; color: #721c24; }
.badge--admin         { background: #cce5ff; color: #004085; }
.badge--collaborateur { background: #e2e3e5; color: #383d41; }
.badge--pharmacien    { background: #fff3cd; color: #856404; }

/* Nav utilisateur (profil + utilisateurs + déconnexion) */
.nav-utilisateur {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.nav-utilisateur a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--rayon-bord);
    transition: background 0.15s;
}

.nav-utilisateur a:hover,
.nav-utilisateur a.actif {
    background: rgba(255,255,255,0.15);
    color: white;
}

.bouton-lien {
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--rayon-bord);
    cursor: pointer;
    font-family: var(--police);
    transition: background 0.15s;
}

.bouton-lien:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* ============================================================
   TYPES DE MODÈLES
   ============================================================ */
.type-modeles-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

.formulaire-inline {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.formulaire-inline .champ {
    flex: 1;
    min-width: 160px;
}

@media (max-width: 700px) {
    .type-modeles-layout {
        grid-template-columns: 1fr;
    }
}
