/* Ce code est une partie du logiciel GCU WEB, Une solution déveoppée par Maxime BORKOWSKI a titre privé. Ce logiciel en intégralité appartient a Maxime BORKOWSKI. Il est strictement interdit de le modifier ou de le publier. L'utilisation et l'exploitation de cette copie du logiciel original est réservé l'UFA la Briquerie pour un usage interne uniquement. Il été mis a disposition a titre gracieux sans contrepartie financière.*/

/* =========================
   Global
   ========================= */
body, html {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    background-image: url("assets/background.jpg");
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
}

/* =========================
   Bandeau supérieur
   ========================= */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: #649abe;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    overflow-x: hidden;
}

.top-left {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    gap: 0;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-name {
    font-size: 14px;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn, .return-btn {
    flex-shrink: 0;
    white-space: nowrap;
    background-color: #cc0000;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 0px;
    text-decoration: none;
    font-size: 13px;
    transition: background-color 0.2s ease-in-out;
}

.logout-btn:hover {
    background-color: #a30000;
}

.return-btn {
    background-color: #808080;
}

.return-btn:hover {
    background-color: #000000;
}

/* Boutons GCU dans le bandeau */
.top-bar .gcu-btn {
    margin-left: 20px;
    background-color: #000091;
    color: #fff;
    padding: 6px 12px;
    border-radius: 0px;
    text-decoration: none;
    font-size: 13px;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    box-sizing: border-box;
    width: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.top-bar .gcu-btn:hover {
    background-color: #1212FF;
}

/* =========================
   Login box (page login)
   ========================= */
.login-box {
    background: rgba(255,255,255,0.95);
    padding: 30px;
    width: 350px;
    border-radius: 0px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    box-sizing: border-box;
    margin: 150px auto 40px auto;
}

.login-box  h2{
    text-align: center;
    margin-bottom: 45px;
}

/* =========================
   Formulaires
   ========================= */
label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

input[type="password"], input[type="text"], input[type="email"] {
    width: 94%;
    padding: 8px;
    margin: 8px 0 15px 0;
    border: none;
    border-radius: 4px;
    box-sizing: border-box;
    border-bottom: 2px solid #9c9c9c;
    background: #f6f6f6;
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 0px;
}

button {
    width: 100%;
    padding: 10px;
    background-color: #000091;
    color: white;
    border: none;
    border-radius: 0px;
    cursor: pointer;
    font-size: 14px;
}

button:hover {
    background-color: #1212FF;
}

/* =========================
   Messages
   ========================= */
.error {
    color: red;
    margin-bottom: 15px;
    text-align: center;
}

.success {
    color: green;
    margin-bottom: 15px;
    text-align: center;
}

/* =========================
   Profil utilisateur
   ========================= */
.profile-box {
    background: rgba(255,255,255,0.95);
    padding: 30px;
    width: 950px;
    max-width: 95%;
    border-radius: 0px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    box-sizing: border-box;
    margin: 120px auto 40px auto;
}

.profile-table-wrapper {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    overflow-x: auto;
}

.profile-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    background: #ffffff;
}

.profile-table th {
    width: 35%;
    padding: 14px;
    background: #f3f3f3;
    border: 1px solid #ddd;
    text-align: left;
}

.profile-table td {
    width: 65%;
    padding: 14px;
    border: 1px solid #ddd;
    word-break: break-all;
    white-space: normal;
    line-height: 1.5;
}

/* Disciplines */
.discipline-list {
    margin: 0;
    padding-left: 20px;
}

.discipline-list li {
    margin-bottom: 6px;
}

/* Boutons action */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
}

.action-buttons button {
    width: 240px;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 600;
    border-radius: 0px;
    border: none;
    cursor: pointer;
    background-color: #000091;
    color: #fff;
}

.action-buttons button:hover {
    background-color: #1212FF;
}

/* =========================
   Modales génériques
   ========================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 6px;
    width: 320px;
    max-width: 95%;
}

.modal-content label {
    display: block;
    margin-top: 10px;
}

.modal-content input {
    width: 100%;
    padding: 8px;
    border-bottom: 2px solid #9c9c9c;
    background: #f6f6f6;
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 0px;
}

.modal-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =========================
   Footer
   ========================= */
.site-footer {
    background-color: transparent;
    text-align: center;
    padding: 12px 0;
    font-size: 14px;
    color: #666;
    margin-top: auto;
}

/* =========================
   Page administration.php
   ========================= */

/* Conteneur principal */
.admin-box {
    background: rgba(255,255,255,0.95);
    padding: 30px;
    width: 950px;
    max-width: 95%;
    border-radius: 0px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    box-sizing: border-box;
    margin: 70px auto 40px auto;
}

.admin-box h2 {
    text-align: center;
}

/* Formulaire de recherche */
.search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 50px;
    margin-top: 50px;
    justify-content: center;
}

