/* =========================================================
   RAJO+ V7 - STYLE GLOBAL
   Accueil + base application
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: #F4F6F8;
    color: #2F3542;
    font-family: Arial, Helvetica, sans-serif;
}

/* =========================================================
   HEADER
   ========================================================= */

header {
    background: linear-gradient(135deg, #0F4C5C, #12343B);
    color: white;
    padding: 34px 30px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.22);
}

header h1 {
    margin: 0 0 12px 0;
    font-size: 34px;
    font-weight: 800;
}

header p {
    margin: 0;
    font-size: 16px;
}

/* =========================================================
   CONTENU PRINCIPAL
   ========================================================= */

main {
    padding: 36px 30px 70px 30px;
}

h2 {
    color: #0F4C5C;
    font-size: 24px;
    margin: 0 0 26px 0;
}

/* =========================================================
   KPI ACCUEIL
   ========================================================= */

.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 22px;
    margin: 0 0 32px 0;
}

.stat-box {
    background: #ffffff;
    border-radius: 15px;
    padding: 24px 18px;
    text-align: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.10);
    border-left: 6px solid #26935c;
    min-height: 125px;
}

.stat-box h3 {
    margin: 0 0 12px 0;
    font-size: 32px;
    font-weight: 800;
    color: #06485a;
}

.stat-box p {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    color: #1f2f3a;
}

.stat-box small {
    display: block;
    margin-top: 6px;
    color: #64748B;
    font-size: 13px;
}

/* =========================================================
   CARTES ACCUEIL
   ========================================================= */

.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    margin-top: 24px;
}

.card {
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.10);
    padding: 24px;
    width: 260px;
    min-height: 160px;
}

.card h3 {
    margin: 0 0 16px 0;
    color: #0F4C5C;
    font-size: 20px;
}

.card p {
    margin: 0 0 20px 0;
    font-size: 15px;
    line-height: 1.35;
}

/* =========================================================
   BOUTONS
   ========================================================= */

button {
    background-color: #2E8B57;
    color: white;
    border: none;
    padding: 11px 18px;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    background-color: #256f46;
}

a {
    text-decoration: none;
}

/* =========================================================
   FORMULAIRES / BASE APPLICATION
   ========================================================= */

form {
    background: white;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    padding: 30px;
    max-width: 900px;
}

form p {
    margin-bottom: 15px;
}

label {
    font-weight: bold;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #CCCCCC;
    border-radius: 6px;
    box-sizing: border-box;
}

textarea {
    resize: vertical;
}

/* =========================================================
   FOOTER
   ========================================================= */

footer {
    text-align: center;
    padding: 22px;
    background-color: #12343B;
    color: white;
    margin-top: 40px;
}

/* =========================================================
   BARRES ACTIONS / FILTRES
   ========================================================= */

.actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.actions-bar button {
    background: #0F4C5C;
}

.actions-bar button:hover {
    background: #12343B;
}

.filtres {
    background: white;
    padding: 20px;
    border-radius: 14px;
    margin-bottom: 25px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    width: 100%;
    box-sizing: border-box;
}

.filtres h3 {
    margin-top: 0;
    color: #0F4C5C;
}

.filtres-grid,
.filtres-v6-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 15px;
    width: 100%;
}

.hidden {
    display: none;
}

.form-section {
    margin-bottom: 25px;
}

/* =========================================================
   PAGINATION
   ========================================================= */

.pagination {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 15px 0;
}

.pagination span {
    font-weight: bold;
    color: #0F4C5C;
}

/* =========================================================
   BADGES
   ========================================================= */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: bold;
    font-size: 12px;
    color: white;
}

