/* eSIM search bar pickers (includes/esim/components/dest_picker.html and
   days_picker.html): destination dropdown and trip-length picker, desktop
   dropdowns and phone sheets. Loaded wherever an eSIM search bar renders
   (home page tab, eSIM pages, PWA), so it carries its own tokens. */

.ep-dd, .ep-days, .ep-dd-panel, .ep-days-panel {
    --sb-red: #d8291c;
    --sb-red-deep: #b11f14;
    --sb-tint: #fdeeec;
    --sb-ink: #1c1c24;
    --sb-muted: #6b6f76;
    --sb-line: #ececef;
    --sb-soft: #f6f6f8;
    position: relative;
    font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.ep-dd [x-cloak], .ep-days [x-cloak], .ep-dd-panel [x-cloak], .ep-days-panel [x-cloak] { display: none !important; }
.ep-dd .esim-ic, .ep-days .esim-ic, .ep-dd-panel .esim-ic, .ep-days-panel .esim-ic { flex: none; }
.ep-dd *, .ep-days *, .ep-dd-panel *, .ep-days-panel * { box-sizing: border-box; }
.ep-dd-input { width: 100%; }

/* Destination panel. */
.ep-dd-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 1050;
    width: min(640px, 92vw);
    max-height: min(560px, 70vh);
    overflow-y: auto;
    padding: 8px 6px 10px;
    border: 1px solid var(--sb-line);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(16, 24, 40, .18), 0 4px 12px rgba(16, 24, 40, .06);
    text-align: left;
    color: var(--sb-ink);
}
.ep-dd-sec { padding: 8px 10px; }
.ep-dd-sec + .ep-dd-sec { border-top: 1px solid #f1f1f3; }
.ep-dd-h { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 8px; }
.ep-dd-h > span { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--sb-muted); }
.ep-dd-clear { padding: 2px 6px; border: 0; background: none; font-size: 12.5px; font-weight: 800; color: var(--sb-red); cursor: pointer; }
.ep-dd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ep-dd-chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px 0 9px; border: 1px solid var(--sb-line); border-radius: 999px; background: #fff; font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--sb-ink); cursor: pointer; }
.ep-dd-chip.is-active, .ep-dd-chip:hover { border-color: var(--sb-ink); }
.ep-dd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; }
.ep-dd-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 8px 10px; border: 0; border-radius: 12px; background: none; font-family: inherit; text-align: left; color: var(--sb-ink); cursor: pointer; }
.ep-dd-item.is-active, .ep-dd-item:hover { background: var(--sb-soft); }
.ep-dd-item.is-row { min-height: 54px; }
.ep-dd-flag { flex: none; width: 28px; height: 28px; object-fit: cover; border-radius: 50%; box-shadow: 0 0 0 1px rgba(16, 24, 40, .12); }
.ep-dd-chip .ep-dd-flag { width: 20px; height: 20px; }
.ep-dd-globe { width: 28px; height: 28px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--sb-tint); color: var(--sb-red); }
.ep-dd-globe.is-sm { width: 20px; height: 20px; }
.ep-dd-name { flex: 1; min-width: 0; overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.ep-dd-name mark { padding: 0; border-radius: 3px; background: #ffe3a6; color: inherit; }
.ep-dd-kind { flex: none; font-size: 11.5px; font-weight: 700; color: var(--sb-muted); }
.ep-dd-price { flex: none; display: inline-flex; align-items: baseline; gap: 4px; font-size: 12px; color: var(--sb-muted); white-space: nowrap; }
.ep-dd-price b { font-size: 13px; font-weight: 800; color: var(--sb-red); }
.ep-dd-empty { padding: 14px; font-size: 14px; font-weight: 600; color: var(--sb-muted); }
.ep-dd-sheethead { display: none; }

/* Trip-length picker. */
.ep-days-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; cursor: pointer; }
.ep-days-btn .esim-ic { color: var(--sb-muted); transition: transform .2s; }
.ep-days-btn[aria-expanded="true"] .esim-ic { transform: rotate(180deg); }
.ep-days-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 1050;
    width: 360px;
    padding: 18px;
    border: 1px solid var(--sb-line);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(16, 24, 40, .18), 0 4px 12px rgba(16, 24, 40, .06);
    text-align: left;
    color: var(--sb-ink);
}
.ep-days-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ep-days-head b { font-size: 15px; font-weight: 800; }
.ep-days-x { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: var(--sb-soft); color: var(--sb-ink); cursor: pointer; }
.ep-days-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ep-days-chip { height: 40px; padding: 0 8px; border: 1px solid var(--sb-line); border-radius: 12px; background: #fff; font-family: inherit; font-size: 13.5px; font-weight: 800; color: var(--sb-ink); cursor: pointer; }
.ep-days-chip.is-all { grid-column: 1 / -1; }
.ep-days-chip:hover { border-color: var(--sb-ink); }
.ep-days-chip.is-on { border-color: var(--sb-red); background: var(--sb-tint); color: var(--sb-red); }
.ep-days-custom { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #f1f1f3; }
.ep-days-custom > span { flex: 1; font-size: 13px; font-weight: 700; color: var(--sb-muted); }
.ep-days-panel .ep-stepper { display: inline-flex; align-items: center; height: 40px; border: 1px solid var(--sb-line); border-radius: 12px; background: #fff; }
.ep-days-panel .ep-stepper button { width: 34px; height: 100%; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--sb-ink); cursor: pointer; }
.ep-days-panel .ep-stepper input { width: 46px; height: 100%; border: 0; background: none; font-family: inherit; font-size: 15px; font-weight: 800; text-align: center; -moz-appearance: textfield; }
.ep-days-panel .ep-stepper input::-webkit-outer-spin-button, .ep-days-panel .ep-stepper input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.ep-days-panel .ep-btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--sb-red); font-family: inherit; font-size: 13.5px; font-weight: 800; color: #fff; cursor: pointer; }
.ep-days-panel .ep-btn:hover { background: var(--sb-red-deep); }

/* Phones / PWA: destination full-screen sheet, trip length bottom sheet. */
.ep-dd-panel.is-sheet {
    position: fixed;
    inset: 0;
    z-index: 9000;
    width: auto;
    max-height: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}
.ep-dd-panel.is-sheet .ep-dd-sheethead { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; border-bottom: 1px solid var(--sb-line); background: #fff; }
.ep-dd-back { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: var(--sb-soft); color: var(--sb-ink); }
.ep-dd-back .esim-ic { transform: rotate(180deg); }
.ep-dd-sheetfield { display: flex; flex: 1; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 1.5px solid var(--sb-ink); border-radius: 12px; color: var(--sb-muted); }
.ep-dd-sheetfield input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-family: inherit; font-size: 16px; font-weight: 700; color: var(--sb-ink); }
.ep-dd-panel.is-sheet .ep-dd-body { flex: 1; overflow-y: auto; padding: 6px 4px calc(20px + env(safe-area-inset-bottom)); }
.ep-dd-panel.is-sheet .ep-dd-grid { grid-template-columns: minmax(0, 1fr); }
.ep-days-panel.is-sheet {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9000;
    width: auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, .25);
}
html.esim-sheet-open, html.esim-sheet-open body { overflow: hidden; }
@media (max-width: 767.98px) {
    .ep-dd-panel:not(.is-sheet) { width: calc(100vw - 32px); }
    .ep-dd-grid { grid-template-columns: minmax(0, 1fr); }
    .ep-days-panel:not(.is-sheet) { width: calc(100vw - 32px); }
}

