/* =========================================================
   MunicipalPost - select_municipio v2
   Archivo: /css/select_municipio_v2.css
   ========================================================= */

/* =========================
   TWEAKS RÁPIDOS (ajústalos)
   ========================= */
:root{
  /* Sube/baja los inputs (bloque fixed) */
  --muni-top: calc(env(safe-area-inset-top) + 52px);

  /* Separación y forma */
  --muni-gap: 12px;
  --muni-radius: 18px;

  /* Header hero */
  --hero-min-height: 290px;

  /* Si quieres quitar lo redondo de abajo, pon 0px */
  --hero-bottom-radius: 22px;

  /* Espacio entre input municipio y input perfiles */
  --profiles-gap-top: 4px;
}

/* ===== Autocomplete arriba de TODO ===== */
.ui-autocomplete{
  z-index: 99999 !important;
  max-height: 55vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== Igual que index: avatar + título ===== */
h3.post-heading{
  display:flex;
  align-items:center;
  gap:0.5em;
  margin:0;
  line-height:1;
}
h3.post-heading > img.post-heading-icon{
  width:32px !important;
  height:32px !important;
  border-radius:50%;
  object-fit:cover;
  flex-shrink:0;
}
h3.post-heading a{
  text-decoration:none;
  color:inherit;
  margin:0;
  padding:0;
}

/* ===== No encajonar feed ===== */
.content, main, #posts{
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ===== Ajuste logo (opcional) ===== */
#logo{ max-width: 250px; height:auto; }

/* =========================
   HEADER HERO (slideshow)
   ========================= */
header.mp-header-hero{
  position: relative !important;
  overflow: hidden !important;
  background: transparent !important;
  border-radius: 0 0 var(--hero-bottom-radius) var(--hero-bottom-radius);
  min-height: var(--hero-min-height);
  padding-top: env(safe-area-inset-top);
  padding-bottom: 8px;
  transform: none !important; /* evita bugs fixed en iOS */
  filter: none !important;
}

.mp-hero-bg{
  position:absolute;
  inset:0;
  z-index:0 !important;
}

.mp-hero-bg span{
  position:absolute;
  inset:0;
  background-size: cover;
  background-position: center;
  background-repeat:no-repeat;
  opacity:0;
  transform: scale(1.06);
  filter: saturate(1.05) contrast(1.05);
  animation: mpFade 20s infinite;
  will-change: opacity, transform;
}

/* Cambia rutas */
.mp-hero-bg span:nth-child(1){ background-image:url('https://images.pexels.com/photos/439391/pexels-photo-439391.jpeg?auto=compress&cs=tinysrgb&w=1200'); animation-delay: 0s; }
.mp-hero-bg span:nth-child(2){ background-image:url('https://images.pexels.com/photos/373912/pexels-photo-373912.jpeg?auto=compress&cs=tinysrgb&w=1200'); animation-delay: 5s; }
.mp-hero-bg span:nth-child(3){ background-image:url('https://images.pexels.com/photos/3757941/pexels-photo-3757941.jpeg?auto=compress&cs=tinysrgb&w=1200'); animation-delay: 10s; }
.mp-hero-bg span:nth-child(4){ background-image:url('https://images.pexels.com/photos/12327672/pexels-photo-12327672.jpeg?auto=compress&cs=tinysrgb&w=1200'); animation-delay: 15s; }

@keyframes mpFade{
  0%{opacity:0;}
  8%{opacity:1;}
  25%{opacity:1;}
  33%{opacity:0;}
  100%{opacity:0;}
}

/* ✅ SIN filtro oscuro */
header.mp-header-hero::after{
  content:"";
  position:absolute;
  inset:0;
  z-index:1 !important;
  background: none !important;
}

/* El contenido arriba del fondo */
header.mp-header-hero > :not(.mp-hero-bg){
  position: relative;
  z-index: 6;
}

/* Header content estable */
header.mp-header-hero .header-content{
  position: relative;
  z-index: 7;
  display:flex;
  align-items:center;
  justify-content: space-between;
}

/* Iconos compartir clickeables */
header.mp-header-hero .share-boton,
header.mp-header-hero .facebook-share-button{
  position: relative;
  z-index: 10;
}

@media (prefers-reduced-motion: reduce){
  .mp-hero-bg span{ animation:none; opacity:1; }
}

/* =========================
   FAB: Inputs (Municipio + Perfiles)
   ========================= */

/* 🔥 FIXED REAL: independiente del header */
.muni-fab{
  position: fixed !important;
  top: var(--muni-top) !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 13000 !important;
  padding: 8px 10px;
  pointer-events: none;
}

.muni-fab-row{
  max-width: 860px;
  margin: 0 auto;
  display:flex;
  gap: var(--muni-gap);
  align-items:center;
  pointer-events: auto;
}

/* Segunda fila (perfiles) */
.muni-fab-row--profiles{
  max-width: 860px;
  margin: var(--profiles-gap-top) auto 0 !important;
  pointer-events: auto;
}

/* Input municipio (glass) */
#muniPickForm{
  flex: 1;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--muni-radius);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 10px 25px rgba(0,0,0,.10);
}

.muni-pin{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.04);
  flex-shrink:0;
}
.muni-pin i{ font-size: 16px; }

#muniPickForm input{
  flex: 1;
  height: 40px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
}

