/* SITE SEARCH (MVP) — markup in header.php, behaviour in assets/js/site-search.js.
   Spec: docs/features/2026-11-20-site-search.md
   Desktop (>=576px): "Buscar" next to Destinos opens the field in place when the navbar has room,
   otherwise a centred bar over the navbar.
   Mobile: magnifier in .navbar-right opens the block as a full-screen view. */

/* Mobile trigger: same colours as the other header icons (see .contact-modal-toggler in custom.css) */
.ss-toggler{ background:none; border:0; padding:0 .5rem; line-height:1; vertical-align:middle; cursor:pointer; color:inherit; min-width:44px; min-height:44px;}
.navtrans .ss-toggler{ color:#fff;}
.navbw .ss-toggler{ color:#000;}
.navbarshrink .ss-toggler{ color:#9B9EA0;}
.ss-toggler svg{ width:20px; height:20px;}

.ss{ display:none; position:relative; font-family:'Montserrat',sans-serif;}
.ss-bar{ display:flex; align-items:center; gap:8px;}
.ss-icon{ position:absolute; left:12px; top:0; height:38px; display:flex; align-items:center; color:#6B7177; pointer-events:none;}
.ss-input{ width:100%; height:38px; padding:0 14px 0 38px; border:1px solid rgba(0,0,0,.14); border-radius:19px; background:#fff; color:#181C20; font-size:14px; font-weight:500; outline:none; -webkit-appearance:none; appearance:none;}
.ss-input::placeholder{ color:#6B7177; font-weight:400;}
.ss-input:focus{ border-color:#181C20; box-shadow:0 0 0 3px rgba(250,210,46,.55);}
.ss-input::-webkit-search-cancel-button{ -webkit-appearance:none;}
.ss-cancel{ display:none; background:none; border:0; padding:8px 4px; font-size:15px; font-weight:600; color:#181C20; white-space:nowrap; cursor:pointer;}

.ss-panel{ position:absolute; top:46px; left:0; width:400px; max-width:calc(100vw - 32px); max-height:calc(100vh - 120px); overflow-y:auto; background:#fff; border-radius:14px; box-shadow:0 12px 32px rgba(24,28,32,.18), 0 0 0 1px rgba(0,0,0,.05); padding:8px 0; z-index:1040;}
.ss-panel[hidden]{ display:none;}
.ss-list{ list-style:none; margin:0; padding:0;}
.ss-group{ padding:10px 16px 4px; font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:#6B7177;}
.ss-opt{ display:flex; align-items:center; gap:12px; padding:8px 16px; min-height:48px; cursor:pointer; color:#181C20; text-decoration:none;}
.ss-opt:hover, .ss-opt.is-active{ background:#F4F5F2;}
.ss-opt.is-active{ box-shadow:inset 3px 0 0 #FAD22E;}
.ss-thumb{ flex:none; width:48px; height:48px; border-radius:8px; background:#ECEEE9 center/cover no-repeat;}
.ss-pin{ flex:none; width:36px; height:36px; border-radius:50%; background:#F4F5F2; display:flex; align-items:center; justify-content:center; color:#181C20;}
.ss-txt{ flex:1; min-width:0;}
.ss-name{ display:block; font-size:14px; font-weight:500; line-height:1.3; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;}
.ss-name b{ font-weight:700;}
.ss-sub{ display:block; font-size:12px; color:#6B7177; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.ss-price{ flex:none; font-size:12px; color:#181C20; white-space:nowrap;}
.ss-price b{ font-weight:700;}

.ss-empty{ padding:14px 16px 10px; font-size:14px; line-height:1.45; color:#181C20;}
.ss-empty p{ margin:0 0 10px;}
.ss-empty .ss-ask{ display:inline-block; padding:10px 18px; border:0; border-radius:22px; background:#181C20; color:#fff; font-size:14px; font-weight:600; cursor:pointer;}

/* Desktop: "Buscar" next to Destinos; opening it turns the navbar into a centred search bar */
.ss-toggler-label{ display:none;}
@media (min-width:576px){
    /* Logo → Destinos = Destinos → Buscar (32px between texts) */
    #mainnavbar .navbar-brand{ margin-right:1.5rem;}
    /* Plain inline text like the Destinos link (no flex): Safari puts flex text in a <button> on another baseline */
    .ss-toggler-desk{ display:block; min-height:0; min-width:0; padding:.5rem; margin-left:1rem; font:inherit; color:inherit; white-space:nowrap; vertical-align:baseline;}
    .ss-toggler-desk svg{ width:18px; height:18px; vertical-align:-3px; margin-right:6px;} /* = .ss-icon size, so opening the field doesn't resize it */
    body.ss-open #mainnavbar::after{ content:''; position:absolute; inset:0; background:#fff; box-shadow:0 1px 0 rgba(0,0,0,.08); z-index:2;}
    body.ss-open .ss{ display:flex; align-items:center; gap:12px; position:absolute; top:0; bottom:0; left:50%; transform:translateX(-50%); width:640px; max-width:calc(100% - 32px); z-index:3;}
    body.ss-open .ss-bar{ flex:1; position:relative;}
    body.ss-open .ss-icon{ top:50%; transform:translateY(-50%); height:auto;}
    body.ss-open .ss-input{ height:44px; border-radius:22px; font-size:15px;}
    body.ss-open .ss-cancel{ display:block;}
    body.ss-open .ss-panel{ top:calc(50% + 30px); width:100%; max-width:none;}
}
@media (min-width:768px){ .ss-toggler-label{ display:inline;} }
/* Desktop with room: the field opens in place of "Buscar" (left/width set by site-search.js) */
@media (min-width:576px){
    body.ss-inline .ss{ display:block; position:absolute; top:50%; transform:translateY(-50%); margin:0; z-index:3;}
    body.ss-inline .ss-toggler-desk{ visibility:hidden;}
    body.ss-inline .ss-panel{ top:46px;}
}

/* Mobile full-screen view */
@media (max-width:575.98px){
    body.ss-open{ overflow:hidden;}
    body.ss-open .ss{ display:block; position:fixed; inset:0; z-index:1045; background:#fff; padding:20px 16px 0; padding-top:calc(20px + env(safe-area-inset-top));}
    body.ss-open .ss-cancel{ display:block;}
    body.ss-open .ss-icon{ left:28px; top:calc(20px + env(safe-area-inset-top));}
    body.ss-open .ss-input{ height:44px; border-radius:22px; font-size:16px;} /* >=16px: iOS doesn't zoom */
    body.ss-open .ss-icon{ height:44px;}
    body.ss-open .ss-panel{ position:static; width:auto; max-width:none; max-height:calc(100vh - 80px); max-height:calc(100dvh - 80px); box-shadow:none; border-radius:0; margin:8px -16px 0; padding-bottom:24px;}
    body.ss-open .ss-panel[hidden]{ display:none;}
}
