/**
 * Product page delivery picker (js/product-delivery-picker.js)
 *
 * Pill: "<eta> to <country> | <city> · <fee>" under the "Shipping from … Warehouse" line.
 * Desktop opens a dropdown under the pill; phones open a bottom sheet.
 *
 * @package Qatarshoes
 */

.pdp-delivery {
    position: relative;
    margin-top: 4px;
}

/* ---------- Pill ---------- */
.pdp-delivery__bar {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    box-sizing: border-box;
    background: #F5F5F5;
    border-radius: 999px;
}

.pdp-delivery__line {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    margin: 0;
    font-family: var(--qs-font-body, 'Inter', 'IBM Plex Sans Arabic', sans-serif);
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    color: #1A1A1A;
}

.pdp-delivery__truck {
    flex-shrink: 0;
}

.pdp-delivery__sentence {
    color: #6F6767;
}

.pdp-delivery__static {
    font-weight: 600;
    color: #1A1A1A;
}

.pdp-delivery__trigger {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 40px;
    padding: 0 4px;
    border: 0;
    background: none;
    cursor: pointer;
    font: 600 13px var(--qs-font-body, 'Inter', 'IBM Plex Sans Arabic', sans-serif);
    color: #1A1A1A;
    white-space: nowrap;
}

.pdp-delivery__trigger--city {
    padding: 0 2px;
}

.pdp-delivery__value {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: underline;
    text-underline-offset: 3px;
    /* Room for the underline inside the clipped box, without changing the line height */
    padding-bottom: 4px;
    margin-bottom: -4px;
}

.pdp-delivery__chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.pdp-delivery__trigger[aria-expanded="true"] .pdp-delivery__chevron {
    transform: rotate(180deg);
}

.pdp-delivery__trigger:focus-visible,
.pdp-delivery__row:focus-visible,
.pdp-delivery__close:focus-visible {
    outline: 2px solid #1A1A1A;
    outline-offset: 2px;
    border-radius: 6px;
}

.pdp-delivery__city-row {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.pdp-delivery__divider {
    width: 1px;
    height: 20px;
    margin: 0 10px;
    background: #D6D6CF;
    flex-shrink: 0;
}

.pdp-delivery__fee {
    margin-inline-start: 2px;
    color: #63635B;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Loading */
.pdp-delivery__skeleton {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdp-delivery__shimmer {
    display: block;
    border-radius: 999px;
    background: linear-gradient(90deg, #E9E9E6 25%, #F7F7F5 50%, #E9E9E6 75%);
    background-size: 200% 100%;
    animation: pdp-delivery-shimmer 1.2s linear infinite;
}

.pdp-delivery__shimmer--dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.pdp-delivery__shimmer--text {
    width: 220px;
    height: 10px;
}

@keyframes pdp-delivery-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

/* ---------- Desktop dropdown ---------- */
.pdp-delivery__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    width: 340px;
    max-width: 100%;
    z-index: 20;
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(26, 26, 26, 0.10);
    overflow: hidden;
    opacity: 0;
    transform: translate(-50%, -6px);
    transition: opacity 0.16s ease-out, transform 0.16s ease-out;
}

.pdp-delivery__panel.is-open {
    opacity: 1;
    transform: translate(-50%, 0);
}

.pdp-delivery__search {
    position: relative;
    padding: 8px 8px 4px;
}

.pdp-delivery__search-icon {
    position: absolute;
    inset-inline-start: 22px;
    top: calc(50% + 2px);
    transform: translateY(-50%);
    color: #63635B;
    pointer-events: none;
}

.pdp-delivery__input {
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    padding: 0;
    padding-inline: 38px 12px;
    border: 1px solid #E5E5E5;
    border-radius: 999px;
    background: #FFFFFF;
    font: 400 14px var(--qs-font-body, 'Inter', 'IBM Plex Sans Arabic', sans-serif);
    color: #1A1A1A;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.pdp-delivery__input:focus {
    border-color: #1A1A1A;
}

.pdp-delivery__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.pdp-delivery__list {
    max-height: 264px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 8px 8px;
}

.pdp-delivery__group-label {
    padding: 10px 12px 4px;
    font: 600 11px var(--qs-font-body, 'Inter', 'IBM Plex Sans Arabic', sans-serif);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8A8580;
}

.pdp-delivery__row {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-family: var(--qs-font-body, 'Inter', 'IBM Plex Sans Arabic', sans-serif);
    text-align: start;
    color: #2D1F1F;
}

.pdp-delivery__row:hover {
    background: #FAFAF9;
}

.pdp-delivery__row.is-selected {
    background: #F5F5F5;
}

.pdp-delivery__row-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    font-weight: 400;
}

.pdp-delivery__row.is-selected .pdp-delivery__row-name {
    font-weight: 600;
}

.pdp-delivery__row-fee {
    font-size: 12px;
    color: #6F6767;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.pdp-delivery__empty {
    margin: 0;
    padding: 20px 12px;
    text-align: center;
    font: 400 13px/1.6 var(--qs-font-body, 'Inter', 'IBM Plex Sans Arabic', sans-serif);
    color: #63635B;
}

.pdp-delivery__empty a {
    color: #1A1A1A;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.pdp-delivery__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Phones: two-row pill + bottom sheet ---------- */
@media (max-width: 767px) {
    .pdp-delivery__bar {
        justify-content: flex-start;
        padding: 6px 6px 6px 16px;
        border-radius: 16px;
    }

    [dir="rtl"] .pdp-delivery__bar {
        padding: 6px 16px 6px 6px;
    }

    .pdp-delivery__line {
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 100%;
    }

    .pdp-delivery__city-row {
        flex: 1 0 100%;
        box-sizing: border-box;
        justify-content: space-between;
        margin: 2px 0 0;
        padding: 0 12px 0 10px;
        background: #FFFFFF;
        border-radius: 12px;
    }

    .pdp-delivery__divider {
        display: none;
    }

    .pdp-delivery__value {
        max-width: 200px;
    }

    .pdp-delivery__fee {
        font-size: 13px;
    }
}

.pdp-delivery__backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(26, 26, 26, 0.38);
    opacity: 0;
    transition: opacity 0.24s ease;
}

.pdp-delivery__backdrop.is-open {
    opacity: 1;
}

.pdp-delivery__sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    max-height: 76vh;
    max-height: 76dvh;
    background: #FFFFFF;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -12px 32px rgba(26, 26, 26, 0.12);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    outline: none;
}

.pdp-delivery__sheet.is-open {
    transform: translateY(0);
}

.pdp-delivery__handle {
    flex-shrink: 0;
    width: 40px;
    height: 4px;
    margin: 9px auto 0;
    border-radius: 2px;
    background: #D9D5CA;
}

.pdp-delivery__sheet-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 10px 11px 20px;
    border-bottom: 1px solid #EFEEEB;
}

