/* =========================================================
   LEGEND STABLES MOBILE
   FASE 1A - BASISLAYOUT
   Alleen actief op kleinere schermen.
   Desktop blijft volledig ongewijzigd.
========================================================= */

@media (max-width: 1100px) {

    html,
    body {
        width: 100%;
        max-width: 100%;
        margin: 0;
        overflow-x: hidden;
    }

    .site-wrapper {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .layout-wrapper {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        gap: 12px;
        padding: 12px;
    }

    .sidebar {
        width: 100%;
        max-width: 100%;
        flex: none;
    }

    .main-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 16px;
        border-radius: 12px;
    }

    .main-content > * {
        max-width: 100%;
        min-width: 0;
    }

}

/* Kleinere telefoons */
@media (max-width: 600px) {

    .layout-wrapper {
        padding: 8px;
        gap: 8px;
    }

    .main-content {
        padding: 10px;
        border-radius: 9px;
        min-height: 0;
    }

}


/* =========================================================
   MOBILE NAVIGATION V1
   Sidebar wordt op tablet/telefoon een uitschuifmenu.
========================================================= */

.ls-mobile-menu-toggle,
.ls-mobile-menu-close,
.ls-mobile-menu-backdrop {
    display: none;
}

@media (max-width: 1100px) {

    .layout-wrapper {
        display: block;
        position: relative;
    }

    .ls-mobile-menu-toggle {
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 10020;

        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;

        min-height: 44px;
        padding: 8px 13px;

        border: 1px solid rgba(72, 91, 59, .24);
        border-radius: 12px;

        background: rgba(250, 250, 245, .96);
        color: #30462c;

        box-shadow: 0 5px 18px rgba(28, 43, 25, .18);

        font-size: 15px;
        cursor: pointer;
    }

    .ls-mobile-menu-toggle > span {
        font-size: 20px;
        line-height: 1;
    }

    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        z-index: 10030;

        width: min(340px, 88vw) !important;
        max-width: 88vw !important;
        height: 100vh;
        height: 100dvh;

        padding: 62px 12px 24px;

        overflow-x: hidden;
        overflow-y: auto;

        background:
            linear-gradient(
                180deg,
                rgba(241,245,236,.99),
                rgba(230,236,222,.99)
            );

        box-shadow: 12px 0 35px rgba(27, 39, 23, .24);

        transform: translateX(-105%);
        transition: transform .24s ease;

        opacity: 1;
    }

    body.ls-mobile-nav-open .sidebar {
        transform: translateX(0);
    }

    .sidebar .sidebar-section {
        width: 100%;
        max-width: 100%;
        margin-bottom: 12px;
    }

    .ls-mobile-menu-close {
        position: absolute;
        top: 12px;
        right: 12px;

        display: inline-flex;
        align-items: center;
        justify-content: center;

        width: 40px;
        height: 40px;

        padding: 0;

        border: 1px solid rgba(72, 91, 59, .18);
        border-radius: 50%;

        background: rgba(255,255,255,.88);
        color: #34472f;

        font-size: 27px;
        font-weight: 400;
        line-height: 1;

        cursor: pointer;
    }

    .ls-mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 10025;

        background: rgba(20, 30, 18, .42);
        backdrop-filter: blur(2px);
    }

    body.ls-mobile-nav-open .ls-mobile-menu-backdrop {
        display: block;
    }

    body.ls-mobile-nav-open {
        overflow: hidden;
    }

    .main-content {
        width: 100%;
        max-width: 100%;
    }
}

/* END MOBILE NAVIGATION V1 */





/* =========================================================
   MOBILE STATUSBAR V2
   Eén compacte balk, details inklapbaar.
========================================================= */

.ls-mobile-status-v2 {
    display: none;
}

