.whef-top-selector {
    display: inline-flex;
    align-items: center;
}

.whef-top-selector__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.whef-top-selector__trigger:hover,
.whef-top-selector__trigger:focus {
    text-decoration: none;
    background: rgba(0, 0, 0, .06);
}

.whef-top-selector__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--whef-accent-color, #c21875) 12%, #ffffff);
    color: var(--whef-accent-color, #c21875);
    font-size: 13px;
}

.whef-top-selector__text {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.2;
}

.whef-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
}

.whef-modal.is-open {
    display: block;
}

.whef-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .48);
}

.whef-modal__dialog {
    position: relative;
    width: calc(100% - 32px);
    max-width: 760px;
    margin: 4vh auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .25);
    overflow: hidden;
}

.whef-modal__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 22px 16px;
    border-bottom: 1px solid #f0edf0;
}

.whef-modal__header h3 {
    margin: 0 0 6px;
    font-size: 20px;
    line-height: 1.2;
    font-weight: 800;
    color: var(--whef-heading-color, #2f2f2f);
}

.whef-modal__header p {
    margin: 0;
    color: var(--whef-body-text-color, #6b6b6b);
    font-size: 14px;
    line-height: 1.45;
}

.whef-modal__close {
    border: 0;
    background: transparent;
    color: #777;
    font-size: 30px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.whef-modal__body {
    padding: 18px 22px;
}

.whef-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.whef-mode-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 150px;
    border: 1px solid #ead6e1;
    background: linear-gradient(180deg, #ffffff 0%, #fbf7f9 100%);
    border-radius: 15px;
    padding: 14px;
    text-align: left;
    color: var(--whef-heading-color, #333);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.whef-mode-card:hover,
.whef-mode-card:focus {
    border-color: var(--whef-primary-color, #c21875);
    box-shadow: 0 0 0 3px rgba(194, 24, 117, .10);
    transform: translateY(-1px);
}

.whef-mode-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: color-mix(in srgb, var(--whef-accent-color, #c21875) 12%, #ffffff);
    color: var(--whef-accent-color, #c21875);
    font-size: 16px;
}

.whef-mode-card__title {
    font-weight: 800;
    font-size: 14px;
    line-height: 1.2;
    color: var(--whef-heading-color, #2f2f2f);
}

.whef-mode-card__text {
    font-size: 12px;
    line-height: 1.4;
    color: var(--whef-body-text-color, #666);
}

.whef-view-toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}

.whef-view-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #7c4d67;
    font-weight: 700;
    cursor: pointer;
}

.whef-postcode-box {
    margin-bottom: 14px;
    padding: 15px;
    background: #faf7f9;
    border: 1px solid #f0e3eb;
    border-radius: 15px;
}

.whef-postcode-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #3a3a3a;
}

.whef-postcode-box__row {
    display: flex;
    gap: 10px;
}

.whef-postcode-box__row input {
    flex: 1;
    border: 1px solid #ead6e1;
    border-radius: 11px;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--whef-heading-color, #333);
    background: #fff;
}

.whef-postcode-box__row input:focus {
    outline: none;
    border-color: var(--whef-primary-color, #c21875);
    box-shadow: 0 0 0 3px rgba(194, 24, 117, .10);
}

.whef-postcode-box__help {
    margin: 9px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: #6f6f6f;
}

.whef-modal__notice {
    margin-bottom: 14px;
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff7e6;
    color: #8a5a00;
    border: 1px solid #fde3ab;
    font-size: 13px;
    line-height: 1.45;
}

.whef-modal__search {
    position: relative;
    margin-bottom: 16px;
}

.whef-modal__search input {
    width: 100%;
    border: 0;
    outline: none;
    background: #f7f4f6;
    border-radius: 12px;
    padding: 13px 14px 13px 42px;
    color: var(--whef-heading-color, #333);
    font-size: 14px;
}

.whef-modal__search input:focus {
    box-shadow: 0 0 0 2px rgba(194, 24, 117, .18);
}

.whef-modal__search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 14px;
}

.whef-warehouse-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 380px;
    overflow: auto;
    padding-right: 3px;
}

.whef-warehouse-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.whef-warehouse-section > [id$="List"],
.whef-warehouse-section > [id$="ListManual"] {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.whef-warehouse-section > [id$="List"] > .whef-warehouse-card + .whef-warehouse-card,
.whef-warehouse-section > [id$="ListManual"] > .whef-warehouse-card + .whef-warehouse-card {
    margin-top: 0;
}

.whef-section-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid #eee2e9;
}

.whef-section-heading__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 16px;
    flex-shrink: 0;
}

.whef-section-heading h4 {
    margin: 0 0 3px;
    font-size: 15px;
    font-weight: 800;
    color: var(--whef-heading-color, #2f2f2f);
}

.whef-section-heading p {
    margin: 0;
    color: var(--whef-body-text-color, #666);
    font-size: 12px;
    line-height: 1.4;
}

.whef-section-heading--recommended {
    background: #fff7e9;
    border-color: #f8df9e;
}

.whef-section-heading--recommended .whef-section-heading__icon {
    background: #ffe9b0;
    color: #a46c00;
}

.whef-section-heading--delivery {
    background: #eef7ff;
    border-color: #cfe6fb;
}

.whef-section-heading--delivery .whef-section-heading__icon {
    background: #dcefff;
    color: #1e6bb8;
}

.whef-section-heading--pickup {
    background: #eefaf1;
    border-color: #d2ead9;
}

.whef-section-heading--pickup .whef-section-heading__icon {
    background: #daf1e2;
    color: #2d7a43;
}

.whef-warehouse-card {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    border: 1px solid transparent;
    background: #f7f4f6;
    border-radius: 14px;
    padding: 14px 16px;
    color: var(--whef-heading-color, #333);
    cursor: pointer;
    transition: background .18s ease, border .18s ease, box-shadow .18s ease, transform .18s ease;
}

.whef-warehouse-card:hover,
.whef-warehouse-card:focus,
.whef-warehouse-card.is-selected {
    background: #fff;
    border-color: var(--whef-primary-color, #c21875);
    box-shadow: 0 0 0 3px rgba(194, 24, 117, .12);
}

.whef-warehouse-card:hover {
    transform: translateY(-1px);
}

.whef-warehouse-card__content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.whef-warehouse-card__line {
    display: inline-flex;
    gap: 8px;
    align-items: flex-start;
}

.whef-warehouse-card__name {
    font-weight: 800;
    color: var(--whef-heading-color, #303030);
    line-height: 1.2;
}

.whef-warehouse-card__address {
    color: #686868;
    font-size: 12px;
    line-height: 1.45;
}

.whef-warehouse-card__type-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.whef-delivery-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.whef-delivery-chip--local_delivery {
    background: #eaf5ff;
    color: #1e6bb8;
}

.whef-delivery-chip--national_delivery {
    background: #efeafd;
    color: #6340c9;
}

.whef-delivery-chip--pickup {
    background: #edf8ef;
    color: #2d7a43;
}

.whef-warehouse-card__types {
    color: #6e5a66;
    font-size: 12px;
}

.whef-warehouse-card__badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.whef-warehouse-card__recommended,
.whef-warehouse-card__badge {
    display: inline-flex;
    align-self: flex-start;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: 5px 9px;
}

.whef-warehouse-card__recommended {
    background: #fff1c7;
    color: #8f6200;
}

.whef-warehouse-card__badge {
    display: none;
    background: var(--whef-primary-color, #c21875);
    color: var(--whef-primary-text-color, #fff);
}

.whef-warehouse-card.is-selected .whef-warehouse-card__badge {
    display: inline-flex;
}

.whef-modal__error,
.whef-modal__empty {
    margin-top: 12px;
    border-radius: 10px;
    padding: 11px 13px;
    font-size: 13px;
    line-height: 1.35;
}

.whef-modal__error {
    background: #fde8e8;
    color: #9b1c1c;
}

.whef-modal__empty {
    background: #f7f4f6;
    color: var(--whef-body-text-color, #666);
}

.whef-modal__footer {
    display: flex;
    gap: 12px;
    padding: 16px 22px 22px;
    border-top: 1px solid #f0edf0;
}

.whef-modal__footer[hidden] {
    display: none !important;
}


.whef-modal__button {
    flex: 1;
    border-radius: 11px;
    padding: 12px 16px;
    font-weight: 800;
    cursor: pointer;
    border: 1px solid transparent;
    transition: opacity .18s ease, background .18s ease, border .18s ease;
}

.whef-modal__button--secondary {
    background: var(--whef-secondary-color, #fff);
    border-color: color-mix(in srgb, var(--whef-secondary-text-color, #555) 22%, var(--whef-secondary-color, #fff));
    color: var(--whef-secondary-text-color, #555);
}

.whef-modal__button--secondary:hover,
.whef-modal__button--secondary:focus {
    background: #faf7f9;
}

.whef-modal__button--primary {
    background: var(--whef-primary-color, #c21875);
    border-color: var(--whef-primary-color, #c21875);
    color: var(--whef-primary-text-color, #fff);
}

.whef-modal__button--primary:hover,
.whef-modal__button--primary:focus {
    background: var(--whef-primary-color, #aa1467);
    border-color: var(--whef-primary-color, #aa1467);
    filter: brightness(0.92);
}

.whef-modal__button[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

.whef-modal__button.is-loading {
    opacity: .7;
}

.whef-cart-warning-modal__notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #fff7e7;
    border: 1px solid #f6dda0;
    color: #7c5a00;
    border-radius: 12px;
    padding: 14px;
}

.whef-cart-warning-modal__icon {
    font-size: 18px;
    line-height: 1;
}

body.whef-modal-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .whef-modal__dialog {
        width: calc(100% - 20px);
        margin: 2vh auto;
        max-height: 96vh;
    }

    .whef-modal__body {
        padding: 16px;
    }

    .whef-modal__footer {
        padding: 14px 16px 16px;
    }

    .whef-mode-grid,
    .whef-postcode-box__row,
    .whef-modal__footer {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .whef-warehouse-list {
        max-height: 45vh;
    }

    .whef-mode-card {
        min-height: auto;
        padding: 14px;
    }
}

.whef-warehouse-section--fallback-pickup {
    padding-top: 2px;
}

/* v1.1.3 UX refinements */
.whef-postcode-results[hidden] {
    display: none !important;
}

.whef-postcode-box__row input::placeholder {
    color: #b9b0b6;
    opacity: 1;
}

.whef-modal__notice--danger {
    background: #fdeeee;
    border-color: #f7caca;
    color: #9f2323;
    font-weight: 700;
}

.whef-postcode-alternative {
    background: #f8f4f6;
    border: 1px dashed #e2cfd9;
    color: #624f5a;
    border-radius: 12px;
    padding: 11px 13px;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 700;
}

.whef-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    font-size: 24px;
    color: #6b5d65;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.whef-modal__close:hover,
.whef-modal__close:focus {
    background: #f7f0f4;
    color: var(--whef-accent-color, #c21875);
    transform: none;
    outline: none;
}

.whef-view-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid #ead6e1;
    border-radius: 999px;
    background: #fff;
    color: #6b4d5e;
    font-size: 13px;
    line-height: 1;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.whef-view-back:hover,
.whef-view-back:focus {
    background: #faf3f7;
    border-color: #d9b8c9;
    color: var(--whef-accent-color, #c21875);
    outline: none;
}

.whef-view-back i {
    font-size: 15px;
}

/* v1.1.4 modal animation and postcode-result refinements */
.whef-modal.is-open .whef-modal__overlay {
    animation: whefFadeIn .18s ease both;
}

.whef-modal.is-open .whef-modal__dialog {
    animation: whefDialogIn .2s ease both;
}

.whef-modal.is-closing .whef-modal__overlay {
    animation: whefFadeOut .18s ease both;
}

.whef-modal.is-closing .whef-modal__dialog {
    animation: whefDialogOut .18s ease both;
}

.whef-warehouse-section[hidden],
.whef-postcode-alternative[hidden],
.whef-modal__notice[hidden],
.whef-pickup-section-help[hidden] {
    display: none !important;
}

.whef-warehouse-section.is-empty {
    display: none !important;
}

#whefRecommendedList:empty {
    display: none !important;
}

@keyframes whefFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes whefFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes whefDialogIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes whefDialogOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(8px) scale(.985);
    }
}

/* v1.1.5: is-empty is now managed dynamically by JS toggleSection(). */

/* v1.1.6 modal height and stored-selection summary */
.whef-modal__dialog {
    max-height: 700px;
    display: flex;
    flex-direction: column;
}

.whef-modal__body {
    overflow-y: auto;
}

.whef-current-selection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    padding: 14px 15px;
    border: 1px solid #ead6e1;
    border-radius: 16px;
    background: linear-gradient(180deg, #fff 0%, #fbf7f9 100%);
}

.whef-current-selection__content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.whef-current-selection__eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #8a6d7c;
}

.whef-current-selection__content strong {
    font-size: 17px;
    line-height: 1.15;
    color: var(--whef-heading-color, #2f2f2f);
}

.whef-current-selection__content span:last-child {
    font-size: 13px;
    color: var(--whef-body-text-color, #666);
}

.whef-current-selection__edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex-shrink: 0;
    border: 1px solid #d9b8c9;
    border-radius: 999px;
    background: #fff;
    color: var(--whef-accent-color, #c21875);
    padding: 9px 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: background .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.whef-current-selection__edit:hover,
.whef-current-selection__edit:focus {
    background: #faf3f7;
    border-color: var(--whef-primary-color, #c21875);
    box-shadow: 0 0 0 3px rgba(194, 24, 117, .10);
    outline: none;
}

.whef-mode-grid--single {
    grid-template-columns: 1fr;
}

.whef-mode-grid--single .whef-mode-card {
    min-height: 125px;
}

@media (max-width: 767px) {
    .whef-modal__dialog {
        max-height: 750px;
    }

    .whef-current-selection {
        align-items: flex-start;
        flex-direction: column;
    }

    .whef-current-selection__edit {
        width: 100%;
    }
}

/* v1.1.8 compact postcode auto-detection */
.whef-detect-status {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border: 1px solid #ead6e1;
    border-radius: 12px;
    background: linear-gradient(180deg, #fff 0%, #fbf7f9 100%);
}

.whef-detect-status__loader {
    position: relative;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 4px solid rgba(17, 24, 39, .12);
    border-top-color: var(--whef-spinner-color, var(--whef-accent-color, #2563eb));
    border-radius: 50%;
    box-sizing: border-box;
    color: var(--whef-spinner-color, var(--whef-accent-color, #2563eb));
}

@keyframes whefDetectSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.whef-detect-status--loading .whef-detect-status__loader {
    animation: whefDetectSpin var(--whef-spinner-speed, .9s) linear infinite;
}

.whef-detect-status--success .whef-detect-status__loader,
.whef-detect-status--error .whef-detect-status__loader {
    animation: none;
    border-color: currentColor;
    border-top-color: currentColor;
}

.whef-detect-status--success .whef-detect-status__loader::after,
.whef-detect-status--error .whef-detect-status__loader::after {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.whef-detect-status--success .whef-detect-status__loader {
    color: #279653;
}

.whef-detect-status--success .whef-detect-status__loader::after {
    content: '✓';
}

.whef-detect-status--error .whef-detect-status__loader {
    color: #c94040;
}

.whef-detect-status--error .whef-detect-status__loader::after {
    content: '×';
    font-size: 26px;
}

.whef-detect-status h4 {
    margin: 0 0 3px;
    font-size: 15px;
    font-weight: 800;
    color: var(--whef-heading-color, #2f2f2f);
}

.whef-detect-status p {
    margin: 0;
    color: var(--whef-body-text-color, #666);
    font-size: 13px;
    line-height: 1.35;
}

.whef-detect-status--success {
    border-color: #cfe8d7;
    background: #f6fff8;
}

.whef-detect-status--error {
    border-color: #f0c5c5;
    background: #fff7f7;
}

.whef-detected-postcode {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: 11px;
    background: #f8f8f8;
}

.whef-detected-postcode[hidden],
.whef-detect-actions[hidden] {
    display: none !important;
}

.whef-detected-postcode span {
    font-weight: 700;
    color: #555;
    font-size: 12px;
}

.whef-detected-postcode strong {
    font-size: 17px;
    color: var(--whef-heading-color, #2f2f2f);
}

.whef-detect-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.whef-detect-actions .whef-modal__button {
    flex: 0 0 auto;
    padding: 12px 16px;
    border-radius: 11px;
    font-size: 13px;
    line-height: 1.2;
}

@media (max-width: 767px) {
    .whef-detect-status {
        align-items: flex-start;
        gap: 9px;
        padding: 11px 12px;
    }

    .whef-detected-postcode {
        align-items: center;
        flex-direction: row;
    }

    .whef-detect-actions {
        justify-content: flex-start;
    }

    .whef-detect-actions .whef-modal__button {
        width: auto;
    }
}

/* Ajuste dinámico de ancho según opciones visibles */
.whef-modal__dialog--options-1 {
    max-width: 440px;
}

.whef-modal__dialog--options-2 {
    max-width: 620px;
}

.whef-modal__dialog--options-3 {
    max-width: 760px;
}

.whef-mode-grid--count-1 {
    grid-template-columns: minmax(0, 1fr);
}

.whef-mode-grid--count-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.whef-mode-grid--count-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 767px) {
    .whef-modal__dialog--options-1,
    .whef-modal__dialog--options-2,
    .whef-modal__dialog--options-3 {
        max-width: 100%;
    }

    .whef-mode-grid--count-1,
    .whef-mode-grid--count-2,
    .whef-mode-grid--count-3 {
        grid-template-columns: 1fr;
    }
}
