/* ===========================================================
   Pompiers Manager - style.css
   =========================================================== */

:root {
    --rouge: #c0392b;
    --rouge-fonce: #922b21;
    --jaune: #f39c12;
    --gris-fonce: #2c3e50;
    --gris: #7f8c8d;
    --gris-clair: #ecf0f1;
    --vert: #27ae60;
    --blanc: #ffffff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--gris-clair);
    color: var(--gris-fonce);
}

a { color: var(--rouge); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Topbar --- */
.topbar {
    background: var(--gris-fonce);
    color: var(--blanc);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    flex-wrap: wrap;
}
.topbar-brand { font-size: 1.3em; font-weight: bold; }
.topbar-nav a {
    color: var(--blanc);
    margin: 0 12px;
    font-weight: 600;
    opacity: 0.85;
}
.topbar-nav a:hover { opacity: 1; text-decoration: none; border-bottom: 2px solid var(--jaune); }
.topbar-argent { font-weight: bold; color: var(--jaune); }
.topbar-coins { font-weight: bold; color: #d4a017; background: rgba(212, 160, 23, 0.15); padding: 4px 10px; border-radius: 12px; }

/* --- Layout --- */
.container { max-width: 1000px; margin: 0 auto; padding: 24px; }
h1 { margin-bottom: 4px; }
.subtitle { color: var(--gris); margin-top: 0; }
.footer { text-align: center; color: var(--gris); padding: 20px; font-size: 0.85em; }

/* --- Flash messages --- */
.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: #d4efdf; color: #1e8449; border: 1px solid #a9dfbf; }
.flash-error { background: #fadbd8; color: #922b21; border: 1px solid #f1948a; }

/* --- Cards --- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 20px 0; }
.card { background: var(--blanc); border-radius: 10px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.card-label { color: var(--gris); font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.5px; }
.card-value { font-size: 1.6em; font-weight: bold; color: var(--gris-fonce); margin-top: 4px; }
.card-sub { color: var(--gris); font-size: 0.85em; margin-top: 4px; }

/* --- Panels --- */
.panel { background: var(--blanc); border-radius: 10px; padding: 20px; margin: 20px 0; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.panel h2 { margin-top: 0; font-size: 1.1em; color: var(--gris-fonce); border-bottom: 2px solid var(--gris-clair); padding-bottom: 8px; }
.panel-center { text-align: center; }

/* --- Buttons --- */
.btn { display: inline-block; border: none; border-radius: 6px; padding: 10px 18px; font-weight: 600; cursor: pointer; font-size: 0.95em; }
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--rouge); color: var(--blanc); }
.btn-secondary { background: var(--gris); color: var(--blanc); }
.btn-success { background: var(--vert); color: var(--blanc); }
.btn-small { padding: 6px 12px; font-size: 0.85em; }

/* --- Tables --- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--blanc); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--gris-clair); }
.table th { background: var(--gris-fonce); color: var(--blanc); font-size: 0.85em; text-transform: uppercase; }
.empty { color: var(--gris); font-style: italic; padding: 12px; }

/* --- Badges --- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 0.78em; font-weight: 700; margin-right: 4px; }
.badge-grade { background: var(--gris-fonce); color: var(--blanc); }
.badge-spec { background: var(--jaune); color: var(--gris-fonce); }
.badge-ok { background: #d4efdf; color: #1e8449; }
.badge-fail { background: #fadbd8; color: #922b21; }
.badge-etat-disponible { background: #d4efdf; color: #1e8449; }
.badge-etat-en_intervention, .badge-etat-en-intervention { background: #fdebd0; color: #ca6f1e; }
.badge-etat-en_formation { background: #d6eaf8; color: #21618c; }
.badge-etat-repos, .badge-etat-indisponible { background: var(--gris-clair); color: var(--gris); }
.badge-echouee, .badge-annulee { background: #fadbd8; color: #922b21; }

/* --- Formulaires --- */
.checkbox-line { display: block; padding: 6px 0; }
select, input[type="text"] { padding: 8px; border-radius: 6px; border: 1px solid #ccc; margin: 6px 0; }

/* --- Modal --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--blanc); border-radius: 10px; padding: 24px; width: 90%; max-width: 480px; max-height: 85vh; overflow-y: auto; }
.modal h3 { margin-bottom: 4px; }

/* --- Intervention gameplay --- */
.requis-list { padding-left: 18px; }
.action-row { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-radius: 8px; margin-bottom: 10px; background: var(--gris-clair); }
.action-en_cours { background: #fdebd0; }
.action-reussie { background: #d4efdf; }
.action-echouee { background: #fadbd8; }
.action-libelle { font-weight: 600; }
.action-timer { font-weight: bold; font-variant-numeric: tabular-nums; margin-right: 10px; color: var(--rouge); }
.result-badge { font-size: 1.8em; font-weight: bold; padding: 10px 24px; border-radius: 10px; display: inline-block; }
.result-reussie { background: #d4efdf; color: #1e8449; }
.result-partielle { background: #fdebd0; color: #ca6f1e; }
.result-echouee { background: #fadbd8; color: #922b21; }

/* --- Nouvelle mécanique : clic engin -> choix action --- */
.tache-libelle { font-size: 1.4em; font-weight: 700; color: var(--gris-fonce); margin: 8px 0 16px 0; }
.btn-action-choix { text-align: left; }
#reponse-feedback { margin-top: 16px; }

/* --- Renommage inline (personnel, engins) --- */
.renommer-form { display: flex; gap: 4px; align-items: center; }
.renommer-input { padding: 4px 6px; border-radius: 4px; border: 1px solid #ccc; width: 90px; font-size: 0.9em; }

.result-badge-small { padding: 2px 8px; border-radius: 10px; font-size: 0.85em; font-weight: 700; }

/* --- Profil / Finances --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-top: 12px; }
.stat-box { background: var(--gris-clair); border-radius: 10px; padding: 14px; text-align: center; }
.stat-value { display: block; font-size: 1.6em; font-weight: 800; color: var(--rouge); }
.stat-label { display: block; font-size: 0.85em; color: var(--gris); margin-top: 4px; }
.montant-gain { color: #1e8449; font-weight: 700; }
.montant-depense { color: #922b21; font-weight: 700; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--gris-fonce); }
.form-group input { width: 100%; max-width: 360px; padding: 8px 10px; border: 1px solid var(--gris-clair); border-radius: 6px; font-size: 1em; }
.gains-line { margin: 10px 0; }
.gains-line .badge { font-size: 1em; padding: 6px 12px; margin: 0 4px; }

/* --- Tâches parallèles / verrouillées --- */
/* --- Tâches parallèles / verrouillées (refonte visuelle) --- */
.tache-parallele {
    background: var(--blanc);
    border: 1px solid var(--gris-clair);
    border-left: 5px solid var(--rouge);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.15s;
}
.tache-parallele:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.tache-verrouillee { opacity: 0.6; background: var(--gris-clair); border-left-color: var(--gris); box-shadow: none; }
.tache-en-cours { border-left-color: var(--jaune); }
.tache-libelle-inline { font-weight: 700; font-size: 1.05em; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tache-attente { font-style: italic; color: var(--gris); margin: 0; font-size: 0.92em; }

/* Countdown : grande taille réservée à la page dédiée en plein écran ;
   version compacte quand affiché dans une carte de tâche ou inline. */
.big-countdown { font-size: 3em; font-weight: bold; color: var(--rouge); margin: 16px 0; font-variant-numeric: tabular-nums; text-align: center; }
.countdown-action-parallele {
    font-size: 1.5em;
    font-weight: 800;
    color: var(--jaune);
    margin: 4px 0 0;
    font-variant-numeric: tabular-nums;
    text-align: left;
}

/* Engins en route : mini-cartes avec countdown compact */
.engins-en-route-liste { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.engin-en-route-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--blanc);
    border: 1px solid #fdebd0;
    border-left: 4px solid #e67e22;
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.92em;
}
.countdown-mini { font-variant-numeric: tabular-nums; color: #e67e22; font-weight: 800; margin-left: 4px; }

/* Cartes engin cliquables : un peu plus compactes et lisibles */
.engins-cliquables { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-start; margin-top: 6px; }
.engin-carte { display: flex; flex-direction: column; align-items: center; }
.btn-engin-choix { background: var(--blanc); border: 2px solid var(--gris-clair); border-radius: 10px; padding: 10px 14px; font-size: 1.3em; text-align: center; cursor: pointer; transition: all 0.15s; line-height: 1.3; min-width: 90px; }
.btn-engin-choix:hover { border-color: var(--rouge); transform: translateY(-2px); box-shadow: 0 3px 8px rgba(0,0,0,0.1); }
.btn-engin-choix:disabled { opacity: 0.5; cursor: not-allowed; }
.actions-possibles-choix { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; min-width: 180px; }

/* Panneau inline (page Interventions) */
.ligne-panneau-inline td { background: var(--gris-clair); padding: 18px; }
.panneau-inline-conteneur { max-width: 900px; }
.panneau-inline-envoyer {
    margin-top: 16px;
    background: var(--blanc);
    border-radius: 10px;
    padding: 4px 16px;
    border: 1px solid var(--gris-clair);
}
.panneau-inline-envoyer summary { cursor: pointer; font-weight: 700; color: var(--rouge); padding: 12px 0; list-style: none; }
.panneau-inline-envoyer summary::-webkit-details-marker { display: none; }
.panneau-inline-envoyer summary::before { content: '▸ '; }
.panneau-inline-envoyer[open] summary::before { content: '▾ '; }
.panneau-inline-envoyer form { padding-bottom: 14px; }
.form-envoyer-secours-inline .checkbox-line {
    display: block;
    margin: 4px 0;
    padding: 8px 10px;
    border-radius: 6px;
    transition: background 0.1s;
}
.form-envoyer-secours-inline .checkbox-line:hover { background: var(--gris-clair); }

/* Statuts d'intervention : badges plus lisibles */
.badge-en_attente, .badge-en_attente { background: var(--gris-clair); color: var(--gris-fonce); }
.badge-engins_en_route { background: #fdebd0; color: #ca6f1e; }
.badge-sur_place, .badge-en_cours { background: #d6eaf8; color: #21618c; }
.badge-terminee { background: #d4efdf; color: #1e8449; }
.badge-annulee { background: #fadbd8; color: #922b21; }

.badge-en-ligne { background: rgba(39, 174, 96, 0.15); color: #1e8449; padding: 2px 8px; border-radius: 10px; font-size: 0.85em; margin-left: 4px; }
.ligne-joueur-actuel { background: rgba(243, 156, 18, 0.12); font-weight: 700; }

.btn-coins { background: #d4a017; color: #fff; border: none; }
.btn-coins:hover { background: #b8890f; }
.btn-coins:disabled { background: #ccc; cursor: not-allowed; }

.coins-packs { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.coins-pack-card { background: var(--gris-clair); border-radius: 12px; padding: 18px; text-align: center; min-width: 130px; }
.coins-pack-nombre { font-size: 1.6em; font-weight: 800; color: #d4a017; }
.coins-pack-prix { color: var(--gris); margin: 6px 0 10px; }

.recrutement-specialites { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.recrutement-spec-cout { color: var(--gris); font-size: 0.85em; margin-left: 4px; }
.recrutement-spec-indisponible { opacity: 0.4; }
.recrutement-total { font-size: 1.2em; margin: 14px 0; }

/* --- Page de présentation (landing) --- */
.landing-body { background: linear-gradient(160deg, var(--gris-fonce) 0%, var(--rouge-fonce) 100%); min-height: 100vh; }
.container-landing { max-width: 1100px; margin: 0 auto; padding: 0 20px 60px; }

.landing-hero { text-align: center; color: var(--blanc); padding: 70px 20px 50px; }
.landing-hero-icon { margin-bottom: 10px; }
.landing-titre { font-size: 2.8em; font-weight: 900; margin: 10px 0 6px; }
.landing-tagline { font-size: 1.2em; opacity: 0.92; max-width: 640px; margin: 0 auto 30px; line-height: 1.5; }
.landing-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.btn-landing { padding: 14px 28px; font-size: 1.05em; border-radius: 10px; }
.landing-souslien { margin-top: 24px; opacity: 0.85; font-size: 0.92em; }
.landing-souslien code { background: rgba(255, 255, 255, 0.15); padding: 2px 6px; border-radius: 4px; }

.landing-features { background: var(--blanc); border-radius: 20px; padding: 40px 30px; margin-top: 20px; }
.landing-section-titre { text-align: center; font-size: 1.7em; margin-bottom: 30px; color: var(--gris-fonce); }
.landing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.landing-feature { text-align: center; padding: 10px; }
.landing-feature-icone { display: flex; justify-content: center; margin-bottom: 12px; font-size: 2.2em; }
.landing-feature h3 { color: var(--rouge); margin-bottom: 8px; }
.landing-feature p { color: var(--gris); font-size: 0.95em; line-height: 1.5; }

.landing-cta-bas { text-align: center; color: var(--blanc); padding: 50px 20px 10px; }
.landing-cta-bas h2 { font-size: 1.6em; margin-bottom: 20px; }

@media (max-width: 600px) {
    .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
    .topbar-nav a { margin: 0 8px 0 0; }
}

/* --- Topbar v0.3 --- */
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar-user { font-weight: 600; }
.topbar-logout { color: var(--blanc); opacity: 0.75; font-size: 0.9em; }
.topbar-logout:hover { opacity: 1; }
#caserne-switcher { padding: 6px; border-radius: 6px; border: none; }

/* --- Auth pages --- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--gris-fonce), var(--rouge-fonce)); }
.container-auth { max-width: 420px; width: 100%; }
.auth-brand { text-align: center; color: var(--blanc); font-size: 1.8em; font-weight: bold; margin-bottom: 20px; }
.auth-form { display: flex; flex-direction: column; }
.auth-form label { font-weight: 600; margin-top: 10px; margin-bottom: 4px; font-size: 0.9em; }
.auth-form input { padding: 10px; border-radius: 6px; border: 1px solid #ccc; }
.auth-switch, .auth-hint { text-align: center; color: var(--blanc); margin-top: 14px; }
.auth-switch a { color: var(--jaune); font-weight: 600; }
.auth-hint code { background: rgba(255,255,255,0.15); padding: 2px 6px; border-radius: 4px; color: var(--blanc); }

/* --- Mes casernes --- */
.card-active { border: 2px solid var(--rouge); }

/* --- Notifications toast (nouvelles interventions générées automatiquement) --- */
#notif-zone { position: fixed; top: 70px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 320px; }
.toast-notif { background: var(--gris-fonce); color: var(--blanc); padding: 12px 16px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.25); border-left: 4px solid var(--jaune); animation: toast-in 0.25s ease-out; }
.toast-notif a { color: var(--jaune); font-weight: 700; margin-left: 6px; }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- États supplémentaires --- */
.badge-etat-retour_caserne, .badge-etat-retour-caserne { background: #e8daef; color: #6c3483; }

/* --- Fiches engin (page Engins : équipage type + actions possibles) --- */
.fiche-engin { border: 1px solid var(--gris-clair); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.fiche-engin-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.fiche-engin-titre { display: flex; align-items: center; gap: 12px; }
.fiche-engin-icone { font-size: 2.2em; line-height: 1; }
.fiche-engin-nom { font-weight: bold; font-size: 1.1em; }
.fiche-engin-achat { text-align: right; }
.fiche-engin-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; padding-top: 12px; border-top: 1px solid var(--gris-clair); }
.fiche-engin-col h3 { margin: 0 0 8px 0; font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gris); }
.fiche-liste { list-style: none; padding: 0; margin: 0; }
.fiche-liste li { padding: 4px 0; font-size: 0.92em; }

/* --- Page Équipages / Piquets --- */
.equipage-jauge { font-size: 0.8em; font-weight: 700; padding: 3px 10px; border-radius: 12px; background: var(--gris-clair); color: var(--gris-fonce); margin-left: 8px; }
.equipage-complet { background: #d4efdf; color: #1e8449; }
.postes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 12px; }
.poste-slot { border: 1px solid var(--gris-clair); border-radius: 8px; padding: 12px; }
.poste-label { font-weight: 700; margin-bottom: 4px; }
.poste-requis { font-size: 0.85em; color: var(--gris); margin-bottom: 8px; }
.poste-form select { width: 100%; }
.poste-vide-hint { margin-top: 6px; font-size: 0.85em; }

/* --- Bouton téléphone (autoriser/interdire les interventions auto) --- */
.telephone-btn { border: none; border-radius: 50%; width: 38px; height: 38px; font-size: 1.1em; cursor: pointer; transition: background 0.2s; }
.telephone-vert { background: #27ae60; }
.telephone-rouge { background: var(--rouge); animation: pulse-rouge 2s infinite; }
@keyframes pulse-rouge { 0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.5); } 50% { box-shadow: 0 0 0 6px rgba(192,57,43,0); } }

/* --- Zone Administration --- */
.topbar-admin { background: #1a2530; border-bottom: 3px solid var(--jaune); }
.admin-table-wrap { overflow-x: auto; margin-bottom: 20px; }
.admin-actions { white-space: nowrap; }
.admin-actions .btn { margin-right: 4px; }
.admin-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.admin-form-grid label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.85em; }
.admin-form-grid input, .admin-form-grid select, .admin-form-grid textarea { width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #ccc; }
.admin-section { margin-top: 24px; padding-top: 16px; border-top: 2px solid var(--gris-clair); }
.admin-subitem-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--gris-clair); flex-wrap: wrap; }
.admin-subitem-row form { display: inline-flex; gap: 6px; align-items: center; }
.btn-danger { background: var(--rouge); color: var(--blanc); }

/* --- Carte --- */
#carte-live { height: 65vh; min-height: 420px; border-radius: 10px; }
.carte-legende { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 0.85em; color: var(--gris); }
.divicon-engin { font-size: 1.4em; text-align: center; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }
.divicon-intervention { font-size: 1.6em; text-align: center; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }
.divicon-caserne { font-size: 1.8em; text-align: center; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }
