﻿/* --- Phones AND tablets: ≤1024px — full mockup treatment (plan "a") --- */
@media (max-width: 1024px) {

    .main-inner {
        padding-inline: 0;
        background-color: var(--esim-blue-bg);
    }

    .esim-page {
        padding-inline: 0;
    }

    .esim-search-dd {
        border-radius: 15px;
    }

    .esim-search-dd__flag {
        width: 26px;
        height: 26px;
    }

    .esim-search-dd__name {
        font-size: 16px;
    }


    /* ---- Hero: search ABOVE the two-line title (per mockup) ----
       Reordered with grid-template-areas (NOT the `order` property) so the
       markup stays untouched and desktop is unaffected. */
    .esim-hero {
        display: grid;
        grid-template-areas:
            "search"
            "title"
            "subtitle";
        row-gap: 14px;
        padding: 0 0 16px 0;
        margin: 0;
        text-align: start;
    }

    .esim-hero__title {
        grid-area: title;
        font-size: 32px;
        line-height: 22px;
        margin-top: 22px;
        margin-inline-start: 20px;
    }

    .esim-hero__subtitle {
        grid-area: subtitle;
        font-size: 32px;
        line-height: 22px;
        margin-inline-start: 20px;
    }

    /* ---- Search: one unified pill — navy magnifier flush on the RIGHT ----
       Natural RTL: the (first-in-DOM) button sits on the visual right, the
       input on the left. The border/radius/background live on the CONTAINER,
       the input + button are borderless inside it, and overflow:hidden clips
       them to the pill so the button "merges" into the field (no gap). */
    .esim-search {
        grid-area: search;
        display: flex;
        align-items: stretch;
        gap: 0;
        max-width: 100%;
        margin: 0;
        background: var(--esim-white);
    }

    .esim-search__input {
        flex: 1 1 auto;
        min-width: 0;
        margin-inline: 0;
        padding: 23px 18px;
        font-size: 14px;
        text-align: start;
        border: none;
        border-radius: 0;
        background: transparent;
    }

        /* re-hosting the field border on the container means the input's own
       focus ring would double up — move the focus cue to the container. */
        .esim-search__input:focus {
            box-shadow: none;
        }

    .esim-search:focus-within {
        border-color: var(--esim-navy);
        box-shadow: 0 0 0 3px rgba(45, 43, 107, 0.1);
    }

    /* Icon-only button flush at the right end of the pill. Text label hidden,
       inline white SVG magnifier on navy. No markup change, no asset needed —
       swap the data-URI for a /images/esim/ search icon if you have one. */
    .esim-search__btn {
        flex: 0 0 auto;
        width: 87px;
        min-height: 0;
        padding: 0;
        border: none;
        border-radius: 0;
        font-size: 0; /* hide the resx text label */
        color: transparent;
        background-color: var(--esim-navy);
        background-repeat: no-repeat;
        background-position: center;
        background-size: 22px 22px;
        background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23ffffff'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='11'%20cy='11'%20r='7'/%3E%3Cline%20x1='16.5'%20y1='16.5'%20x2='21'%20y2='21'/%3E%3C/svg%3E");
    }

    /* ---- Tabs: 2-up pills, active = filled navy (mockup) ----
       Drop the desktop orange underline strip entirely. */
    .esim-tabs {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: stretch;
        gap: 12px;
        border-bottom: none;
        margin-block: 0 28px;
        margin-inline: 20px 26px; /* start end (was right:20 / left:26) */
        overflow: visible;
    }

    .esim-tabs__tab {
        flex: 0 1 auto;
        gap: 10px;
        padding: 12px 20px;
        min-width: 130px;
        min-height: 48px;
        font-size: 16px;
        font-weight: 400;
        border-radius: 7px;
        background-color: #DEE7FA;
        color: var(--esim-navy);
        white-space: nowrap;
    }

    .esim-tabs__tab--active {
        background-color: var(--esim-navy);
        color: var(--esim-white);
        font-weight: 700;
    }

        /* kill the desktop active underline pseudo-element */
        .esim-tabs__tab--active::after {
            display: none;
        }

        /* icons read navy on the light pills; flip to white on the active navy
       pill. The invert filter assumes single-colour icons — if an icon is
       multi-colour, use a dedicated white asset for the active state instead. */
        .esim-tabs__tab--active .esim-tabs__icon {
            filter: brightness(0) invert(1);
        }

    /* ---- Flatten the panel: no border / gradient / fixed height on mobile ---- */
    .esim-main__row,
    .esim-main__row--no-promo {
        flex-direction: column;
        gap: 0;
        min-height: 0;
        padding: 0;
        border: none;
        border-radius: 0;
        background: none;
    }

    /* ---- Section header ---- */
    .esim-catalog__header {
        font-size: 18px;
        font-weight: 800;
        margin: 0 20px 5px;
    }

        .esim-catalog__header::before {
            display: none;
        }

    .esim-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-inline: 20px;
    }


    /* Long country names wrap (up to 3 lines) instead of stretching the pill
       past the screen edge; the price never wraps or shrinks. */
    .esim-card__name {
        white-space: normal;
        overflow-wrap: break-word;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .esim-card__price {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* ---- Country card: light pill, price LEFT / flag+name RIGHT ----
       Row layout (reverts the earlier column stacking). DOM order keeps
       .esim-card__info on the right and the price on the left in RTL,
       which matches the mockup with no reordering. */
    .esim-card {
        flex: 0 0 auto;
        justify-content: space-between;
        gap: 12px;
        /* two price lines now: let the pill grow instead of pinning height */
        min-height: 56px;
        min-width: 155px;
        max-width: 100%;
        padding: 10px 16px;
        border-radius: 33px;
        background: #DEE7FA;
        color: var(--esim-navy);
    }

    .esim-card__prices {
        display: flex;
        flex-direction: column;
        /* RTL parent: flex-start is the right edge */
        align-items: flex-end;
        flex-shrink: 0;
    }

    .esim-card__price-before-vat {
        font-family: var(--esim-font-d-bold);
        font-size: 15px;
        line-height: 1.2;
        font-weight: 600;
        color: var(--esim-navy);
        direction: ltr;
        unicode-bidi: isolate;
    }

    .esim-card__price-with-vat {
        display: flex;
        align-items: baseline;
        gap: 3px;
        /* LTR: amount left, label right */
        direction: ltr;
    }

    .esim-card__price-value {
        font-family: var(--esim-font-d-bold);
        font-size: 11px;
        line-height: 1.2;
        font-weight: 600;
        color: var(--esim-navy);
        direction: ltr;
        unicode-bidi: isolate;
    }

    .esim-card__vat {
        font-family: var(--esim-font-u-regular);
        font-size: 10px;
        line-height: 1.2;
        font-weight: 400;
        color: var(--esim-navy);
    }

    .esim-card__info {
        gap: 8px;
        width: auto;
        min-width: 0;
    }

    img.esim-card__flag {
        width: 20px;
        height: 14px;
        flex-shrink: 0;
    }

    .esim-card__name {
        font-family: var(--esim-font-u-bold);
        font-size: 14px;
        line-height: 2;
        font-weight: 700;
        color: var(--esim-navy);
    }

    /* region / global cards have no price → keep flag+name at the start (right).
       Full-width now, so trim the height: less vertical padding and drop the
       inherited 28px line-height that was making them tall. */
    .esim-card--region {
        justify-content: flex-start;
        min-height: 0;
        padding: 10px 22px;
    }

        .esim-card--region .esim-card__name {
            font-size: 14px;
            line-height: 1.3;
        }

    /*        .esim-card--region .esim-card__info {
            width: auto; 
        }*/

    .esim-card__region-icon {
        width: 24px;
        height: 24px;
    }

    /* ---- Footer: view-all link (right) + orange button (left) on one row ---- */
    .esim-footer-actions {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        gap: 14px;
        margin: 28px 20px 0 20px;
    }

    .esim-more__btn {
        width: auto;
        padding: 11px 30px;
        font-size: 16px;
        line-height: 22px;
        font-weight: 500;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .esim-viewall__link {
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .esim-promo {
        width: auto;
        min-width: 0;
        margin-block: 60px 0;
        margin-inline: 60px 40px; /* start end (was right:60 / left:40) */
        padding: 24px 20px;
        border-radius: 30px;
    }

        .esim-promo::before {
            top: 56px;
            inset-inline-start: -14px;
            inset-inline-end: auto;
            width: 48px;
            height: 48px;
        }

    .esim-promo__badge {
        margin-inline-start: 0;
        margin-bottom: 12px;
    }

    .esim-promo__title {
        font-size: 21px;
        line-height: 28px;
    }

    .esim-promo__text {
        font-size: 18px;
        line-height: 20px;
    }
}

@media (max-width: 520px) {
    .esim-search__btn {
        width: 60px;
    }
}

@media (max-width: 395px) {
    .esim-more__btn {
        font-size: 14px;
        line-height: 1.2;
        padding: 9px 20px;
    }
}