/**
 * style.css - Waze School Manager
 * @version 0.4.19
 * Feuille de style principale (Nettoyée et optimisée)
 */

/* --- BASE --- */
* {
    border-radius: 0 !important;
    --bs-border-radius: 0 !important;
    --bs-btn-border-radius: 0 !important;
}

body {
    background-color: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* --- NAVBAR --- */
.navbar {
    background-color: #0099cc !important;
    border-bottom: 3px solid #0077a3;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 1) !important;
}

.nav-link.active {
    color: #fff !important;
    font-weight: 700;
}

/* --- STATS & FILTERS --- */
.stat-card {
    border-radius: 12px;
    padding: 10px;
    color: white;
    text-align: center;
    border: none;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.sticky-filters {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #f0f2f5;
    padding: 15px 0;
}

/* --- Animation de sortie (Action Valider/Annuler) --- */
.card-school-container {
    transition: all 0.5s ease-in-out;
    opacity: 1;
    transform: translateX(0);
    max-height: 800px;
    overflow: visible;
}

.card-school-container.leaving {
    opacity: 0 !important;
    /* Le !important gagne contre le style JS */
    transform: translateX(-100px) !important;
    max-height: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden;
    pointer-events: none;
}

.card-school {
    border: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    background: white;
    animation: fadeIn 0.3s ease;
}

.card-school:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

/* Animation de sortie (Action Valider/Annuler) */
.card-school-container.leaving {
    opacity: 0;
    transform: translateX(-100px);
    max-height: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden;
}

/* --- FONDS DE CARTES PAR CATEGORIE --- */
.card-school {
    background-color: #dceeff !important;
}

/* Ecole par defaut */
.card-school.row-autoecole {
    background-color: #fff3cd !important;
}

.card-school.row-kindergarden {
    background-color: #ffe5e8 !important;
}

/* Validées (bordure de base #198754 geree en inline) */
.row-validated .card-school {
    background-color: #e8f5e9 !important;
}

.row-validated .card-school.row-kindergarden {
    background-color: #fce4ec !important;
}

.row-validated .card-school.row-autoecole {
    background-color: #fff8e1 !important;
}

/* HOVER */
.card-school:hover {
    background-color: #bbdefb !important;
}

.card-school.row-autoecole:hover {
    background-color: #ffe082 !important;
}

.card-school.row-kindergarden:hover {
    background-color: #ffcdd2 !important;
}

.row-validated .card-school:hover {
    background-color: #c8e6c9 !important;
}

.row-validated .card-school.row-kindergarden:hover {
    background-color: #f8bbd0 !important;
}

.row-validated .card-school.row-autoecole:hover {
    background-color: #ffecb3 !important;
}


/* --- BADGES & UI ELEMENTS --- */
.badge-france {
    background: rgba(255, 255, 255, 0.15);
    font-size: 0.75rem;
    padding: 5px 12px;
    border-radius: 50px;
}

.date-extraction {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding-left: 15px;
}

.badge-editor {
    background: #e0f7fa;
    color: #006064;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.badge-source {
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 50px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 8px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s;
}

.badge-source:hover {
    transform: scale(1.05);
}

.badge-source i {
    font-style: normal;
    font-size: 1.1rem;
}

.source-ban {
    background-color: #333;
    color: white;
}

.source-waze {
    background-color: #0099cc;
    color: white;
}

/* Commentaires & Interactions */
.badge-comment {
    background-color: #fff9db;
    border-left: 3px solid #fcc419;
    color: #212529;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.btn-spyglass {
    cursor: pointer;
    transition: 0.2s;
    display: inline-block;
    margin-left: 5px;
}

.btn-spyglass:hover {
    transform: scale(1.3);
}

/* --- TOOLTIPS --- */
.tooltip-inner {
    background-color: #051937 !important;
    border: 1px solid #0099cc;
    max-width: 300px;
    padding: 8px 12px;
    text-align: center;
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #051937 !important;
}

/* --- BOUTONS --- */
.btn {
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .card-school .row>div {
        margin-bottom: 10px;
    }

    .sticky-filters {
        position: relative;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
    }

    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 5px;
    }
}

/* --- KEYFRAMES --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* --- LOADING STATE --- */
.loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #ddd;
    border-top-color: #0099cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* --- BACK TO TOP BUTTON --- */
#backToTop {
    display: none;
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    width: 45px;
    height: 45px;
    background-color: #000;
    color: #fff;
    border-radius: 50% !important;
    /* Force le rond malgré notre global * { border-radius: 0 } */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s, transform 0.2s;
    font-size: 1.2rem;
}

#backToTop:hover {
    background-color: #333;
    transform: translateY(-3px);
}

/* --- AUTOCOMPLETE COMMENTAIRES --- */
.comment-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 99999;
    max-height: 220px;
    overflow-y: auto;
}

.autocomplete-dropdown li {
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: #212529;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-dropdown li:last-child {
    border-bottom: none;
}

.autocomplete-dropdown li:hover,
.autocomplete-dropdown li.active {
    background-color: #e8f4fd;
    color: #0099cc;
    font-weight: 500;
}

.autocomplete-dropdown li mark {
    background: none;
    color: #0099cc;
    font-weight: 700;
    padding: 0;
}