/* =========================================================
   MAGNUS DREAM — MATTRESS SIZE FILTER v1.3.2
========================================================= */

.md-size-nav-wrap {
    display: block;
    width: 100%;
    clear: both;
    margin: 28px 0 20px;
}

.md-size-nav {
    position: relative;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
}

.md-size-nav__heading {
    margin: 0 0 9px;
    color: #172b45;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
}

.md-size-nav__items {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.md-size-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 49px;
    padding: 7px 8px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #dfe4e9;
    border-radius: 7px;
    box-shadow: 0 2px 7px rgba(15,35,55,.04);
    color: #172b45 !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.md-size-nav__item span {
    display: block;
    color: inherit;
    white-space: nowrap;
}

.md-size-nav__item small {
    display: block;
    margin-top: 3px;
    color: #6f7c8a;
    font-size: 10px;
    font-weight: 400;
    line-height: 1.15;
    white-space: nowrap;
}

.md-size-nav__item--active {
    background: #10243d !important;
    border-color: #10243d !important;
    color: #fff !important;
    box-shadow: 0 3px 9px rgba(16,36,61,.14);
}

.md-size-nav__item--active small {
    color: rgba(255,255,255,.78) !important;
}

@media (hover:hover) {
    .md-size-nav__item:hover {
        border-color: #10243d;
        box-shadow: 0 4px 12px rgba(15,35,55,.09);
        transform: translateY(-1px);
    }
}

/* Tablet */
@media (min-width:768px) and (max-width:1024px) {
    .md-size-nav-wrap {
        margin-top: 24px;
        margin-bottom: 18px;
    }

    .md-size-nav {
        max-width: 760px;
    }

    .md-size-nav__items {
        gap: 7px;
    }

    .md-size-nav__item {
        min-height: 48px;
        padding: 7px 5px;
        font-size: 12px;
    }

    .md-size-nav__item small {
        font-size: 9px;
    }
}

/* Mobile */
@media (max-width:767px) {
    .md-size-nav-wrap {
        margin: 24px 0 16px;
    }

    .md-size-nav {
        width: 100%;
        max-width: none;
    }

    .md-size-nav__heading {
        margin: 0 0 8px;
        padding-right: 28px;
        font-size: 12.5px;
        text-align: left;
    }

    .md-size-nav__items {
        display: flex;
        align-items: stretch;
        justify-content: flex-start;
        gap: 7px;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 1px 30px 7px 1px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .md-size-nav__items::-webkit-scrollbar {
        display: none;
    }

    .md-size-nav__item {
        flex: 0 0 auto;
        min-width: 86px;
        min-height: 48px;
        padding: 7px 9px;
        border-radius: 7px;
        font-size: 12px;
        scroll-snap-align: start;
    }

    .md-size-nav__item:first-child {
        min-width: 90px;
    }

    .md-size-nav__item small {
        margin-top: 3px;
        font-size: 8.5px;
    }

    /* Swipe cue: fade + chevron */
    .md-size-nav::after {
        content: "›";
        position: absolute;
        z-index: 5;
        right: 0;
        bottom: 7px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        width: 40px;
        height: 48px;
        padding-right: 4px;
        box-sizing: border-box;
        color: #10243d;
        font-size: 27px;
        font-weight: 400;
        line-height: 1;
        pointer-events: none;
        background: linear-gradient(
            to right,
            rgba(245,246,247,0),
            rgba(245,246,247,.88) 48%,
            rgba(245,246,247,1) 76%
        );
        opacity: 1;
        transition: opacity .18s ease;
    }

    .md-size-nav.md-size-nav--at-end::after,
    .md-size-nav.md-size-nav--no-scroll::after {
        opacity: 0;
    }
}

@media (max-width:390px) {
    .md-size-nav-wrap {
        margin-top: 22px;
        margin-bottom: 14px;
    }

    .md-size-nav__items {
        gap: 6px;
        padding-right: 29px;
    }

    .md-size-nav__item {
        min-width: 82px;
        min-height: 47px;
        padding: 6px 8px;
        font-size: 11.5px;
    }

    .md-size-nav__item:first-child {
        min-width: 87px;
    }

    .md-size-nav__item small {
        font-size: 8px;
    }

    .md-size-nav::after {
        width: 37px;
        height: 47px;
        font-size: 25px;
    }
}
