/* ===================================
   TESTCIVIQUE - PAGE FORMATIONS
   Fichier: formation.css
   Description: Styles pour la page des formations avec carte interactive
   =================================== */

body {
    background-color: var(--bg-body);
}

main {
    padding-top: 80px !important;
}

/* LOCATOR LAYOUT */
.locator-wrapper {
    display: grid;
    grid-template-columns: 450px 1fr;
    min-height: calc(100vh - 80px);
    position: relative;
}

/* SIDEBAR */
.centers-sidebar {
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

.sidebar-header {
    padding: 30px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
}

.sidebar-header h1 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.sidebar-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Tabs de filtres - visibles sur desktop aussi */
.mobile-filter-tabs {
    display: flex;
    gap: 10px;
    padding: 4px;
    background: #F1F5F9;
    border-radius: 12px;
    margin-bottom: 16px;
}

.filter-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.3s;
    text-align: center;
    color: var(--text-muted);
}

.filter-tab.active {
    background: white;
    color: var(--text-main);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

.search-box input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 1rem;
    color: var(--text-main);
    font-family: 'Inter';
}

.search-icon {
    font-size: 1.2rem;
    margin-right: 10px;
    color: var(--text-muted);
}

.centers-list {
    padding: 20px;
    padding-bottom: 80px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.center-card {
    background: white;
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #E2E8F0 0%, #F1F5F9 100%) border-box;
}

.center-card:hover {
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.2);
    transform: translateY(-4px);
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, var(--cyan) 0%, #0090ad 100%) border-box;
}

.center-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 6px;
    display: block;
    color: var(--text-main);
}

.center-address {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 15px;
    display: block;
}

.center-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.c-tag {
    font-size: 0.7rem;
    background: #E0F2FE;
    color: #0369A1;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 600;
}

.btn-contact-center {
    margin-top: 15px;
    width: 100%;
    padding: 11px;
    border: none;
    background: var(--cyan);
    color: var(--text-main);
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

.btn-contact-center:hover {
    background: #00B8DB;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.4);
}

/* Texte des boutons - par défaut texte complet visible */
.btn-text-short {
    display: none;
}

.btn-text-full {
    display: inline;
}

/* MAP */
.map-frame {
    background-color: #E5E7EB;
    position: sticky;
    top: 80px;
    width: 100%;
    height: calc(100vh - 80px);
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
}

/* CONTACT PANEL */
.contact-panel {
    position: fixed;
    top: 100px;
    bottom: auto;
    right: 20px;
    width: 380px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    transform: translateX(calc(100% + 50px));
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 1200;
    padding: 24px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.contact-panel.active {
    transform: translateX(0);
}

.close-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    background: var(--bg-body);
    border: none;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.close-panel:hover {
    background: var(--text-main);
    color: white;
}

.cp-header {
    margin-bottom: 15px;
}

.cp-header h2 {
    font-size: 1.2rem;
    margin-bottom: 3px;
}

.cp-address {
    font-style: normal;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.form-group {
    margin-bottom: 10px;
}

.label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 3px;
}

.input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-body);
    font-family: 'Inter';
    font-size: 0.8rem;
    outline: none;
}

.input:focus {
    background: white;
    border-color: var(--cyan);
}