/* PWA field look. */
.esim-pwa-sb .ep-pwa-input { opacity: 1 !important; width: 100%; height: 100%; min-height: 26px; padding: 0; border: 0; outline: 0; background: transparent; font-family: inherit; font-size: 15px; font-weight: 600; color: #1c1c24; }
.esim-pwa-sb .ep-dd, .esim-pwa-sb .ep-days { width: 100%; }

/* Results page: the edit form opens as an overlay, keep the panels on top. */
.tour-form--collapsible .ep-dd-panel:not(.is-sheet), .tour-form--collapsible .ep-days-panel:not(.is-sheet) { z-index: 1100; }
@media (prefers-reduced-motion: reduce) {
    .ep-days-btn .esim-ic { transition: none; }
}

/* The shared search bar CSS turns pointer events off on date fields (they
   open a calendar elsewhere); the eSIM pickers handle their own clicks. */
.esim-search-form .ep-days-btn, .esim-search-form .ep-dd-input, .esim-search-form .ep-days-panel, .esim-search-form .ep-dd-panel { pointer-events: auto !important; }
#esim-search-form .ep-days-btn { height: var(--search-form-input-height, 52px); padding: 0 16px; border: 1px solid #e5e7eb; border-radius: var(--sb-radius, 12px); background: #fff; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--sb-ink); }
#esim-search-form .ep-days-btn:hover, #esim-search-form .ep-days-btn[aria-expanded="true"] { border-color: var(--sb-ink); }
#esim-search-form .ep-dd-input { height: var(--search-form-input-height, 52px); }
.ep-days-sheetwrap { position: fixed; inset: 0; z-index: 9000; }
.ep-days-backdrop { position: absolute; inset: 0; background: rgba(12, 14, 20, .45); }

/* The shared search bar CSS hides text inputs inside the form (font-size 0,
   transparent text): restore the day count input of the stepper. */
.ep-days-panel .ep-stepper input[type="number"] { width: 52px !important; height: 38px !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important; border-left: 1px solid var(--sb-line) !important; border-right: 1px solid var(--sb-line) !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; font-family: inherit !important; font-size: 16px !important; font-weight: 800 !important; line-height: 38px !important; text-align: center !important; color: var(--sb-ink) !important; -webkit-text-fill-color: var(--sb-ink) !important; opacity: 1 !important; text-indent: 0 !important; }
.ep-days-panel .ep-stepper { overflow: hidden; }
/* PWA destination / days fields: the value sits in the field, not at its bottom. */
.esim-pwa-sb .zfld-box { display: flex; align-items: center; min-height: 44px; }
.esim-pwa-sb .ep-pwa-input { height: 26px !important; line-height: 26px; }
.esim-pwa-sb .ep-days-btn { height: 26px; padding: 0; border: 0; background: transparent; }
@media (max-width: 767.98px) {
    .esim-pwa-sb .zfld-lbl { font-size: 12px !important; }
    .esim-pwa-sb .ep-days-btn, .esim-pwa-sb .ep-pwa-input { min-height: 44px; height: 44px !important; }
    .esim-pwa-sb .zfld-box { min-height: 44px; padding-top: 0; padding-bottom: 0; }
}
