/* Shared address and delivery method modals */

.adp,
.adp-method {
    --adp-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --adp-bg: #fff;
    --adp-surface: #f5f6f8;
    --adp-border: #e6e8ec;
    --adp-text: #17191f;
    --adp-muted: #6f747d;
    --adp-accent: var(--color-primary, #f05a2a);
    --adp-accent-soft: #fff2ed;
    --adp-success: #138a52;
    --adp-danger: #d92d20;
    --adp-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
    --adp-radius: 24px;
    --adp-radius-sm: 14px;
    --adp-z-modal: 100000;
    --adp-z-suggest: 100010;
    color: var(--adp-text);
    font-family: var(--adp-font);
    font-size: 16px;
    line-height: 1.4;
    box-sizing: border-box;
}

.adp *,
.adp-method * {
    box-sizing: border-box;
}

.adp button,
.adp input,
.adp-method button {
    font: inherit;
}

/* Delivery method */

.adp-method__dialog {
    position: fixed;
    inset: 0;
    z-index: calc(var(--adp-z-modal) - 1);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    isolation: isolate;
}

.adp-method__dialog.adp-method--open {
    display: flex;
}

.adp-method__backdrop {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(15, 18, 24, 0.62);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.adp-method__panel {
    position: relative;
    z-index: 1;
    width: min(680px, 100%);
    padding: 34px;
    overflow: hidden;
    background: var(--adp-bg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--adp-radius);
    box-shadow: var(--adp-shadow);
    animation: adp-enter 0.26s ease-out;
}

.adp-method__eyebrow,
.adp__eyebrow {
    margin: 0 0 7px;
    color: var(--adp-accent);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.09em;
    line-height: 1.2;
    text-transform: uppercase;
}

.adp-method__title {
    margin: 0;
    color: var(--adp-text);
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.12;
}

.adp-method__subtitle {
    margin: 9px 0 26px;
    color: var(--adp-muted);
    font-size: 14px;
}

.adp-method__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.adp-method__card + .adp-method__card {
    margin-left: 0;
}

.adp-method__card {
    position: relative;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 28px;
    gap: 14px;
    align-items: center;
    min-width: 0;
    min-height: 142px;
    padding: 16px 14px 16px 12px;
    color: var(--adp-text);
    text-align: left;
    background: var(--adp-surface);
    border: 1px solid transparent;
    border-radius: 18px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.adp-method__card::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-radius: inherit;
    pointer-events: none;
    transition: border-color 0.18s ease;
}

.adp-method__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
}

.adp-method__card:hover::after,
.adp-method__card:focus-visible::after {
    border-color: var(--adp-accent);
}

.adp-method__card:focus-visible,
.adp__close:focus-visible,
.adp__submit:focus-visible {
    outline: 3px solid var(--adp-accent-soft);
    outline-offset: 3px;
}

.adp-method__visual {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 104px;
    overflow: hidden;
}

.adp-method__image,
.adp-method__card .check-delivery__img {
    display: block;
    width: 108px;
    max-width: none;
    height: 108px;
    margin: 0;
    object-fit: contain;
    filter: drop-shadow(0 7px 8px rgba(15, 23, 42, 0.12));
}

.adp-method__content {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.adp-method__card-title {
    margin: 0;
    color: var(--adp-text);
    font-size: 17px;
    font-weight: 720;
    line-height: 1.2;
}

.adp-method__card-hint {
    color: var(--adp-muted);
    font-size: 13px;
    line-height: 1.35;
}

.adp-method__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--adp-text);
    font-size: 18px;
    background: var(--adp-bg);
    border-radius: 50%;
    transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.adp-method__card:hover .adp-method__arrow,
.adp-method__card:focus-visible .adp-method__arrow {
    color: #fff;
    background: var(--adp-accent);
    transform: translateX(2px);
}

/* Address modal */

.adp {
    position: fixed;
    inset: 0;
    z-index: var(--adp-z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    isolation: isolate;
}

.adp.setup-address--active,
.adp.adp--open {
    display: flex;
}

.adp__backdrop {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(15, 18, 24, 0.64);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

/* Specific selectors intentionally reset legacy per-theme modal styles. */
.adp .adp__shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
    width: min(1180px, 100%);
    max-width: 1180px;
    height: min(720px, calc(100dvh - 48px));
    min-height: min(560px, calc(100dvh - 48px));
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--adp-bg);
    border-radius: var(--adp-radius);
    box-shadow: var(--adp-shadow);
    animation: adp-enter 0.28s ease-out;
}

.adp .adp__shell--form-only {
    grid-template-columns: minmax(0, 480px);
    width: min(480px, 100%);
    height: auto;
    min-height: 0;
}

.adp__panel {
    position: relative;
    z-index: 2;
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 34px 30px 30px;
    overflow-y: auto;
    background: var(--adp-bg);
    border-right: 1px solid var(--adp-border);
    overscroll-behavior: contain;
}

.adp__shell--form-only .adp__panel {
    border-right: 0;
}

.adp__header {
    position: relative;
    margin: 0 0 28px;
    padding-right: 44px;
}

.adp .adp__close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--adp-text);
    background: var(--adp-surface);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.16s ease, transform 0.16s ease;
}