@media (max-width: 1100px) {

    /* Desktop navigatie zit mobiel onder ☰ Menu */
    .top-navigation {
        display: none !important;
    }

    /* Header/banner compacter, zonder rare schaaltrucs */
    .topbar-main {
        width: 100% !important;
        max-width: 100% !important;
        height: 175px !important;

        background-size: cover !important;
        background-position: center !important;
    }

    .topbar-main .logo img {
        max-height: 110px !important;
        width: auto !important;
    }

    /* Oude uitgebreide desktop-statusbalk mobiel volledig weg */
    .topbar-stats {
        display: none !important;
    }

    /* Nieuwe compacte balk */
    .ls-mobile-status-v2 {
        display: block;

        width: 100%;
        max-width: 100%;

        margin: 0;

        background:
            linear-gradient(
                180deg,
                #79a947 0%,
                #527b2d 100%
            );

        border-top: 1px solid rgba(255,255,255,.18);
        border-bottom: 1px solid rgba(45,72,31,.25);

        color: white;

        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.13),
            inset 0 -5px 13px rgba(0,0,0,.10);
    }

    .ls-mobile-status-v2 summary {
        display: grid;

        grid-template-columns:
            minmax(0, 1fr)
            auto
            auto
            24px;

        align-items: center;

        gap: 8px;

        width: 100%;

        padding: 9px 10px;

        cursor: pointer;

        list-style: none;
    }

    .ls-mobile-status-v2 summary::-webkit-details-marker {
        display: none;
    }

    .ls-mobile-status-rider {
        min-width: 0;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;

        font-size: 13px;
        font-weight: 800;
    }

    .ls-mobile-status-level,
    .ls-mobile-status-money {
        padding: 4px 7px;

        border-radius: 7px;

        background: rgba(0,0,0,.13);

        font-size: 11px;
        font-weight: 700;

        white-space: nowrap;
    }

    .ls-mobile-status-arrow {
        display: flex;
        align-items: center;
        justify-content: center;

        font-size: 19px;
        line-height: 1;

        transition: transform .18s ease;
    }

    .ls-mobile-status-v2[open] .ls-mobile-status-arrow {
        transform: rotate(180deg);
    }

    .ls-mobile-status-details {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));

        gap: 5px;

        padding: 0 8px 8px;
    }

    .ls-mobile-status-details a {
        display: flex;
        align-items: center;
        justify-content: space-between;

        min-width: 0;

        padding: 7px 9px;

        border-radius: 8px;

        background: rgba(0,0,0,.14);
        border: 1px solid rgba(255,255,255,.08);

        color: white;
        text-decoration: none;
    }

    .ls-mobile-status-details small {
        font-size: 10px;
        opacity: .78;
    }

    .ls-mobile-status-details strong {
        min-width: 0;

        font-size: 11px;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}


@media (max-width: 600px) {

    .topbar-main {
        height: 145px !important;
    }

    .topbar-main .logo img {
        max-height: 85px !important;
    }

    .ls-mobile-status-v2 summary {
        gap: 5px;
        padding: 8px 7px;
    }

    .ls-mobile-status-rider {
        font-size: 12px;
    }

    .ls-mobile-status-level,
    .ls-mobile-status-money {
        padding: 3px 5px;
        font-size: 10px;
    }
}

/* END MOBILE STATUSBAR V2 */





/* =========================================================
   MOBILE COMPACT TYPOGRAPHY V2
   Alleen visueel compacter.
   Geen globale clipping of geforceerde breedtes.
========================================================= */

@media (max-width: 1100px) {

    .main-content {
        padding: 10px !important;
        font-size: 13px !important;
        line-height: 1.4 !important;
    }

    .main-content h1 {
        font-size: 30px !important;
        line-height: 1.08 !important;
        margin-top: 0 !important;
        margin-bottom: 8px !important;
    }

    .main-content h2 {
        font-size: 22px !important;
        line-height: 1.12 !important;
        margin-top: 10px !important;
        margin-bottom: 7px !important;
    }

    .main-content h3 {
        font-size: 17px !important;
        line-height: 1.15 !important;
        margin-top: 8px !important;
        margin-bottom: 6px !important;
    }

    .main-content p {
        font-size: 13px !important;
        line-height: 1.42 !important;
    }

    .main-content img,
    .main-content video,
    .main-content canvas,
    .main-content svg {
        height: auto;
    }
}