[dir="rtl"] .pdp-delivery__sheet-head {
    padding: 12px 20px 11px 10px;
}

.pdp-delivery__sheet-title {
    margin: 0;
    font: 600 19px/1.3 var(--qs-font-body, 'Inter', 'IBM Plex Sans Arabic', sans-serif);
    color: #1A1A1A;
}

.pdp-delivery__sheet-current {
    font-weight: 400;
    color: #8A8580;
}

.pdp-delivery__close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    background: none;
    color: #1A1A1A;
    cursor: pointer;
}

.pdp-delivery__sheet .pdp-delivery__search {
    flex-shrink: 0;
    padding: 16px 15px 12px;
    border-bottom: 1px solid #EFEEEB;
}

.pdp-delivery__sheet .pdp-delivery__search-icon {
    inset-inline-start: 33px;
    top: calc(50% + 2px);
    width: 16px;
    height: 16px;
}

.pdp-delivery__sheet .pdp-delivery__input {
    height: 48px;
    padding-inline: 45px 16px;
    border-color: #E8E8E8;
    font-size: 16px; /* 16px stops iOS zooming into the field */
}

.pdp-delivery__sheet .pdp-delivery__list {
    flex: 1 1 auto;
    max-height: none;
    padding: 0;
}

.pdp-delivery__sheet .pdp-delivery__group-label {
    padding: 14px 20px 6px;
}

.pdp-delivery__sheet .pdp-delivery__row {
    min-height: 52px;
    padding: 0 20px;
    border-radius: 0;
    border-bottom: 1px solid #F5F5F5;
}

.pdp-delivery__sheet .pdp-delivery__row-name {
    font-size: 15px;
}

.pdp-delivery__sheet .pdp-delivery__row-fee {
    font-size: 13px;
}

html.pdp-delivery-locked,
html.pdp-delivery-locked body {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .pdp-delivery__panel,
    .pdp-delivery__sheet,
    .pdp-delivery__backdrop,
    .pdp-delivery__chevron {
        transition: none;
    }

    .pdp-delivery__shimmer {
        animation: none;
    }
}