.badge-u1 { background: #dc2626; }
.badge-u2 { background: #f97316; }
.badge-u3 { background: #facc15; color: #111827; }
.badge-u4 { background: #2563eb; }

.badge-etat-t { background: #16a34a; }
.badge-etat-ec { background: #2563eb; }
.badge-etat-d { background: #64748b; }
.badge-etat-attente { background: #f97316; }

/* =========================================================
   TABLEAUX INTERVENTIONS
   ========================================================= */

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    padding: 8px 10px;
    vertical-align: top;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid rgba(148, 163, 184, 0.25);
}

th:last-child,
td:last-child {
    border-right: none;
}

th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
}

td {
    font-size: 14px;
}

thead th {
    background: #e9eef5;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 2;
}

tbody tr:hover {
    background: #f5f9fc;
}

tbody tr:nth-child(even) {
    background: #fafafa;
}

.col-date {
    white-space: nowrap;
    min-width: 90px;
}

.actions-cell {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
}

.actions-cell button {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 6px;
}

th:nth-child(1), td:nth-child(1) { width: 85px; }
th:nth-child(2), td:nth-child(2) { width: 80px; }
th:nth-child(3), td:nth-child(3) { width: 120px; }
th:nth-child(4), td:nth-child(4) { width: 120px; }
th:nth-child(5), td:nth-child(5) { width: 55px; }
th:nth-child(6), td:nth-child(6) { width: 80px; }
th:nth-child(7), td:nth-child(7) { width: 120px; }
th:nth-child(8), td:nth-child(8) { width: 60px; }
th:nth-child(9), td:nth-child(9) { width: 80px; }
th:nth-child(10), td:nth-child(10) { width: 85px; }
th:nth-child(11), td:nth-child(11) { width: 50px; }
th:nth-child(12), td:nth-child(12) { width: 340px; }
th:nth-child(13), td:nth-child(13) { width: 480px; }
th:nth-child(14), td:nth-child(14) { width: 65px; }
th:nth-child(15), td:nth-child(15) { width: 150px; }

/* =========================================================
   ONGLETS
   ========================================================= */

.tabs-rajo {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 8px;
}

.tabs-rajo button {
    background: transparent;
    color: #0f4c5c;
    border: none;
    font-weight: bold;
    padding: 8px 14px;
    cursor: pointer;
}

.tabs-rajo .tab-active {
    border-bottom: 3px solid #2563eb;
    color: #2563eb;
}

/* =========================================================
   FORMULAIRE MODAL INTERVENTION
   ========================================================= */

#zoneFormulaire {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: 92%;
    max-width: 1150px;
    max-height: 88vh;
    overflow-y: auto;

    background: #F8FAFC;
    border-radius: 16px;
    padding: 0 24px 24px 24px;
    z-index: 9999;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

body.formulaire-ouvert::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 76, 92, 0.45);
    z-index: 9998;
}

.entete-formulaire {
    position: sticky;
    top: 0;
    z-index: 10001;
    display: flex;
    justify-content: space-between;
    align-items: center;

    background: linear-gradient(90deg, #0F4C5C, #16697A);
    color: white;

    padding: 16px 22px;
    margin: 0 -24px 18px -24px;
    border-radius: 16px 16px 0 0;
    border-bottom: 4px solid #2E8B57;
}

.entete-formulaire h2 {
    margin: 0;
    color: white;
    font-size: 22px;
}

.btn-fermer-haut {
    background: #DC2626;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 9px 14px;
    font-weight: bold;
    cursor: pointer;
}

#formIntervention {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 22px;
    background: white;
    padding: 28px;
    border-radius: 14px;
    max-width: none;
}

#formIntervention p {
    margin: 0;
}

.ligne-equipement-type {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.bloc-champ {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.champ-avec-boutons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.champ-avec-boutons input {
    flex: 1;
}

.champ-avec-boutons button {
    width: 46px;
    height: 38px;
    padding: 0;
}

.bloc-actions,
.champ-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.barre-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#actionsEditeur {
    width: 100%;
    min-height: 85px;
    border: 1px solid #CCCCCC;
    border-radius: 6px;
    padding: 10px;
    background: white;
    color: black;
    box-sizing: border-box;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media screen and (max-width: 1100px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .filtres-grid,
    .filtres-v6-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media screen and (max-width: 768px) {
    main {
        padding: 25px 15px 60px 15px;
    }

    header {
        padding: 28px 20px;
    }

    header h1 {
        font-size: 28px;
    }

    .stats-bar {
        grid-template-columns: 1fr;
    }

    .cards {
        flex-direction: column;
    }

    .card {
        width: 100%;
    }

    .filtres-grid,
    .filtres-v6-grid {
        grid-template-columns: 1fr;
    }

    #zoneFormulaire {
        width: 96%;
        max-height: 92vh;
        padding: 0 12px 18px 12px;
    }

    #formIntervention {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .ligne-equipement-type {
        grid-template-columns: 1fr;
    }

    .entete-formulaire {
        margin: 0 -12px 16px -12px;
    }

    .actions-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .actions-bar button {
        white-space: nowrap;
        padding: 9px 12px;
        font-size: 13px;
    }
}
