/* =========================================
   SWIMRUN - ALL COURSES SHORTCODE
   [afficher_toutes_les_courses]
   ========================================= */

:root {
    --swimrun-yellow: #fedd02;
    --swimrun-black: #000000;
    --swimrun-gray: #666666;
    --swimrun-gray-light: #999999;
    --swimrun-gray-dark: #3a3a3a;
    --swimrun-white: #ffffff;
}

/* =========================================
   1. WRAPPER PRINCIPAL
   ========================================= */
.swimrun-all-courses-wrapper {
    background: var(--swimrun-black);
    border-radius: 30px;
    overflow: visible;
    font-family: 'Antonio', sans-serif;
    position: relative;
    box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.13);
}

/* =========================================
   2. HEADER
   ========================================= */
.swimrun-all-header {
    display: flex;
    justify-content: center;
    position: relative;
}

.swimrun-all-courses-wrapper[data-count="2"] .swimrun-all-header {
    padding: 0;
    margin-top: 50px;
}

.swimrun-all-courses-wrapper:not([data-count="2"]) .swimrun-all-header {
    padding: 25px 30px 15px;
    margin-top: 50px;
}

/* =========================================
   3. TOGGLE SWITCH (2 COURSES)
   Label - [SWITCH] - Label
   ========================================= */
.swimrun-toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #000;
    border-radius: 50px;
    padding: 8px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    margin-top: -20px;
}

/* Labels à gauche et droite */
.swimrun-toggle-label {
    font-family: 'Antonio', sans-serif;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: color 0.3s ease;
    white-space: nowrap;
    color: var(--swimrun-gray-light);
}

.swimrun-toggle-label.active {
    color: var(--swimrun-white);
}

.swimrun-toggle-label:hover:not(.active) {
    color: var(--swimrun-white);
}

/* Le switch lui-même */
.swimrun-toggle-switch {
    width: 50px;
    height: 28px;
    background: var(--swimrun-black);
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    border: 2px solid #fedd02;
    transition: border-color 0.3s ease;
}

.swimrun-toggle-switch:hover {
    border-color: var(--swimrun-yellow);
}

/* La pill jaune qui glisse */
.swimrun-toggle-pill {
    position: absolute;
    top: 3px;
    width: 18px;
    height: 18px;
    background: var(--swimrun-yellow);
    border-radius: 50%;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Position gauche (index 0) */
.swimrun-toggle-switch[data-position="0"] .swimrun-toggle-pill {
    left: 3px;
}

/* Position droite (index 1) */
.swimrun-toggle-switch[data-position="1"] .swimrun-toggle-pill {
    left: 25px;
}

/* =========================================
   4. TABS (3+ COURSES)
   ========================================= */
.swimrun-tabs-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin-top: -60px;
    background-color: #000;
    padding: 0px 60px;
    border-radius: 20px;
}

.swimrun-tab-btn {
    background: transparent;
    border: none;
    color: var(--swimrun-gray);
    font-family: 'Antonio', sans-serif;
    font-weight: 700;
    font-size: 16px;
    padding: 8px 5px;
    cursor: pointer;
    transition: color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

.swimrun-tab-btn.active {
    color: var(--swimrun-yellow);
}

.swimrun-tab-btn:hover:not(.active) {
    color: var(--swimrun-white);
}

.swimrun-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: var(--swimrun-yellow);
    border-radius: 2px;
}

/* =========================================
   5. PANELS
   ========================================= */
.swimrun-all-content {
    position: relative;
}

.swimrun-course-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.swimrun-course-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =========================================
   6. INFOS COURSE
   ========================================= */
.swimrun-course-info {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    padding: 25px 30px 20px;
    gap: 150px;
}

.swimrun-all-courses-wrapper[data-count="2"] .swimrun-course-info {
    padding-top: 35px;
}

.swimrun-course-info-left {
}

.swimrun-course-title {
    color: var(--swimrun-yellow);
    font-family: 'Antonio', sans-serif;
    font-weight: 700;
    font-size: 28px;
    text-transform: uppercase;
    margin: 0 0 5px 0;
    line-height: 1.2;
    letter-spacing: 1px;
}