@media (max-width: 600px) {

    .main-content {
        padding: 7px !important;
        font-size: 12px !important;
    }

    .main-content h1 {
        font-size: 27px !important;
    }

    .main-content h2 {
        font-size: 20px !important;
    }

    .main-content h3 {
        font-size: 15px !important;
    }

    .main-content p {
        font-size: 12px !important;
        line-height: 1.38 !important;
    }
}

/* END MOBILE COMPACT TYPOGRAPHY V2 */


/* =========================================================
   MOBILE CONTENT SWIPE + FOOTER V1
========================================================= */

.legend-footer-mobile-line {
    display: none;
}

@media (max-width: 1100px) {

    /*
       De SITE zelf blijft binnen het telefoonscherm.
       Alleen de daadwerkelijke pagina-inhoud mag indien
       nodig horizontaal bewogen worden.
    */
    html,
    body,
    .site-wrapper,
    .layout-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .main-content {
        width: 100% !important;
        max-width: 100% !important;

        overflow-x: auto !important;
        overflow-y: visible !important;

        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;

        /*
           Horizontaal swipen toestaan zonder lelijke
           scrollbar onder de pagina.
        */
        scrollbar-width: none;
    }

    .main-content::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    /*
       Belangrijk:
       interne spelonderdelen mogen hun eigen breedte houden.
       Daardoor verdwijnen gedeeltes rechts niet langer.
    */
    .main-content > * {
        min-width: 0;
    }


    /* ================================================
       FOOTER - MOBIEL ÉÉN COMPACTE REGEL
    ================================================= */

    .legend-global-footer {
        width: 100% !important;
        max-width: 100% !important;

        margin: 0 !important;
        padding: 0 !important;

        border-radius: 0 !important;
        min-height: 0 !important;
    }

    /* Grote desktopfooter mobiel weg */
    .legend-footer-inner {
        display: none !important;
    }

    /* Kleine mobiele regel */
    .legend-footer-mobile-line {
        display: flex;

        align-items: center;
        justify-content: center;

        gap: 4px;

        width: 100%;
        max-width: 100%;

        padding: 7px 5px;

        white-space: nowrap;
        overflow: hidden;

        font-size: clamp(7px, 2.25vw, 10px);
        line-height: 1;

        color: #586353;
    }

    .legend-footer-mobile-line span,
    .legend-footer-mobile-line a,
    .legend-footer-mobile-line button {
        flex: 0 0 auto;

        margin: 0;
        padding: 0;

        font: inherit;
        line-height: 1;

        color: inherit;
        text-decoration: none;
    }

    .legend-footer-mobile-line a {
        font-weight: 700;
    }

    .legend-footer-mobile-line button {
        border: 0;
        background: none;

        font-weight: 700;
        cursor: pointer;
    }
}

/* END MOBILE CONTENT SWIPE + FOOTER V1 */


/* =========================================================
   LEGEND STABLES MOBILE GLOBAL V3
   Geldt voor ALLE spelpagina's.
========================================================= */

