/* ==========================================================================
   base.css
   Fusion de reset.css · style.css · form.css · grid.css · popUp.css · table.css
   Doubles déclarations supprimées / scindées quand nécessaire
   ========================================================================== */

/* -----------------------------------
   1. IMPORT POLICE
   ----------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* -----------------------------------
   2. RESET GÉNÉRAL
   (issues de reset.css + quelques ajouts non couverts)
   ----------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
img, video, canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

img.lien {
    width: 16px;
    height: 16px;
}

ul, ol {
    list-style: none;
}
a {
    text-decoration: none;
    color: inherit;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}
button {
    cursor: pointer;
}
textarea {
    resize: vertical;
}

/* -----------------------------------
   3. VARIABLES CSS
   (fusion style.css + base.css originel)
   ----------------------------------- */
:root {
    /* Couleurs “style.css” */
    --black:       #37393A;
    --blue:        #77B6EA;
    --beige:       #D6C9C9;
    --gray:        #C7D3DD;
    --white:       #E8EEF2;
    --red:         #BC0D3F;

    /* Couleurs et rayons “base.css” */
    --color-bg:         #f0f2f5;
    --color-surface:    #ffffff;
    --color-text:       #2e3238;
    --color-muted:      #6c757d;
    --color-primary:    #4f9aff;
    --color-primary-d:  #3a7dd6;
    --color-success:    #28a745;
    --color-danger:     #dc3545;
    --color-gray-light: #e1e5ea;
    --radius-sm:        4px;
    --radius-md:        8px;
    --radius-lg:        16px;
    --transition:       0.2s ease-in-out;
    --font-base:        'Inter', sans-serif;
}

/* -----------------------------------
   4. TYPOGRAPHIE & MISE EN PAGE GLOBALE
   ----------------------------------- */
body {
    font-family: var(--font-base);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    padding: 2rem 0;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}
h1 {
    font-size: 2.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
}
p {
    margin-bottom: 1rem;
    color: var(--color-muted);
}

/* -----------------------------------
   5. UTILITAIRES
   ----------------------------------- */
.hidden       { display: none !important; }
.text-center  { text-align: center; }
.mt-1         { margin-top: 0.5rem; }
.mt-2         { margin-top: 1rem; }
.mb-1         { margin-bottom: 0.5rem; }
.mb-2         { margin-bottom: 1rem; }

/* -----------------------------------
   6. CONTRÔLES DE FORMULAIRE
   (input, select, textarea)
   ----------------------------------- */
input,
input[type="text"],
input[type="password"],
input[type="date"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-gray-light);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    height: 40px;
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79,154,255,0.3);
}

/* Filtre par site dans la toolbar */
.toolbar select#siteFilter, .toolbar select#statusFilter {
    padding: 0.6rem 1rem;
    border: 1px solid var(--color-gray-light);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 1rem;
    width: 150px;
}

/* -----------------------------------
   7. BOUTONS
   ----------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    transition: background var(--transition), transform var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.btn-primary {
    background: var(--color-primary);
    color: var(--color-surface);
}
.btn-primary:hover {
    background: var(--color-primary-d);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--color-gray-light);
    color: var(--color-text) !important;
}
.btn-secondary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
.btn-danger {
    background: var(--color-danger);
    color: var(--color-surface);
}
.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.modifier, .sauvegarder, .annuler {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--red);
    color: var(--white);
    border-radius: var(--radius-sm);
    transition: transform 0.25s;
}

.annuler {
    background-color: var(--blue);
}

.sauvegarder:hover, .modifier:hover, .annuler:hover {
    transform: scale(1.025);
}

/* -----------------------------------
   8. ALERTES
   ----------------------------------- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    text-align: center;
    z-index: 100;
    position: absolute;
    top: 100px;
    width: 1200px;
    left: 50%;
    transform: translateX(-50%);
}
.alert.error {
    background: #fdecea;
    color: #b71c1c;
    border: 1px solid #f5c6cb;
}
.alert.success {
    background: #e6f4ea;
    color: #1b5e20;
    border: 1px solid #c3e6cb;
}

/* ====== Modal Create/Edit ====== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.show {
    display: flex;
}
.modal {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    width: 360px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.modal-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}
.modal label {
    display: block;
    margin-bottom: 0.75rem;
}
.modal input,
.modal select {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
}
.modal-footer {
    text-align: right;
    margin-top: 1rem;
}

/* -----------------------------------
   9. MODAUX
   ----------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.show {
    display: flex;
}
.modal {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.modal-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.modal-footer {
    text-align: right;
    margin-top: 1rem;
}

/* -----------------------------------
 10. POP-UPS
   ----------------------------------- */