.btn-submit {
    width: 100%;
    padding: 10px;
    background: var(--cyan);
    color: var(--text-main);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    font-size: 0.8rem;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.info-box {
    background: #F0F9FF;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.7rem;
    color: #0F172A;
    border: 1px solid #BAE6FD;
}

/* FOOTER SIDEBAR */
.sidebar-footer {
    padding: 30px 24px;
    background: #F8FAFC;
    border-top: 1px solid var(--border);
    text-align: center;
    margin-top: auto;
}

.footer-logo {
    font-family: 'Anton';
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 10px;
    display: block;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.footer-links a {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
}

.copyright {
    font-size: 0.7rem;
    color: #94A3B8;
}

/* PAGINATION */
.pagination-container {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    margin-top: auto;
}

.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
}

.page-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-btn:not(:disabled):hover {
    background: var(--bg-body);
    border-color: var(--cyan);
}

.page-btn.active {
    background: var(--cyan);
    color: var(--text-main);
    border-color: var(--cyan);
}

.page-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

/* Overlay backdrop - désactivé sur desktop, actif uniquement sur mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

/* Pas d'overlay actif sur desktop */
.sidebar-overlay.active {
    display: none;
    opacity: 0;
    pointer-events: none;
}

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

/* TABLETTE (1024px et moins) */
@media (max-width: 1024px) {
    .locator-wrapper {
        grid-template-columns: 400px 1fr;
    }

    .sidebar-header h1 {
        font-size: 1.8rem;
    }

    .center-card {
        padding: 18px;
    }
}

/* MOBILE (768px et moins) */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    main {
        padding-top: 60px !important;
    }

    .locator-wrapper {
        display: flex;
        flex-direction: column;
        margin-bottom: 0;
        max-width: 100%;
        overflow-x: hidden;
        height: auto;
    }

    /* Carte affichée en haut */
    .map-frame {
        height: 45vh;
        position: relative;
        top: 0;
        width: 100%;
        order: 1;
        overflow: visible !important;
    }

    /* Tabs de filtres mobiles */
    .mobile-filter-tabs {
        display: flex !important;
        gap: 10px;
        padding: 4px;
        background: #F1F5F9;
        border-radius: 12px;
        margin-top: 16px;
    }

    .filter-tab {
        flex: 1;
        padding: 10px;
        background: transparent;
        border: none;
        border-radius: 8px;
        font-weight: 600;
        font-size: 0.85rem;
        cursor: pointer;
        transition: 0.3s;
        text-align: center;
        color: var(--text-muted);
    }

    .filter-tab.active {
        background: white;
        color: var(--text-main);
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    /* Sidebar des centres - scrollable normalement */
    .centers-sidebar {
        border-right: none;
        border-top: 1px solid var(--border);
        border-radius: 24px 24px 0 0;
        margin-top: -20px;
        z-index: 20;
        box-shadow: 0 -10px 30px rgba(0,0,0,0.05);
        background: white;
        display: flex;
        flex-direction: column;
        min-height: 30vh;
        order: 2;
        overflow-y: visible;
    }

    /* Header de la sidebar sur mobile */
    .sidebar-header {
        padding: 24px;
        background: white;
        border-bottom: 1px solid var(--border);
        border-radius: 24px 24px 0 0;
    }

    .sidebar-header h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    /* Cacher la description et le search box sur mobile */
    .sidebar-header p,
    .search-box {
        display: none;
    }

    .centers-list {
        padding: 16px;
        padding-bottom: 40px;
        gap: 12px;
    }

    .center-card {
        background: white;
        border: 2px solid transparent;
        border-radius: 16px;
        padding: 18px;
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        background: linear-gradient(white, white) padding-box,
                    linear-gradient(135deg, #E2E8F0 0%, #F1F5F9 100%) border-box;
    }

    .center-card:hover {
        border-color: transparent;
        box-shadow: 0 8px 24px rgba(0, 212, 255, 0.2);
        transform: translateY(-4px);
        background: linear-gradient(white, white) padding-box,
                    linear-gradient(135deg, var(--cyan) 0%, #0090ad 100%) border-box;
    }

    .center-name {
        font-weight: 700;
        font-size: 1rem;
        margin-bottom: 6px;
        display: block;
        color: var(--text-main);
    }

    .center-address {
        font-size: 0.85rem;
        margin-bottom: 12px;
        line-height: 1.4;
        color: var(--text-muted);
    }

    .center-tags {
        gap: 8px;
        margin-bottom: 12px;
    }

    .c-tag {
        font-size: 0.7rem;
        background: #E0F2FE;
        color: #0369A1;
        padding: 5px 10px;
        border-radius: 6px;
        font-weight: 600;
    }

    .btn-contact-center {
        margin-top: 12px;
        padding: 11px 20px;
        border: none;
        background: var(--cyan);
        color: var(--text-main);
        border-radius: 10px;
        font-weight: 700;
        cursor: pointer;
        font-size: 0.8rem;
        transition: all 0.3s;
        box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
        width: auto;
        display: inline-block;
    }

    .btn-contact-center:hover {
        background: #00B8DB;
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 212, 255, 0.4);
    }

    /* Afficher le texte complet sur mobile aussi */
    .btn-text-full {
        display: inline;
    }

    .btn-text-short {
        display: none;
    }

    /* Pagination responsive */
    .pagination-container {
        margin-bottom: 20px;
    }

    /* Pas d'overlay sur mobile - on garde juste le formulaire */
    .sidebar-overlay {
        display: none !important;
    }

    .sidebar-overlay.active {
        display: none !important;
    }

    /* Panel de contact en modal bottom sheet */
    .contact-panel {
        position: fixed;
        inset: auto 0 0 0;
        width: 100%;
        height: 90vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        padding: 20px;
        padding-bottom: 30px;
        max-height: 90vh;
        overflow-y: auto;
        z-index: 99999;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
        background: white;
        transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .contact-panel.active {
        transform: translateY(0);
    }

    .close-panel {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
        font-size: 1.3rem;
    }

    .cp-header {
        margin-bottom: 18px;
    }

    .cp-header h2 {
        font-size: 1.4rem;
        margin-bottom: 4px;
    }

    .cp-address {
        font-size: 0.8rem;
    }

    .label {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }

    .input {
        padding: 11px 12px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .btn-submit {
        padding: 13px;
        font-size: 0.9rem;
        border-radius: 10px;
    }

    .info-box {
        padding: 10px;
        font-size: 0.75rem;
        margin-bottom: 12px;
    }

    /* Footer - Même style que les autres pages */
    footer {
        padding: 40px 0;
        font-size: 0.85rem;
    }

    footer a {
        display: block;
        margin: 8px 0 !important;
    }
}

/* PETIT MOBILE (480px et moins) */
@media (max-width: 480px) {
    body {
        overflow-x: hidden;
    }

    main {
        padding-top: 60px !important;
    }

    .locator-wrapper {
        max-width: 100%;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .map-frame {
        height: 40vh;
        order: 1;
    }

    /* Tabs de filtres sur petit mobile */
    .mobile-filter-tabs {
        padding: 3px;
        gap: 8px;
        margin-top: 12px;
    }

    .filter-tab {
        padding: 9px 14px;
        font-size: 0.8rem;
    }

    /* Sidebar sur petit mobile - scrollable */
    .centers-sidebar {
        min-height: 35vh;
        order: 2;
    }

    .sidebar-header {
        padding: 18px 16px;
    }

    .sidebar-header h1 {
        font-size: 1.6rem;
    }

    .sidebar-header p {
        font-size: 0.85rem;
        margin-bottom: 14px;
    }

    .search-box {
        padding: 9px 11px;
    }

    .search-box input {
        font-size: 0.85rem;
    }

    .centers-list {
        padding: 14px;
        padding-bottom: 30px;
        gap: 10px;
    }

    .center-card {
        padding: 16px;
        border-radius: 16px;
    }

    .center-name {
        font-size: 0.95rem;
    }

    .center-address {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .c-tag {
        font-size: 0.65rem;
        padding: 4px 8px;
    }

    .btn-contact-center {
        margin-top: 10px;
        padding: 10px 18px;
        font-size: 0.75rem;
        width: auto;
        display: inline-block;
    }

    /* Texte complet sur petit mobile aussi */
    .btn-text-full {
        display: inline;
    }

    .btn-text-short {
        display: none;
    }

    /* Overlay backdrop visible sur petit mobile */
    .sidebar-overlay {
        display: none !important;
    }

    .contact-panel {
        padding: 20px 18px;
        padding-bottom: 30px;
    }

    .close-panel {
        top: 12px;
        right: 12px;
    }

    .cp-header h2 {
        font-size: 1.3rem;
    }

    .cp-address {
        font-size: 0.75rem;
    }

    .label {
        font-size: 0.7rem;
    }

    .input {
        padding: 10px 11px;
        font-size: 0.85rem;
    }

    .form-group {
        margin-bottom: 11px;
    }

    .btn-submit {
        padding: 12px;
        font-size: 0.85rem;
    }

    .info-box {
        padding: 9px;
        font-size: 0.7rem;
    }

    /* Overlay backdrop pour le contact panel */
    .sidebar-overlay {
        display: block !important;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
        z-index: 1040;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    /* Panel de contact en modal bottom sheet */
    .contact-panel {
        position: fixed;
        bottom: 0;
        top: auto;
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 24px 24px 0 0;
        transform: translateY(110%);
        transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
        max-height: 85vh;
        overflow-y: auto;
        padding: 24px 20px;
        z-index: 1050;
    }

    .contact-panel.active {
        transform: translateY(0);
    }

    .close-btn {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
        font-size: 1.3rem;
    }
}