.search-form .field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-form label {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 4px;
}

.search-form input[type="text"],
.search-form select {
    padding: 8px;
    border: none;
    font-size: 13px;
    width: 180px;
    height: 34px;
    box-sizing: border-box;
    margin-top: 0;
    border-bottom: 2px solid #9c9c9c;
    background: #f6f6f6;
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 0px;
}

.search-form button {
    width: auto;
    padding: 8px 20px;
    height: 34px;
    box-sizing: border-box;
    margin-top: 23px;
}

/* Barre d'actions */
.actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.actions-bar button {
    width: auto;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 600;
}

.btn-delete {
    background-color: #cc0000;
}

.btn-delete:hover {
    background-color: #a30000;
}

.btn-create {
    margin-left: auto;
}

/* Tableau de résultats */
.result-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.result-table th {
    padding: 10px;
    background: #f3f3f3;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 13px;
}

.result-table td {
    padding: 8px 10px;
    border: 1px solid #ddd;
    font-size: 13px;
}

.result-table tr:hover {
    background: #f9f9f9;
}

.result-table tr.clickable-row {
    cursor: pointer;
}

.result-table tr.clickable-row:hover {
    background: #e8f0fe;
}

/* Statuts utilisateur */
.status-actif {
    color: green;
    font-weight: bold;
    display: inline-flex;
    border-radius: 35px;
    border: 1px solid;
    padding: 3px 9px;
    align-items: center;
    background-color: green;
}

.status-desactive {
    color: red;
    font-weight: bold;
    display: inline-flex;
    border-radius: 35px;
    border: 1px solid;
    padding: 3px 9px;
    align-items: center;
    background-color: red;
}

.result-count {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

/* Ligne protégée (compte blindé) */
.row-protected {
    opacity: 0.45;
    background: #f0f0f0 !important;
    cursor: not-allowed !important;
    user-select: none;
}
/* Les cellules héritent du curseur mais restent traversables par les événements souris
   (nécessaire pour que mouseenter/mouseleave sur le <tr> se déclenchent) */
.row-protected td {
    cursor: not-allowed !important;
}
.row-protected td input[type="checkbox"] {
    pointer-events: none;
    cursor: not-allowed;
}

/* Tooltip flottant — ligne protégée */
#gcu-protected-tooltip {
    position: fixed;
    z-index: 9999;
    background: rgba(28, 32, 46, 0.94);
    color: #fff;
    padding: 7px 14px 7px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    display: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.10);
    transform: translate(-50%, calc(-100% - 10px));
}
#gcu-protected-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: rgba(28, 32, 46, 0.94);
}

/* Alertes */
.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
}

/* Modale d'édition / création */
.edit-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.edit-box {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0,0,0,0.4);
    width: 450px;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.edit-box h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
}

.edit-box .field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.edit-box label {
    font-weight: bold;
    font-size: 13px;
}

.edit-box input[type="text"],
.edit-box input[type="date"],
.edit-box select {
    padding: 8px;
    border: none;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    border-bottom: 2px solid #9c9c9c;
    background: #f6f6f6;
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 0px;
}