.swimrun-course-route {
    color: var(--swimrun-white);
    font-family: 'Antonio', sans-serif;
    font-weight: 700;
    font-size: 18px;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.swimrun-course-datetime {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.swimrun-datetime-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.swimrun-datetime-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
    opacity: 1 !important;
}

.swimrun-datetime-text {
    color: #fff;
    font-family: 'Antonio', sans-serif;
    font-weight: 400;
    font-size: 15px;
}

.swimrun-course-info-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.swimrun-distance-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.swimrun-distance-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

.swimrun-distance-text {
    color: var(--swimrun-white);
    font-family: 'Antonio', sans-serif;
    font-weight: 400;
    font-size: 16px;
    white-space: nowrap;
}

/* =========================================
   7. CARTE BORD À BORD
   ========================================= */
.swimrun-course-map-wrapper .swimrun-map-wrapper {
    margin-bottom: 0;
    border-radius: 0 0 30px 30px;
    box-shadow: none;
}

.swimrun-course-map-wrapper .swimrun-map-container {
    border-radius: 0;
}

.swimrun-course-map-wrapper .swimrun-elevation-container {
    border-radius: 0 0 30px 30px;
}

/* =========================================
   8. FIX PROFIL - Zones swim & POI
   Les éléments ne doivent pas dépasser
   ========================================= */
.swimrun-course-map-wrapper .swimrun-elevation-container svg.background {
    overflow: hidden;
}

.swimrun-course-map-wrapper .swimrun-elevation-container .elevation-control {
    overflow: hidden;
}

/* =========================================
   9. RESPONSIVE TABLETTE
   ========================================= */
@media (max-width: 900px) {
    .swimrun-course-info {
        flex-direction: column;
        gap: 20px;
    }

    .swimrun-course-info-right {
        width: 100%;
    }

    .swimrun-course-title {
        font-size: 24px;
    }

    .swimrun-course-route {
        font-size: 16px;
    }
}

/* =========================================
   10. RESPONSIVE MOBILE
   ========================================= */
@media (max-width: 600px) {
    .swimrun-all-courses-wrapper[data-count="2"] .swimrun-all-header {
        margin-top: 50px;
    }

    .swimrun-download-btn {
        margin-top: 20px !important;
    }

    .swimrun-toggle-container {
        padding: 15px 45px;
        gap: 10px;
    }

    .swimrun-toggle-label {
        font-size: 12px;
    }

    .swimrun-toggle-switch {
        width: 44px;
        height: 24px;
    }

    .swimrun-toggle-pill {
        width: 14px;
        height: 14px;
        top: 3px;
    }

    .swimrun-toggle-switch[data-position="1"] .swimrun-toggle-pill {
        left: 24px;
    }

    .swimrun-all-courses-wrapper:not([data-count="2"]) .swimrun-all-header {
        padding: 20px 15px 10px;
    }

    .swimrun-tabs-wrapper {
        flex-direction: column;
        width: 100%;
        gap: 5px;
    }

    .swimrun-tab-btn {
        width: 100%;
        text-align: center;
        font-size: 14px;
        padding: 12px 10px;
    }

    .swimrun-tab-btn.active::after {
        display: none;
    }

    .swimrun-course-info {
        padding: 20px 15px 15px;
        justify-content: flex-start;
        align-items: flex-start;
    }

    .swimrun-all-courses-wrapper[data-count="2"] .swimrun-course-info {
        padding-top: 25px;
    }

    .swimrun-course-title {
        font-size: 20px;
    }

    .swimrun-course-route {
        font-size: 14px;
    }

    .swimrun-course-datetime {
        gap: 15px;
    }

    .swimrun-datetime-text {
        font-size: 13px;
    }

    .swimrun-distance-text {
        font-size: 14px;
    }

    .swimrun-distance-icon {
        width: 20px;
        height: 20px;
    }
}

/* =========================================
   11. 1 SEULE COURSE
   ========================================= */
.swimrun-all-courses-wrapper[data-count="1"] .swimrun-all-header {
    display: none;
}

.swimrun-all-courses-wrapper[data-count="1"] .swimrun-course-info {
    padding-top: 30px;
}

/* =========================================
   12. BOUTON PLEIN ÉCRAN
   ========================================= */
.swimrun-fullscreen-btn {
    position: absolute;
    top: 12px;
    right: 15px;
    background: #111;
    border: 2px solid #fedd02;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
}

.swimrun-fullscreen-btn:hover {
    background: #fedd02;
    color: #000;
}

/* =========================================
   13. MODE PLEIN ÉCRAN
   La hauteur de .swimrun-map-container est
   calculée et injectée dynamiquement par JS
   ========================================= */
body.swimrun-fs-active {
    overflow: hidden;
}

.swimrun-all-courses-wrapper.is-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: block;
}