.muni-menu-btn{
  width: 56px;
  height: 56px;
  border-radius: var(--muni-radius);
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 25px rgba(0,0,0,.10);
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 22px;
  pointer-events: auto;
}

.muni-fab-menu{
  max-width: 860px;
  margin: 10px auto 0;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--muni-radius);
  overflow:hidden;
  box-shadow: 0 10px 25px rgba(0,0,0,.10);
  pointer-events: auto;
}
.muni-fab-menu a{
  display:block;
  padding: 14px 14px;
  text-decoration:none;
  color:#111;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.muni-fab-menu a:last-child{ border-bottom:0; }
.muni-fab-menu a:hover{ background: rgba(0,0,0,.03); }

.muni-mini-hint{
  padding: 12px 14px;
  font-size: 13px;
  color:#555;
}

.muni-error{
  max-width: 860px;
  margin: 10px auto 0;
  font-size: 14px;
  color:#8a1f1f;
  background:#fff1f1;
  border:1px solid #ffd3d3;
  padding: 10px 12px;
  border-radius: 14px;
  pointer-events: auto;
}

/* ✅ OJO: NO empujamos el main aquí; en tu layout ya lo traías en 0/5px
   Si más adelante necesitas empuje real, ajustamos con una variable. */
.content main{
  padding-top: 0px !important;
}

/* =========================
   Inline Search Perfiles (sin modal)
   (incluido aquí para no depender de otro archivo)
   ========================= */
.mp-profile-search{
  position: relative;
  width: 100%;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--muni-radius);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 10px 25px rgba(0,0,0,.10);
  pointer-events: auto;
}

.mp-profile-search__icon{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.04);
  flex-shrink:0;
}

.mp-profile-search input{
  flex: 1;
  height: 40px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
}

/* Dropdown resultados perfiles */
.mp-profile-results{
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 99998; /* debajo del autocomplete 99999 */
  border-radius: 16px;
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 14px 30px rgba(0,0,0,.16);
  overflow: hidden;
}

.mp-profile-results__loading,
.mp-profile-results__empty{
  padding: 12px 14px;
  font-size: 14px;
  color: #555;
}

.mp-profile-results__list{
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 45vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.mp-profile-item{
  display:flex;
  gap: 10px;
  align-items:center;
  padding: 10px 12px;
  text-decoration:none;
  color:#111;
}

.mp-profile-item:hover,
.mp-profile-item[aria-selected="true"]{
  background: rgba(0,0,0,.04);
}

.mp-profile-initial{
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(17,112,174,.12);
  color: #0b4f7a;
  font-weight: 900;
  flex-shrink:0;
}

.mp-profile-name{
  font-weight: 800;
  line-height: 1.1;
}

.mp-profile-meta{
  font-size: 12px;
  color:#666;
  line-height: 1.1;
}

/* =========================
   Botón flotante +
   ========================= */
.floating-btn{
  position: fixed;
  bottom: 4.5rem;
  right: 1.5rem;
  width: 3.5rem;
  height: 3.5rem;
  background-color: #1170ae;
  color: #fff;
  font-size: 2rem;
  line-height: 3.5rem;
  text-align: center;
  border-radius: 50%;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.2s;
  z-index: 1000;
}
.floating-btn:hover{ transform: scale(1.1); }

/* =========================
   Facebook share button
   ========================= */
.facebook-share-button{
  position: absolute;
  display: flex;
  padding: 10px;
  margin: 5px;
  border-radius: 5px;
  color: white;
  text-decoration: none;
  font-size: 20px;
  transition: background-color 0.3s;
  background-color: #3b5998;
  right: 5px;
  top: 40px;
  z-index: 1000;
}
.facebook-share-button:hover{ background-color: #334d84; }

/* =========================
   Botón Entrar a municipio (mp-enter-muni)
   ========================= */
.mp-enter-muni{
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .8rem;
  border-radius: 999px;
  text-decoration: none !important;
  border: 1px solid rgba(17,112,174,.25);
  background: rgba(17,112,174,.08);
  color: #0b4f7a;
  font-weight: 700;
  line-height: 1;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
  user-select: none;
}
.mp-enter-muni__label{ font-weight: 600; opacity: .85; }
.mp-enter-muni__muni{
  font-weight: 800;
  white-space: nowrap;
  max-width: min(64vw, 420px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-enter-muni__arrow{
  display:inline-flex;
  width: 28px;
  height: 28px;
  align-items:center;
  justify-content:center;
  border-radius: 999px;
  background: rgba(17,112,174,.16);
  font-weight: 900;
  transform: translateX(0);
  transition: transform .12s ease, background .12s ease;
}
.mp-enter-muni:hover{
  background: rgba(17,112,174,.12);
  border-color: rgba(17,112,174,.35);
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}
.mp-enter-muni:hover .mp-enter-muni__arrow{
  transform: translateX(2px);
  background: rgba(17,112,174,.22);
}
.mp-enter-muni:active{ transform: scale(.98); }
.mp-enter-muni:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(17,112,174,.25);
}

/* =========================
   Mobile tweaks
   ========================= */
@media (max-width: 600px){
  :root{
    --muni-top: calc(env(safe-area-inset-top) + 48px);
  }
  .muni-fab{ padding: 6px 8px; }
  .muni-menu-btn{ width: 52px; height: 52px; }
}