.popup-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.popup-overlay.show {
    display: flex;
}
.popup {
    background: var(--gray);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-width: 400px;
    text-align: center;
}
.popup h2 {
    color: var(--black);
    margin-bottom: 0.75rem;
}
.popup p {
    margin-bottom: 1rem;
}
.popup button {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    margin: 0 0.5rem;
    transition: transform var(--transition);
}
.popup .btn-confirm {
    background: var(--red);
    color: var(--white);
}
.popup .btn-confirm:hover {
    transform: scale(1.05);
}
.popup .btn-cancel {
    background: var(--black);
    color: var(--white);
}
.popup .btn-cancel:hover {
    transform: scale(1.05);
}

/* -----------------------------------
 11. GRILLE GÉNÉRIQUE [data-grid]
   (de grid.css)
   ----------------------------------- */
[data-grid] {
    display: grid;
    gap: 1rem;
}
[data-grid="1"]    { grid-template-columns: repeat(1,1fr); }
[data-grid="2"]    { grid-template-columns: repeat(2,1fr); }
[data-grid="3"]    { grid-template-columns: repeat(3,1fr); }
[data-grid="4"]    { grid-template-columns: repeat(4,1fr); }
[data-grid="5-5-1"]{ grid-template-columns: 5fr 5fr 1fr; }
[data-grid="6"]    { grid-template-columns: repeat(6,1fr); }
[data-grid="8"]    { grid-template-columns: repeat(8,1fr); }
[data-grid="12"]   { grid-template-columns: repeat(12,1fr); }
[data-grid="2/3"]  { grid-template-columns: 2fr 1fr; }
[data-grid="1/3"]  { grid-template-columns: 1fr 2fr; }
[data-grid="1/4"]  { grid-template-columns: 1fr 3fr; }
[data-grid="4/1"]  { grid-template-columns: 3fr 1fr; }
[data-grid="3/4"]  { grid-template-columns: 3fr 1fr; }

/* Adaptation écrans moyens */
@media (max-width: 900px) {
    [data-grid="3"], [data-grid="4"] { grid-template-columns: repeat(2,1fr); }
    [data-grid="6"], [data-grid="8"] { grid-template-columns: repeat(4,1fr); }
    [data-grid="12"]                { grid-template-columns: repeat(6,1fr); }
}
/* Adaptation écrans petits */
@media (max-width: 600px) {
    [data-grid]                     { grid-template-columns: repeat(1,1fr); }
    [data-grid="8"], [data-grid="12"]{ grid-template-columns: repeat(2,1fr); }
}

/* -----------------------------------
 12. NAVIGATION FIXE (style.css)
   ----------------------------------- */
body nav {
    background: var(--gray);
    display: block;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
}
body nav img {
    width: 250px;
    margin: 0 auto;
    display: block;
    padding: 1rem 0;
}


.user-info {
    z-index: 100;
    position: relative;
    width: 1200px;
    margin: -15px auto;
    display: flex;
    justify-content: flex-end;
    top: 30px;
}
.user-info span {
    margin: 10px 20px;
}

header {
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 10;
}

/* -----------------------------------
 13. MENU LATÉRAL (style.css)
   ----------------------------------- */
.menu-gauche {
    display: flex;
    background-color: var(--gray);
    color: var(--white);
    width: 300px;
    position: fixed;
    top: 75px;
    left: -300px;                      /* caché par défaut */
    height: calc(100% - 75px);
    flex-direction: column;
    justify-content: space-between;
    transition: left var(--transition);
    z-index: 10;
}

/* état « ouvert » : on remonte le menu */
.menu-gauche.open {
    left: 0;
}

/* flèche : on la fait tourner selon l’état */
.menu-gauche .arrow-right {
    position: absolute;
    top: 0;
    right: -50px;
    width: 3.6rem;
    height: 3.6rem;
    padding: 1rem;
    background-color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition);
    cursor: pointer;
    transform: rotate(180deg);
}
.menu-gauche.open .arrow-right {
    transform: rotate(0deg);
    right: 0;
}

.menu-gauche ul {
    flex: 1 1 auto;
}
.menu-gauche.open li a {
    display: block;
    padding: 1rem 2rem;
    color: var(--black);
}
.menu-gauche.open li:hover {
    background-color: var(--blue);
    color: var(--white);
}
.menu-gauche.open li:has(a.active) {
    background-color: var(--beige);
}
.menu-gauche.open li:last-child:hover {
    background-color: var(--red);
}

/* -----------------------------------
 14. SECTION PRINCIPALE (style.css)
   ----------------------------------- */
body section {
    max-width: 1200px;
    margin: 5rem auto;
    text-align: center;
}
body section h1 { font-size: 4rem; }
body section h2 { font-size: 3rem; }
body section h3 {
    font-size: 2rem;
    margin-bottom: 0.625rem;
}
body section p { font-size: 1rem; }

/* -----------------------------------
 15. TABLEAUX (table.css)
   ----------------------------------- */