.edit-box .btn-bar {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.edit-box .btn-bar button {
    width: auto;
    padding: 8px 20px;
}

.btn-cancel {
    background: transparent;
    border: 1px solid;
    border-color: #000091;
    color: #000091;
}

.btn-cancel:hover {
    background: #F2F2F9;
}

/* Vérification disponibilité du login */
.login-status {
    font-size: 12px;
    margin-top: 4px;
    min-height: 16px;
    font-weight: 600;
}

.login-status-ok       { color: #155724; }
.login-status-taken    { color: #856404; }
.login-status-error    { color: #888; font-weight: 400; }
.login-status-checking { color: #4a6cf7; font-style: italic; font-weight: 400; }

/* =========================
   Responsive
   ========================= */
@media (max-width: 768px) {
    .profile-box {
        width: 95%;
        padding: 20px;
    }

    .action-buttons button {
        width: 45%;
    }

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

    .search-form input[type="text"],
    .search-form select {
        width: 140px;
    }

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

@media (max-width: 480px) {
    .top-left, .user-name {
        font-size: 12px;
    }

    .logout-btn, .return-btn {
        padding: 4px 8px;
        font-size: 12px;
    }

    input[type="password"], input[type="text"], input[type="email"] {
        width: 100%;
    }

    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .action-buttons button {
        width: 100%;
    }

    .search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form input[type="text"],
    .search-form select {
        width: 100%;
    }

    .search-form button {
        width: 100%;
        margin-top: 8px;
    }

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

    .actions-bar button {
        width: 100%;
    }

    .btn-create {
        margin-left: 0;
    }
}



/* =====================================================================
   AGIA — compléments (mêmes codes visuels que GCU WEB)
   ===================================================================== */
.top-bar .gcu-btn.actif { background-color: #1212FF; box-shadow: inset 0 -3px 0 #fff; }
.top-bar .gcu-btn + .gcu-btn { margin-left: 8px; }
.top-left .app-title { display: inline-flex; flex-direction: column; line-height: 1.1; }
.top-left .app-title small { font-size: 10px; font-weight: normal; opacity: .9; }

.admin-box.wide { width: 1200px; }
.admin-box h2 { margin-top: 0; }
.admin-box h3 {
    font-size: 15px; color: #000091; margin: 28px 0 10px; padding-bottom: 6px;
    border-bottom: 2px solid #649abe; display: flex; align-items: center; gap: 10px;
}
.admin-box h3 .h3-actions { margin-left: auto; display: flex; gap: 8px; }
.subtitle { text-align: center; color: #555; margin: -6px 0 24px; font-size: 13px; }

/* Boutons (même rendu que les boutons GCU, en taille contenue) */
.btn, button.btn {
    display: inline-flex; align-items: center; gap: 6px; width: auto;
    padding: 8px 15px; font-size: 13px; font-weight: 600; text-decoration: none;
    background-color: #000091; color: #fff; border: none; border-radius: 0; cursor: pointer;
    font-family: inherit; line-height: 1.2; box-sizing: border-box;
}
.btn:hover { background-color: #1212FF; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-grey { background-color: #6b7280; } .btn-grey:hover { background-color: #4b5563; }
.btn-red  { background-color: #cc0000; } .btn-red:hover  { background-color: #a30000; }
.btn-green{ background-color: #18753c; } .btn-green:hover{ background-color: #12592d; }
.btn-outline { background: #fff; color: #000091; border: 1px solid #000091; }
.btn-outline:hover { background: #e8edff; color: #000091; }

.alert-warn {
    background: #fff3cd; color: #856404; border: 1px solid #ffe08a;
    padding: 12px 16px; border-radius: 6px; margin-bottom: 15px; font-size: 13px;
}
.alert-info {
    background: #e8f0fe; color: #1e3a8a; border: 1px solid #c7d4f8;
    padding: 12px 16px; border-radius: 6px; margin-bottom: 15px; font-size: 13px;
}

/* Formulaires en grille */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field { display: flex; flex-direction: column; }
.form-grid label, .stack label { font-size: 13px; margin-bottom: 2px; }
.req { color: #cc0000; }
input[type="date"], input[type="number"], input[type="tel"], input[type="file"], select, textarea {
    width: 100%; padding: 8px; margin: 6px 0 14px 0; border: none; box-sizing: border-box;
    border-bottom: 2px solid #9c9c9c; background: #f6f6f6; font-family: inherit; font-size: 13px;
    border-top-left-radius: .25rem; border-top-right-radius: .25rem;
}
.form-grid input[type="text"], .form-grid input[type="email"] { width: 100%; margin: 6px 0 14px 0; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #000091; outline-offset: -2px; }
.hint { font-size: 12px; color: #666; margin: -10px 0 12px; }
.checkline { display: flex; gap: 8px; align-items: center; font-weight: normal; margin: 6px 0 12px; font-size: 13px; }
.checkline input { width: auto; margin: 0; }
fieldset { border: 1px solid #ddd; padding: 12px 16px 4px; margin: 0 0 16px; background: #fcfcfc; }
legend { font-weight: bold; font-size: 13px; color: #000091; padding: 0 6px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* Recherche : variante compacte */
.search-form.compact { margin: 20px 0 20px; }
.search-form input[type="search"] {
    padding: 8px; border: none; font-size: 13px; width: 240px; height: 34px; box-sizing: border-box;
    border-bottom: 2px solid #9c9c9c; background: #f6f6f6; border-top-left-radius: .25rem; border-top-right-radius: .25rem;
}
.search-form select { margin: 0; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
.result-table td a { color: #000091; }
.result-table .num { text-align: right; white-space: nowrap; }
.empty { text-align: center; color: #777; padding: 24px; font-style: italic; }

/* Badges d'état */
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 35px; font-size: 11.5px; font-weight: bold;
    border: 1px solid currentColor; white-space: nowrap; background: #fff;
}
.b-green { color: #18753c; background: #e3f4e8; }
.b-blue  { color: #000091; background: #e8edff; }
.b-orange{ color: #9a5b00; background: #fff1d6; }
.b-red   { color: #cc0000; background: #fde8e8; }
.b-grey  { color: #555;    background: #f0f0f0; }

/* Fiche élève */
.fiche-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.fiche-head .avatar {
    width: 64px; height: 64px; background: #649abe; color: #fff; font-size: 24px; font-weight: bold;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fiche-head h2 { text-align: left; margin: 0; }
.fiche-head .meta { font-size: 13px; color: #555; margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fiche-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.kv { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
.kv th { width: 30%; padding: 8px 10px; background: #f3f3f3; border: 1px solid #ddd; text-align: left; font-weight: bold; }
.kv td { padding: 8px 10px; border: 1px solid #ddd; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card { background: #fff; border: 1px solid #ddd; padding: 12px 14px; font-size: 13px; }
.card .card-title { font-weight: bold; color: #000091; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.muted { color: #777; }
.timeline { border-left: 3px solid #649abe; margin: 0; padding: 0 0 0 16px; list-style: none; font-size: 13px; }
.timeline li { margin-bottom: 12px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -23px; top: 3px; width: 11px; height: 11px; background: #000091; border: 2px solid #fff; border-radius: 50%; }
.inline-form { display: inline; }
.inline-form button { width: auto; }
.danger-zone { border: 1px solid #f5c6cb; background: #fff8f8; padding: 14px 16px; margin-top: 16px; }
.tag { font-family: ui-monospace, Consolas, monospace; background: #f3f3f3; padding: 1px 5px; font-size: 12px; user-select: all; }
.vars { columns: 3 260px; column-gap: 24px; font-size: 12.5px; }
.vars .grp { break-inside: avoid; margin-bottom: 14px; }
.vars .grp b { display: block; color: #000091; margin-bottom: 4px; }
.vars .grp div { margin: 2px 0; }

@media (max-width: 760px) {
    .cols-2 { grid-template-columns: 1fr; }
    .top-bar { height: auto; min-height: 50px; flex-wrap: wrap; padding: 6px 12px; gap: 6px; }
    .top-bar .gcu-btn { margin-left: 0; }
    .admin-box { margin-top: 110px; padding: 18px; }
    .fiche-head .actions { margin-left: 0; }
}