.adp .adp__close:hover {
    background: var(--adp-border);
    transform: rotate(4deg);
}

.adp__title {
    margin: 0;
    color: var(--adp-text);
    font-size: clamp(23px, 3vw, 30px);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.14;
}

.adp__subtitle {
    margin: 10px 0 0;
    color: var(--adp-muted);
    font-size: 14px;
    line-height: 1.45;
}

.adp .adp__form {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 16px;
    padding: 0;
}

.adp__field {
    position: relative;
}

.adp__label {
    display: block;
    margin: 0 0 7px;
    color: var(--adp-text);
    font-size: 13px;
    font-weight: 680;
}

.adp__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.adp__input-icon {
    position: absolute;
    left: 15px;
    z-index: 1;
    display: flex;
    color: var(--adp-muted);
    pointer-events: none;
}

.adp .adp__input {
    width: 100%;
    height: 54px;
    padding: 0 44px 0 44px;
    color: var(--adp-text);
    font-size: 16px;
    background: var(--adp-surface);
    border: 1px solid var(--adp-border);
    border-radius: var(--adp-radius-sm);
    outline: 0;
    -webkit-appearance: none;
    appearance: none;
    transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.adp__input::placeholder {
    color: #969ba4;
}

.adp .adp__input:focus {
    background: var(--adp-bg);
    border-color: var(--adp-accent);
    box-shadow: 0 0 0 4px var(--adp-accent-soft);
}

.adp .adp__input.adp__input--valid {
    border-color: var(--adp-success);
    box-shadow: 0 0 0 3px rgba(19, 138, 82, 0.1);
}

.adp .adp__input.adp__input--invalid,
.adp .adp__input.suggest-error {
    border-color: var(--adp-danger);
    box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.1);
}

.adp__spinner {
    position: absolute;
    right: 15px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--adp-border);
    border-top-color: var(--adp-accent);
    border-radius: 50%;
    animation: adp-spin 0.7s linear infinite;
}

.adp .adp__error {
    display: block;
    margin: 8px 0 0;
    padding: 9px 11px;
    color: var(--adp-danger);
    font-size: 13px;
    line-height: 1.35;
    background: #fff2f0;
    border-radius: 9px;
}

.adp .adp__error[hidden] {
    display: none;
}

.adp__summary {
    padding: 15px;
    background: var(--adp-surface);
    border: 1px solid var(--adp-border);
    border-radius: var(--adp-radius-sm);
}

.adp__summary[hidden] {
    display: none;
}

.adp__summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
}

.adp__summary-label {
    color: var(--adp-muted);
    font-size: 14px;
}

.adp__summary-price {
    color: var(--adp-text);
    font-size: 20px;
    font-weight: 750;
}

.adp__summary-meta,
.adp__summary-zone {
    color: var(--adp-muted);
    font-size: 12px;
    line-height: 1.45;
}

.adp__summary-zone {
    margin-top: 5px;
    color: var(--adp-accent);
    font-weight: 650;
}

.adp .adp__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    margin: 2px 0 0;
    padding: 13px 18px !important;
    color: #fff;
    font-size: 15px !important;
    font-weight: 700 !important;
    background: var(--adp-accent);
    border: 0 !important;
    border-radius: var(--adp-radius-sm) !important;
    cursor: pointer;
    transition: filter 0.16s ease, transform 0.1s ease;
}

.adp .adp__submit:hover {
    filter: brightness(0.94);
}

.adp .adp__submit:active {
    transform: scale(0.985);
}

.adp__map-area {
    position: relative;
    z-index: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #e9ecef;
}

.adp__map-area[hidden] {
    display: none;
}

.adp .adp__map {
    width: 100%;
    height: 100%;
    min-height: 300px;
    overflow: hidden;
    border-radius: 0;
}

.adp__map-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    color: var(--adp-text);
    font-size: 12px;
    font-weight: 650;
    line-height: 1;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.12);
    pointer-events: none;
}

.adp__map-badge-dot {
    width: 8px;
    height: 8px;
    background: var(--adp-accent);
    border-radius: 50%;
}

/* Custom address suggestions stay in the form flow and never cover the input. */

.adp__suggestions {
    position: relative;
    z-index: 5;
    display: flex;
    max-height: 248px;
    flex-direction: column;
    margin-top: 8px;
    padding: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--adp-bg);
    border: 1px solid var(--adp-border);
    border-radius: 13px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    overscroll-behavior: contain;
    animation: adp-suggestions-enter 0.18s ease-out;
}