@media (max-width: 1100px) {

    /* =====================================================
       1. DE WEBSITE ZELF MAG NOOIT BREDER ZIJN DAN SCHERM
    ===================================================== */

    html,
    body,
    .site-wrapper,
    .layout-wrapper,
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    html,
    body,
    .site-wrapper,
    .layout-wrapper {
        overflow-x: hidden !important;
    }

    /*
       Vorige test maakte de hele main-content horizontaal
       scrollbaar. Dat willen we NIET.
    */
    .main-content {
        overflow-x: hidden !important;
        overflow-y: visible !important;

        padding: 7px !important;

        font-size: 12px !important;
        line-height: 1.35 !important;
    }


    /* =====================================================
       2. ALLE NORMALE PAGINA-INHOUD MAG KRIMPEN
       Tabellen behandelen we verderop apart.
    ===================================================== */

    .main-content div,
    .main-content section,
    .main-content article,
    .main-content form,
    .main-content nav,
    .main-content header,
    .main-content aside,
    .main-content ul,
    .main-content ol,
    .main-content fieldset {
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /*
       Bovenste pagina-container altijd binnen scherm.
       Dit vangt chores-page, stable-page, forum-page,
       training-page enzovoort automatisch op.
    */
    .main-content > * {
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }


    /* =====================================================
       3. PAGINAWITRUIMTE ALGEMEEN COMPACTER
    ===================================================== */

    .main-content [class$="-page"],
    .main-content [class*="-page "] {
        max-width: 100% !important;
        min-width: 0 !important;

        padding: 8px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .main-content [class*="-hero"] {
        max-width: 100% !important;
        min-width: 0 !important;

        padding: 10px !important;
        gap: 8px !important;
        margin-bottom: 9px !important;

        flex-wrap: wrap !important;
    }


    /* =====================================================
       4. TYPOGRAFIE OVERAL MOBIEL KLEINER
    ===================================================== */

    .main-content h1 {
        font-size: 24px !important;
        line-height: 1.05 !important;

        margin-top: 0 !important;
        margin-bottom: 6px !important;
    }

    .main-content h2 {
        font-size: 18px !important;
        line-height: 1.1 !important;

        margin-top: 8px !important;
        margin-bottom: 5px !important;
    }

    .main-content h3 {
        font-size: 14px !important;
        line-height: 1.15 !important;

        margin-top: 6px !important;
        margin-bottom: 4px !important;
    }

    .main-content p {
        font-size: 12px !important;
        line-height: 1.35 !important;

        margin-top: 3px !important;
        margin-bottom: 6px !important;
    }

    .main-content small {
        font-size: 10px !important;
    }


    /* =====================================================
       5. AFBEELDINGEN / FORMULIEREN
    ===================================================== */

    .main-content img,
    .main-content video,
    .main-content canvas,
    .main-content svg {
        max-width: 100% !important;
        height: auto !important;
    }

    .main-content input,
    .main-content select,
    .main-content textarea {
        max-width: 100% !important;
        min-width: 0 !important;

        font-size: 12px !important;
    }


    /* =====================================================
       6. TABS / KNOPPEN / ACTIES MOGEN TERUGLOPEN
    ===================================================== */

    .main-content [class*="-tabs"],
    .main-content [class*="-actions"],
    .main-content [class*="-buttons"],
    .main-content [class*="-controls"],
    .main-content [class*="-filters"] {
        max-width: 100% !important;
        min-width: 0 !important;

        flex-wrap: wrap !important;
        gap: 5px !important;
    }

    .main-content button,
    .main-content [class*="-button"] {
        font-size: 11px !important;
        line-height: 1.2 !important;
    }


    /* =====================================================
       7. GRIDS AUTOMATISCH MOBIEL LATEN SCHALEN
    ===================================================== */

    .main-content [class*="-grid"] {
        min-width: 0 !important;
        max-width: 100% !important;

        grid-template-columns:
            repeat(auto-fit, minmax(min(145px, 100%), 1fr)) !important;

        gap: 7px !important;
    }


    /* =====================================================
       8. TABELLEN:
       ALLEEN DE TABEL MAG HORIZONTAAL SWIPEN.
       NIET DE HELE PAGINA.
    ===================================================== */

    .main-content table {
        display: block !important;

        width: 100% !important;
        max-width: 100% !important;

        overflow-x: auto !important;
        overflow-y: hidden !important;

        -webkit-overflow-scrolling: touch;

        scrollbar-width: thin;
    }

    .main-content [class*="table-wrap"],
    .main-content [class*="-table-wrap"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        overflow-x: auto !important;
        overflow-y: hidden !important;

        -webkit-overflow-scrolling: touch;
    }


    /* =====================================================
       9. FOOTER BLIJFT ÉÉN COMPACTE REGEL
    ===================================================== */

    .legend-global-footer {
        width: 100% !important;
        max-width: 100% !important;

        min-height: 0 !important;

        margin: 0 !important;
        padding: 0 !important;
    }

    .legend-footer-inner {
        display: none !important;
    }

    .legend-footer-mobile-line {
        display: flex !important;

        width: 100% !important;
        max-width: 100% !important;

        align-items: center !important;
        justify-content: center !important;

        gap: 3px !important;

        padding: 6px 3px !important;

        white-space: nowrap !important;
        overflow: hidden !important;

        font-size: 8px !important;
        line-height: 1 !important;
    }

}


/* Nog compacter op echte telefoons */
@media (max-width: 600px) {

    .main-content {
        padding: 5px !important;
        font-size: 11px !important;
    }

    .main-content [class$="-page"],
    .main-content [class*="-page "] {
        padding: 6px !important;
    }

    .main-content [class*="-hero"] {
        padding: 8px !important;
    }

    .main-content h1 {
        font-size: 21px !important;
    }

    .main-content h2 {
        font-size: 17px !important;
    }

    .main-content h3 {
        font-size: 13px !important;
    }

    .main-content p {
        font-size: 11px !important;
    }

}

/* END LEGEND STABLES MOBILE GLOBAL V3 */


/* =========================================================
   MOBILE TRAINING CONDITION HIDE V1
   Alleen telefoon:
   conditiekolom verbergen om trainingslijst compacter te maken.
========================================================= */

@media (max-width: 600px) {

    /* 4e kolom = Conditie */
    .training-table th:nth-child(4),
    .training-table td:nth-child(4) {
        display: none !important;
    }

    /* Overige kolommen compacter */
    .training-table th,
    .training-table td {
        padding-left: 7px !important;
        padding-right: 7px !important;
    }

    .training-table {
        font-size: 11px !important;
    }

    .training-name-cell a {
        font-size: 12px !important;
    }

    .training-name-cell small {
        font-size: 9px !important;
    }

}

/* END MOBILE TRAINING CONDITION HIDE V1 */


/* =========================================================
   STATISTICS GRID EXCEPTION V11
   Statistieken mag niet door de algemene mobile grid-regel
   tot smalle kolommen worden samengedrukt.
========================================================= */

@media (max-width: 1100px) {

    .main-content .ls-stats-modern .ls-modern-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .main-content .ls-stats-modern .ls-modern-grid {
        display: grid !important;

        grid-template-columns:
            repeat(2, minmax(0, 1fr)) !important;

        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        gap: 12px !important;
    }

    .main-content .ls-stats-modern .ls-modern-grid > .ls-modern-panel {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .main-content .ls-stats-modern .ls-legend-ranking-v7,
    .main-content .ls-stats-modern .ls-legend-ranking-v8 {
        grid-column: 1 / -1 !important;

        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .main-content .ls-stats-modern .ls-legend-ranking-v7 .ls-modern-panel,
    .main-content .ls-stats-modern .ls-legend-ranking-v8 .ls-modern-panel {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
}


/* Echte telefoon: één nette kolom */
@media (max-width: 700px) {

    .main-content .ls-stats-modern .ls-modern-grid {
        grid-template-columns:
            minmax(0, 1fr) !important;

        gap: 9px !important;
    }

    .main-content .ls-stats-modern .ls-legend-ranking-v7,
    .main-content .ls-stats-modern .ls-legend-ranking-v8 {
        grid-column: 1 !important;
    }
}

/* END STATISTICS GRID EXCEPTION V11 */