/* Header compact en fullscreen */
.swimrun-all-courses-wrapper.is-fullscreen .swimrun-all-header {
    margin-top: 15px !important;
    padding-top: 0 !important;
}

/* Infos cours compactes en fullscreen */
.swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-info {
    padding-top: 12px !important;
    padding-bottom: 8px !important;
    gap: 80px;
}

.swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-title {
    font-size: 22px;
}

.swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-route {
    font-size: 15px;
    margin-bottom: 5px;
}

/* Suppression des border-radius sur carte et profil */
.swimrun-all-courses-wrapper.is-fullscreen .swimrun-map-wrapper {
    border-radius: 0 !important;
    margin-bottom: 0;
    box-shadow: none;
}

.swimrun-all-courses-wrapper.is-fullscreen .swimrun-map-container {
    border-radius: 0 !important;
}

.swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-map-wrapper .swimrun-map-wrapper {
    border-radius: 0 !important;
}

.swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-map-wrapper .swimrun-elevation-container {
    border-radius: 0 !important;
}

/* Profil d'élévation plus compact en fullscreen */
.swimrun-all-courses-wrapper.is-fullscreen .swimrun-elevation-container {
    padding: 5px 10px 5px 10px !important;
    min-height: 0 !important;
}

.swimrun-all-courses-wrapper.is-fullscreen .swimrun-elevation-container svg.background {
    max-height: 110px;
}

.swimrun-all-courses-wrapper.is-fullscreen .swimrun-custom-summary {
    padding: 2px 20px 5px !important;
    margin-top: -10px;
}

/* Bouton fermer repositionné en fullscreen */
.swimrun-all-courses-wrapper.is-fullscreen .swimrun-fullscreen-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 100000;
}

/* =========================================
   14. FULLSCREEN GRAND ÉCRAN (>1500px)
   Tout sur 1 ligne, tout à gauche, tout blanc
   ========================================= */
@media (min-width: 1500px) {
    .swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-info {
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        gap: 25px !important;
        padding-top: 10px !important;
        padding-bottom: 6px !important;
    }

    .swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-info-left {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 20px;
        flex-wrap: nowrap;
        flex-shrink: 0;
    }

    .swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-title {
        color: #fff !important;
        font-size: 20px;
        margin-bottom: 0;
        white-space: nowrap;
    }

    .swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-route {
        color: #fff !important;
        font-size: 14px;
        margin-bottom: 0;
        white-space: nowrap;
    }

    .swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-datetime {
        flex-wrap: nowrap;
        gap: 15px;
    }

    /* Les distances restent à gauche aussi, juste après les infos */
    .swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-info-right {
        flex-direction: row;
        align-items: center;
        gap: 20px;
        flex-shrink: 0;
        margin-left: 0;
    }
}

/* =========================================
   15. FULLSCREEN RESPONSIVE MOBILE
   ========================================= */
@media (max-width: 600px) {
    .swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-info {
        flex-direction: column;
        gap: 8px;
        padding-top: 8px !important;
        padding-bottom: 6px !important;
    }

    .swimrun-all-courses-wrapper.is-fullscreen .swimrun-course-title {
        font-size: 18px;
    }
}