.adp__suggestions[hidden] {
    display: none;
}

.adp__suggestion {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 7px 10px 7px 7px;
    color: var(--adp-text);
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.14s ease, background 0.14s ease;
}

.adp__suggestion + .adp__suggestion {
    margin-top: 2px;
}

.adp__suggestion:hover,
.adp__suggestion:focus-visible,
.adp__suggestion--active {
    color: var(--adp-text);
    background: var(--adp-accent-soft);
    outline: 0;
}

.adp__suggestion-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: var(--adp-muted);
    background: var(--adp-surface);
    border-radius: 9px;
    transition: color 0.14s ease, background 0.14s ease;
}

.adp__suggestion:hover .adp__suggestion-icon,
.adp__suggestion:focus-visible .adp__suggestion-icon,
.adp__suggestion--active .adp__suggestion-icon {
    color: var(--adp-accent);
    background: var(--adp-bg);
}

.adp__suggestion-text {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 520;
    line-height: 1.35;
    text-overflow: ellipsis;
}

@media (max-width: 860px) {
    .adp .adp__shell {
        grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    }

    .adp__panel {
        padding: 28px 24px 24px;
    }
}

@media (max-width: 767px) {
    .adp-method__dialog {
        align-items: flex-end;
        padding: 0;
    }

    .adp-method__panel {
        width: 100%;
        padding: 24px 18px max(22px, env(safe-area-inset-bottom));
        border-radius: 24px 24px 0 0;
        animation-name: adp-sheet-enter;
    }

    .adp-method__title {
        font-size: 26px;
    }

    .adp-method__subtitle {
        margin-bottom: 20px;
    }

    .adp-method__grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .adp-method__card {
        grid-template-columns: 82px minmax(0, 1fr) 30px;
        min-height: 108px;
        padding: 9px 12px 9px 7px;
    }

    .adp-method__visual {
        width: 82px;
        height: 88px;
    }

    .adp-method__image,
    .adp-method__card .check-delivery__img {
        width: 92px;
        height: 92px;
    }

    .adp {
        align-items: stretch;
        padding: 0;
    }

    .adp .adp__shell,
    .adp .adp__shell--form-only {
        display: flex;
        width: 100%;
        max-width: none;
        height: 100dvh;
        min-height: 0;
        max-height: none;
        flex-direction: column;
        margin: 0;
        border-radius: 0;
        animation-name: adp-sheet-enter;
    }

    .adp__panel {
        flex: 0 0 auto;
        max-height: 58dvh;
        padding: max(20px, env(safe-area-inset-top)) 18px 18px;
        overflow-y: auto;
        border-right: 0;
        border-bottom: 1px solid var(--adp-border);
    }

    .adp .adp__shell--suggestions-open .adp__panel {
        max-height: 78dvh;
    }

    .adp .adp__shell--suggestions-open .adp__map-area {
        min-height: 22dvh;
    }

    .adp .adp__shell--suggestions-open .adp__suggestions {
        max-height: min(230px, 32dvh);
        flex-shrink: 0;
    }

    .adp__shell--form-only .adp__panel {
        max-height: none;
        flex: 1 1 auto;
        justify-content: center;
        border-bottom: 0;
    }

    .adp__header {
        margin-bottom: 20px;
    }

    .adp__title {
        font-size: 25px;
    }

    .adp__map-area {
        flex: 1 1 42dvh;
        min-height: 220px;
    }

    .adp .adp__map {
        min-height: 220px;
    }

    .adp__map-badge {
        top: 12px;
        left: 12px;
    }
}

@media (max-width: 380px), (max-height: 640px) and (max-width: 767px) {
    .adp-method__panel {
        padding-top: 18px;
    }

    .adp-method__eyebrow {
        display: none;
    }

    .adp-method__title {
        font-size: 23px;
    }

    .adp-method__subtitle {
        margin: 6px 0 14px;
    }

    .adp-method__card {
        min-height: 92px;
    }

    .adp__panel {
        max-height: 64dvh;
        padding-top: 16px;
    }

    .adp .adp__shell--suggestions-open .adp__panel {
        max-height: 80dvh;
    }

    .adp__header {
        margin-bottom: 14px;
    }

    .adp__eyebrow {
        display: none;
    }

    .adp__title {
        font-size: 22px;
    }

    .adp__subtitle {
        margin-top: 6px;
    }

    .adp .adp__form {
        gap: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .adp *,
    .adp-method * {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

@keyframes adp-enter {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes adp-sheet-enter {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes adp-suggestions-enter {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes adp-spin {
    to {
        transform: rotate(360deg);
    }
}
