/* ========================================================================== 
   APD 41.0.0 · buscador público de precisión.
   Corrige escala, centrado, estados activos, foco, sombras, paneles y acciones.
   ========================================================================== */
:root {
    --apd41-search-width: 680px;
    --apd41-search-height: 52px;
    --apd41-search-border: #dddddd;
    --apd41-search-bg: #ffffff;
    --apd41-search-open-bg: #ebebeb;
    --apd41-text: #222222;
    --apd41-muted: #6a6a6a;
    --apd41-blue: #0f73ea;
    --apd41-blue-hover: #0865d7;
    --apd41-field-shadow: 0 3px 12px rgba(0,0,0,.18);
    --apd41-search-shadow: 0 3px 14px rgba(0,0,0,.12);
    --apd41-panel-shadow: 0 12px 38px rgba(0,0,0,.18);
}

body.apd41-search-precision .apd41-region-trigger {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    margin: 0;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: #f5f5f5;
    color: #222;
    box-shadow: none;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
}
body.apd41-search-precision .apd41-region-trigger:hover { background: #ebebeb; }
body.apd41-search-precision .apd41-region-trigger:active { transform: scale(.96); }
body.apd41-search-precision .apd41-region-trigger .apd5-icon {
    width: 17px;
    height: 17px;
    display: block;
}

@media (min-width: 1180px) {
    /* Same broad desktop alignment as the reference header. */
    html body.apd41-search-precision .apd5-header.is-discovery-context .apd5-header-row {
        width: min(calc(100vw - 64px), 1470px) !important;
        max-width: 1470px !important;
        grid-template-columns: 200px minmax(680px, 1fr) 300px !important;
        column-gap: 24px !important;
        margin-inline: auto !important;
    }
    html body.apd41-search-precision .apd5-header.is-discovery-context .apd5-header-actions {
        justify-self: end !important;
        gap: 8px !important;
    }
    html body.apd41-search-precision .apd5-header.is-discovery-context .apd5-logo {
        justify-self: start !important;
    }

    /* Center the search row independently from the three-column header. */
    html body.apd41-search-precision .apd5-header.is-discovery-context:not(.is-compact) > .apd5-header-search-row,
    html body.apd41-search-precision .apd5-header.is-discovery-context.is-compact.is-search-expanded > .apd5-header-search-row {
        position: relative !important;
        left: 50% !important;
        right: auto !important;
        width: var(--apd41-search-width) !important;
        min-width: var(--apd41-search-width) !important;
        max-width: var(--apd41-search-width) !important;
        margin: 0 !important;
        padding-inline: 0 !important;
        transform: translateX(-50%) !important;
        overflow: visible !important;
    }

    /* Exact desktop pill geometry. */
    html body.apd41-search-precision .apd5-header.is-discovery-context:not(.is-compact) .apd5-search,
    html body.apd41-search-precision .apd5-header.is-discovery-context.is-compact.is-search-expanded .apd5-search {
        width: var(--apd41-search-width) !important;
        min-width: var(--apd41-search-width) !important;
        max-width: var(--apd41-search-width) !important;
        height: var(--apd41-search-height) !important;
        min-height: var(--apd41-search-height) !important;
        max-height: var(--apd41-search-height) !important;
        grid-template-columns: 222px 1px 232px 1px 176px 48px !important;
        align-items: stretch !important;
        border: 1px solid var(--apd41-search-border) !important;
        border-radius: 999px !important;
        background: var(--apd41-search-bg) !important;
        box-shadow: var(--apd41-search-shadow) !important;
        overflow: visible !important;
        isolation: isolate !important;
        transition: background .16s ease, box-shadow .16s ease !important;
    }
    html body.apd41-search-precision .apd5-header.is-discovery-context:not(.is-compact) .apd5-search.has-open-panel,
    html body.apd41-search-precision .apd5-header.is-discovery-context.is-compact.is-search-expanded .apd5-search.has-open-panel {
        grid-template-columns: 222px 1px 232px 1px 136px 88px !important;
        background: var(--apd41-search-open-bg) !important;
    }

    html body.apd41-search-precision .apd5-search-field {
        min-width: 0 !important;
        height: 100% !important;
        overflow: visible !important;
        border-radius: 999px !important;
    }
    html body.apd41-search-precision .apd5-search-field > button:first-child {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 100% !important;
        min-height: 100% !important;
        margin: 0 !important;
        padding: 0 24px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
        gap: 0 !important;
        border: 0 !important;
        border-radius: 999px !important;
        outline: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: var(--apd41-text) !important;
        text-align: left !important;
        cursor: pointer !important;
        transition: background .16s ease, box-shadow .16s ease, transform .1s ease !important;
    }
    html body.apd41-search-precision .apd5-search-field > button:first-child:focus,
    html body.apd41-search-precision .apd5-search-field > button:first-child:focus-visible {
        outline: 0 !important;
        box-shadow: none !important;
    }
    html body.apd41-search-precision .apd5-search-field > button:first-child:active {
        transform: scale(.99) !important;
    }
    html body.apd41-search-precision .apd5-search-field > button:first-child > span:first-child {
        display: block !important;
        margin: 0 !important;
        color: var(--apd41-text) !important;
        font-size: 11px !important;
        line-height: 1.1 !important;
        font-weight: 700 !important;
        letter-spacing: 0 !important;
    }
    html body.apd41-search-precision .apd5-search-field > button:first-child > strong[id] {
        display: block !important;
        max-width: 100% !important;
        margin: 4px 0 0 !important;
        overflow: hidden !important;
        color: var(--apd41-muted) !important;
        font-size: 13px !important;
        line-height: 1.1 !important;
        font-weight: 400 !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
    }
    html body.apd41-search-precision .apd5-search-field.is-open > button:first-child {
        position: relative !important;
        z-index: 8 !important;
        background: #fff !important;
        box-shadow: var(--apd41-field-shadow) !important;
    }
    html body.apd41-search-precision .apd5-search.has-open-panel .apd5-search-field:not(.is-open) > button:first-child:hover {
        background: rgba(255,255,255,.46) !important;
    }
    html body.apd41-search-precision .apd5-search:not(.has-open-panel) .apd5-search-field > button:first-child:hover {
        background: #f7f7f7 !important;
    }

    html body.apd41-search-precision .apd5-search-separator {
        align-self: center !important;
        width: 1px !important;
        height: 30px !important;
        background: #dddddd !important;
        opacity: 1 !important;
        transition: opacity .12s ease !important;
    }
    html body.apd41-search-precision .apd5-search[data-active-panel="location"] .is-after-location,
    html body.apd41-search-precision .apd5-search[data-active-panel="dates"] .is-after-location,
    html body.apd41-search-precision .apd5-search[data-active-panel="dates"] .is-after-dates,
    html body.apd41-search-precision .apd5-search[data-active-panel="guests"] .is-after-dates,
    html body.apd41-search-precision .apd5-search[data-active-panel="service"] .is-after-dates,
    html body.apd41-search-precision .apd5-search[data-hover-field="location"] .is-after-location,
    html body.apd41-search-precision .apd5-search[data-hover-field="dates"] .is-after-location,
    html body.apd41-search-precision .apd5-search[data-hover-field="dates"] .is-after-dates,
    html body.apd41-search-precision .apd5-search[data-hover-field="guests"] .is-after-dates,
    html body.apd41-search-precision .apd5-search[data-hover-field="service"] .is-after-dates {
        opacity: 0 !important;
    }

    /* Search action: icon can never be hidden underneath the traveler field. */
    html body.apd41-search-precision .apd5-search-submit {
        position: relative !important;
        z-index: 30 !important;
        justify-self: end !important;
        align-self: center !important;
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        margin: 0 4px 0 0 !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        overflow: hidden !important;
        border: 0 !important;
        border-radius: 999px !important;
        outline: 0 !important;
        background: var(--apd41-blue) !important;
        color: #fff !important;
        box-shadow: 0 2px 7px rgba(15,115,234,.24) !important;
        cursor: pointer !important;
        transition: width .16s ease, background .15s ease, transform .1s ease, box-shadow .15s ease !important;
    }
    html body.apd41-search-precision .apd5-search-submit:hover {
        background: var(--apd41-blue-hover) !important;
        box-shadow: 0 3px 10px rgba(15,115,234,.30) !important;
    }
    html body.apd41-search-precision .apd5-search-submit:active { transform: scale(.97) !important; }
    html body.apd41-search-precision .apd5-search-submit:focus,
    html body.apd41-search-precision .apd5-search-submit:focus-visible { outline: 0 !important; }
    html body.apd41-search-precision .apd5-search-submit .apd5-icon,
    html body.apd41-search-precision .apd5-search-submit svg {
        position: relative !important;
        z-index: 2 !important;
        display: block !important;
        flex: 0 0 17px !important;
        width: 17px !important;
        min-width: 17px !important;
        max-width: 17px !important;
        height: 17px !important;
        min-height: 17px !important;
        max-height: 17px !important;
        overflow: visible !important;
        opacity: 1 !important;
        visibility: visible !important;
        color: #fff !important;
        stroke: currentColor !important;
    }
    html body.apd41-search-precision .apd5-search-submit > span {
        display: none !important;
        margin: 0 !important;
        color: #fff !important;
        font-size: 13px !important;
        line-height: 1 !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
    }
    html body.apd41-search-precision .apd5-search.has-open-panel .apd5-search-submit {
        width: 82px !important;
        min-width: 82px !important;
        max-width: 82px !important;
        padding: 0 12px !important;
        gap: 6px !important;
    }
    html body.apd41-search-precision .apd5-search.has-open-panel .apd5-search-submit > span {
        display: inline !important;
    }

    /* Location text editor: remove the native black focus rectangle. */
    html body.apd41-search-precision .apd5-search-field[data-search-field="location"].is-open > button:first-child > span,
    html body.apd41-search-precision .apd5-search-field[data-search-field="location"].is-open > button:first-child > strong,
    html body.apd41-search-precision .apd5-search-field[data-search-field="location"].is-open > button:first-child > .apd26-search-leading-icon {
        opacity: 0 !important;
        visibility: hidden !important;
    }
    html body.apd41-search-precision .apd5-search-field[data-search-field="location"].is-open .apd26-inline-editor {
        position: absolute !important;
        inset: 0 38px 0 24px !important;
        z-index: 15 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
        gap: 3px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        outline: 0 !important;
        background: transparent !important;
        pointer-events: auto !important;
    }
    html body.apd41-search-precision .apd5-search-field[data-search-field="location"].is-open .apd26-inline-editor > span {
        display: block !important;
        margin: 0 !important;
        color: #222 !important;
        font-size: 11px !important;
        line-height: 1 !important;
        font-weight: 700 !important;
    }
    html body.apd41-search-precision .apd26-search-inline-input,
    html body.apd41-search-precision input.apd26-search-inline-input[type="search"] {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 18px !important;
        min-height: 18px !important;
        max-height: 18px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        outline: 0 !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        background: transparent !important;
        box-shadow: none !important;
        color: #222 !important;
        caret-color: #222 !important;
        font-family: Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif !important;
        font-size: 13px !important;
        line-height: 18px !important;
        font-weight: 400 !important;
    }
    html body.apd41-search-precision .apd26-search-inline-input:focus,
    html body.apd41-search-precision .apd26-search-inline-input:focus-visible {
        border: 0 !important;
        outline: 0 !important;
        box-shadow: none !important;
    }
    html body.apd41-search-precision .apd26-search-inline-input::-webkit-search-decoration,
    html body.apd41-search-precision .apd26-search-inline-input::-webkit-search-cancel-button,
    html body.apd41-search-precision .apd26-search-inline-input::-webkit-search-results-button,
    html body.apd41-search-precision .apd26-search-inline-input::-webkit-search-results-decoration {
        display: none !important;
        -webkit-appearance: none !important;
    }
    html body.apd41-search-precision .apd26-field-clear {
        position: absolute !important;
        z-index: 18 !important;
        right: 10px !important;
        top: 50% !important;
        width: 24px !important;
        min-width: 24px !important;
        max-width: 24px !important;
        height: 24px !important;
        min-height: 24px !important;
        max-height: 24px !important;
        margin: 0 !important;
        padding: 0 0 2px !important;
        display: grid !important;
        place-items: center !important;
        transform: translateY(-50%) !important;
        border: 0 !important;
        border-radius: 50% !important;
        outline: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: #222 !important;
        font: 400 17px/1 Arial,sans-serif !important;
        cursor: pointer !important;
    }
    html body.apd41-search-precision .apd26-field-clear:hover { background: #ebebeb !important; }
    html body.apd41-search-precision .apd26-field-clear[hidden] { display: none !important; }

    /* Traveler clear action stays inside the active pill and never over the search button. */
    html body.apd41-search-precision .apd5-search-field[data-search-field="guests"] > button.apd16-search-clear {
        position: absolute !important;
        z-index: 18 !important;
        right: 8px !important;
        top: 50% !important;
        width: 24px !important;
        min-width: 24px !important;
        max-width: 24px !important;
        height: 24px !important;
        min-height: 24px !important;
        max-height: 24px !important;
        margin: 0 !important;
        padding: 0 0 2px !important;
        display: grid !important;
        place-items: center !important;
        transform: translateY(-50%) !important;
        border: 0 !important;
        border-radius: 50% !important;
        outline: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: #222 !important;
        font: 400 17px/1 Arial,sans-serif !important;
        cursor: pointer !important;
    }
    html body.apd41-search-precision .apd5-search-field[data-search-field="guests"] > button.apd16-search-clear:hover {
        background: #ebebeb !important;
    }
    html body.apd41-search-precision .apd5-search-field[data-search-field="guests"] > button.apd16-search-clear[hidden] {
        display: none !important;
    }
    html body.apd41-search-precision .apd5-search-field[data-search-field="guests"]:has(> .apd16-search-clear:not([hidden])) > button:first-child {
        padding-right: 38px !important;
    }

    /* Popovers: rounded, aligned, and less oversized than the current APD boxes. */
    html body.apd41-search-precision .apd5-search-panel {
        top: 62px !important;
        z-index: 100 !important;
        margin: 0 !important;
        border: 1px solid rgba(0,0,0,.07) !important;
        border-radius: 28px !important;
        background: #fff !important;
        box-shadow: var(--apd41-panel-shadow) !important;
        overflow: auto !important;
        overscroll-behavior: contain !important;
    }
    html body.apd41-search-precision .apd5-location-panel {
        left: 0 !important;
        right: auto !important;
        width: 340px !important;
        min-width: 340px !important;
        max-width: 340px !important;
        max-height: min(560px, calc(100vh - 230px)) !important;
        padding: 20px 14px 16px !important;
        transform: none !important;
    }
    html body.apd41-search-precision .apd5-date-panel {
        left: 50% !important;
        right: auto !important;
        width: min(850px, calc(100vw - 48px)) !important;
        max-width: min(850px, calc(100vw - 48px)) !important;
        transform: translateX(-50%) !important;
    }
    html body.apd41-search-precision .apd5-guests-panel,
    html body.apd41-search-precision .apd5-service-panel {
        left: auto !important;
        right: 0 !important;
        width: 424px !important;
        min-width: 424px !important;
        max-width: 424px !important;
        max-height: min(560px, calc(100vh - 230px)) !important;
        padding: 24px 28px !important;
        transform: none !important;
    }
    html body.apd41-search-precision .apd5-location-panel .apd5-panel-filter {
        border: 0 !important;
        outline: 0 !important;
        box-shadow: none !important;
    }
    html body.apd41-search-precision .apd5-location-panel input[type="search"] {
        outline: 0 !important;
        box-shadow: none !important;
        appearance: none !important;
        -webkit-appearance: none !important;
    }
    html body.apd41-search-precision .apd5-location-panel input[type="search"]::-webkit-search-cancel-button {
        display: none !important;
    }

    /* Airbnb-like soft page veil while a search panel is open. */
    html body.apd41-search-precision #apd5-search-backdrop:not([hidden]) {
        background: rgba(0,0,0,.035) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* Compact header remains stable and centered after scrolling. */
@media (min-width: 1180px) {
    html body.apd41-search-precision .apd5-header.is-discovery-context.is-compact:not(.is-search-expanded) > .apd5-header-search-row {
        left: 50% !important;
        right: auto !important;
        width: 360px !important;
        min-width: 360px !important;
        max-width: 360px !important;
        margin: 0 !important;
        transform: translate(-50%, -50%) !important;
    }
    html body.apd41-search-precision .apd5-header.is-discovery-context.is-compact:not(.is-search-expanded) .apd5-search {
        width: 360px !important;
        min-width: 360px !important;
        max-width: 360px !important;
        height: 48px !important;
        min-height: 48px !important;
        grid-template-columns: 132px 1px 108px 1px 74px 44px !important;
        border: 1px solid #ddd !important;
        border-radius: 999px !important;
        background: #fff !important;
        box-shadow: 0 3px 12px rgba(0,0,0,.13) !important;
    }
    html body.apd41-search-precision .apd5-header.is-discovery-context.is-compact:not(.is-search-expanded) .apd5-search-submit {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        margin-right: 3px !important;
    }
}

@media (max-width: 1179px) {
    body.apd41-search-precision .apd41-region-trigger { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    body.apd41-search-precision .apd5-search,
    body.apd41-search-precision .apd5-search-field > button,
    body.apd41-search-precision .apd5-search-submit,
    body.apd41-search-precision .apd41-region-trigger {
        transition-duration: .001ms !important;
    }
}