table {
    width: 100%;
    border-collapse: collapse; /* doublon de reset? conservé ici pour sécu */
    margin: 1rem 0;
    background-color: var(--white);
    font-size: 1rem;
    text-align: left;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
table thead {
    background-color: var(--blue);
    color: var(--white);
    position: sticky;
    top: 78px;
}
table thead th {
    padding: 0.5rem;
    border: 1px solid var(--gray);
    text-transform: uppercase;
    font-weight: bold;
    text-align: center;
}
/*table tbody tr:nth-child(odd) {*/
/*    background-color: var(--gray);*/
/*}*/
table tbody tr:nth-child(even) {
    background-color: var(--white);
}
table tbody td {
    border: 1px solid var(--gray);
    text-align: center;
}
table tbody tr:hover {
    background-color: var(--blue);
    color: var(--white);
    transition: background-color 0.3s;
}
table tbody td a:hover {
    text-decoration: underline;
}

#benefTable td:first-child,
#benefTable th:first-child {
    min-width: 24px;
}

/* Colonnes 4, 5 et 6 */

#benefTable td:nth-child(1),
#benefTable th:nth-child(1) {
    font-weight: bold;
}

#benefTable td:nth-child(2),
#benefTable td:nth-child(3),
#benefTable th:nth-child(2),
#benefTable th:nth-child(3) {
    min-width: 100px;
}
#benefTable td:nth-child(4),
#benefTable th:nth-child(4) {
    min-width: 60px;
}
#benefTable td:nth-child(5),
#benefTable th:nth-child(5),
#benefTable td:nth-child(6),
#benefTable th:nth-child(6),
#benefTable td:nth-child(8),
#benefTable td:nth-child(9),
#benefTable th:nth-child(8),
#benefTable th:nth-child(9),
#benefTable td:nth-child(15),
#benefTable td:nth-child(16),
#benefTable th:nth-child(15),
#benefTable th:nth-child(16)
{
    min-width: 80px;
}

#benefTable td:nth-child(9),
#benefTable th:nth-child(9) {
    min-width: 60px;
}

/* Colonnes 8 à 14 */

#benefTable td:nth-child(10),
#benefTable th:nth-child(10) {
    min-width: 100px;
}

#benefTable td:nth-child(14),
#benefTable th:nth-child(14) {
    min-width: 60px;
}

#benefTable td:nth-child(11),
#benefTable th:nth-child(12),
#benefTable td:nth-child(12),
#benefTable th:nth-child(11)
{
    min-width: 140px;
}

#benefTable td:nth-child(17),
#benefTable th:nth-child(17)
{
    min-width: 150px;
}

#benefTable img.lien {
    width: 24px;
    height: 24px;
}

/* -----------------------------------
 16. STYLES FORMULAIRES SPÉCIFIQUES (form.css)
   ----------------------------------- */
.container form {
    max-width: 1200px;
    margin: 0 auto;
    /* background-color: var(--white);*/
    padding: 2rem;
    /*border-radius: var(--radius-md);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);*/
}
.container form h1 {
    text-align: center;
    color: var(--black);
    font-size: 2.5rem;
}
.container form h2 {
    text-align: center;
    color: var(--red);
    font-size: 1.5rem;
    margin: 1.5rem;
    border-bottom: 2px solid var(--gray);
    padding-bottom: 0.5rem;
}
.container form .labelCategorie {
    font-weight: bold;
    color: var(--black);
    margin: 1rem 0 0.5rem;
    text-decoration: underline;
}
.container form div {
    margin-bottom: 1rem;
}
.container form .radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem auto;
}
.container form .radio-group input[type="radio"] {
    display: none;
}
.container form .radio-group label {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray);
    border-radius: var(--radius-sm);
    background-color: var(--gray);
    color: var(--black);
    cursor: pointer;
    transition: background-color var(--transition), color var(--transition);
}
.container form .radio-group input[type="radio"]:checked + label {
    background-color: var(--red);
    color: var(--white);
    border-color: var(--red);
}
.container form .checkbox-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.container form .checkbox-group input {
    margin-right: 0.5rem;
    width: auto;
}
.container form .error-message {
    color: var(--red);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}
.container form .submit-button,
.container form input[type="submit"] {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--red);
    color: var(--white);
    border-radius: var(--radius-sm);
    transition: transform 0.25s;
}
.container form .submit-button:hover,
.container form input[type="submit"]:hover {
    transform: scale(1.05);
}

/* -----------------------------------
 17. MEDIA QUERIES GÉNÉRAUX
   ----------------------------------- */
@media (max-width: 768px) {
    /* empile la grille */
    [data-grid] { grid-template-columns: repeat(1,1fr) !important; }
    /* formulaire responsive */
    .container form [data-grid] { grid-template-columns: 1fr !important; }
}


.delete {
    padding: 0 !important;
}

/* Highlight des cellules ou lignes */
.highlight-yellow {
    background-color: #fffa8b !important;
}
