/* ===========================
   VARIABLES GLOBALES
=========================== */
:root {
    --agro-red: #DA291C;
    --agro-dark: #2C2C2C;
    --agro-gray: #F4F4F4;
    --text-color: #333;
}

/* ===========================
   GLOBAL
=========================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--agro-gray);
    margin: 0;
    color: var(--text-color);
}

/* ===========================
   BACKGROUND LOGIN
=========================== */
.login-background { 
    background: url('./Images/DJI_0064.jpg') no-repeat center center fixed; 
    background-size: cover; 
}

/* ===========================
   LOGIN PAGE
=========================== */
.login-wrapper { 
    display: flex; 
    height: 100vh; 
    justify-content: center; 
    align-items: center; 
}

.login-box {
    width: 400px;
    text-align: center;
    background: rgba(255, 255, 255, 0.25); /* transparence */
    padding: 30px;
    border-radius: 15px;

    /* Effet flou derrière */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    /* Optionnel : effet verre */
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}



.login-box input { 
    width: 100%; 
    padding: 15px; 
    margin: 10px 0; 
    border: 1px solid #ddd; 
    border-radius: 5px; 
    box-sizing: border-box; 
}

.login-box button { 
    width: 100%; 
    padding: 15px; 
    background-color: var(--agro-red); 
    color: white; 
    border: none; 
    font-weight: bold; 
    font-size: 16px; 
    border-radius: 5px; 
    cursor: pointer; 
}

/* ===========================
   HEADER
=========================== */
header {
    background-color: white;
    border-top: 5px solid var(--agro-red);
    padding: 15px 40px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: bold;
    font-size: 24px;
    color: var(--agro-red);
    text-transform: uppercase;
}

.user-info {
    font-size: 14px;
    color: var(--agro-dark);
}

.btn-logout {
    text-decoration: none;
    color: var(--agro-red);
    font-weight: bold;
    border: 1px solid var(--agro-red);
    padding: 5px 15px;
    border-radius: 4px;
    margin-left: 15px;
    transition: 0.3s;
}

.btn-logout:hover {
    background-color: var(--agro-red);
    color: white;
}
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    width: 100%;
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    user-select: none;
    opacity: 0.7;
    transition: 0.2s;
}

.toggle-password:hover {
    opacity: 1;
}


/* Animation œil qui se ferme */
#eyeIcon.closed #eyeOpen {
    d: path("M2 12c3 5 7 7 10 7s7-2 10-7c-3-5-7-7-10-7S5 7 2 12z");
}

#eyeIcon.closed #pupil {
    opacity: 0;
    transition: opacity 0.2s ease;
}



/* ===========================
   CONTAINERS & CARDS
=========================== */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
}

.card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

h2 { 
    border-left: 5px solid var(--agro-red); 
    padding-left: 15px; 
    color: var(--agro-dark); 
}

h3 { 
    color: #555; 
    margin-top: 0; 
}

/* ===========================
   TABLES
=========================== */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 15px; 
    font-size: 14px; 
}

th, td { 
    border: 1px solid #ddd; 
    padding: 12px; 
    text-align: left; 
}

th { 
    background-color: var(--agro-red); 
    color: white; 
}

tr:nth-child(even) { 
    background-color: #f9f9f9; 
}

/* ===========================
   FORMULAIRES & BOUTONS
=========================== */
.form-group { 
    margin-bottom: 15px; 
}

select, input[type="file"] { 
    padding: 10px; 
    width: 100%; 
    box-sizing: border-box; 
    margin-top: 5px; 
}

.btn {
    background-color: var(--agro-dark);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn:hover { 
    background-color: black; 
}

.btn-archive { 
    background-color: #e67e22; 
}

.btn-delete { 
    background-color: var(--agro-red); 
    color: white; 
    text-decoration: none; 
    padding: 5px 10px; 
    font-size: 12px; 
    border-radius: 3px; 
}

.login-box.card {
    background: rgba(255, 255, 255, 0.7) !important;
}







/* ===========================
   TABLES (version unique)
=========================== */
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 20px;
    font-size: 14px;
}

th, td {
    border: 1px solid #ddd;
    padding: 10px 12px;
    text-align: left;      /* cohérent partout */
    word-wrap: break-word;
    white-space: normal;
}

th {
    background-color: var(--agro-red);
    color: white;
    font-weight: bold;
}

tr:nth-child(even) td { background-color: #f7f7f7; }
tr:nth-child(odd)  td { background-color: #ffffff; }

/* ===========================
   PAGES SERVICE (mutualisées)
=========================== */
.pdf-viewer {
    width: 100%;
    height: 90vh;
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.info-box {
    background: #fafafa;
    padding: 15px;
    border-left: 5px solid var(--agro-red);
    border-radius: 5px;
    margin-bottom: 15px;
}

.info-label {
    font-weight: bold;
    color: var(--agro-dark);
}

/* ===========================
   RESPONSIVE MOBILE
=========================== */
@media (max-width: 768px) {

    /* ── Header ── */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 16px;
    }

    .user-info {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        width: 100%;
    }

    .service-switcher {
        width: 100%;
        margin-right: 0;
        margin-bottom: 4px;
    }

    .service-switcher select {
        width: 100%;
    }

    /* ── Container ── */
    .container {
        margin: 16px auto;
        padding: 10px;
    }

    /* ── Cards ── */
    .card {
        padding: 16px;
        margin-bottom: 16px;
    }

    /* ── Login ── */
    .login-box {
        width: 90%;
        padding: 28px 20px;
    }

    /* ── Onglets gestionnaire ── */
    .menu-tabs {
        gap: 4px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .menu-tab {
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    /* ── Tableau utilisateurs ── */
    .user-table {
        font-size: 11px;
    }

    .user-table th,
    .user-table td {
        padding: 6px 6px;
    }

    /* Cacher les colonnes moins importantes sur mobile */
    .user-table th:nth-child(1),
    .user-table td:nth-child(1) { display: none; } /* ID */

    .user-table input[type="text"] {
        font-size: 11px;
        padding: 4px 6px;
    }

    .user-table select {
        font-size: 11px;
        padding: 4px 6px;
    }

    .btn-actions {
        flex-direction: column;
    }

    .btn-sm {
        font-size: 11px;
        padding: 5px 8px;
        text-align: center;
    }

    /* ── Formulaire création utilisateur ── */
    .form-grid {
        grid-template-columns: 1fr;
    }

    /* ── Formulaires planning / archive ── */
    .card form[style*="display:flex"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .card form select,
    .card form input[type="file"] {
        width: 100%;
    }

    /* ── PDF viewer ── */
    .pdf-viewer {
        height: 60vh;
    }

    /* ── Boutons généraux ── */
    .btn {
        width: 100%;
        text-align: center;
    }

    /* ── Modal ── */
    .modal-box {
        padding: 20px 16px;
        width: 92%;
    }

    /* ── Archives ── */
    .archive-table th,
    .archive-table td {
        padding: 8px 8px;
        font-size: 12px;
    }
}

/* ── Très petits écrans (< 400px) ── */
@media (max-width: 400px) {

    .logo {
        font-size: 18px;
    }

    .menu-tab {
        padding: 6px 10px;
        font-size: 11px;
    }

    .login-box {
        width: 95%;
        padding: 20px 14px;
    }

    .card {
        padding: 12px;
    }
}