/* Panel administración — GrupoCasas */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
  font-family: 'Outfit', sans-serif; 
  color: #1d3557; 
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ——— Elementos decorativos de fondo ——— */
.admin-bg-decorative {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.admin-bg-gradient {
  position: absolute;
  inset: 0;
  background: #ffffff;
}

.admin-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.admin-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(75px);
  opacity: 0;
  pointer-events: none;
  animation: none;
}

.admin-orb--1 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(32, 74, 151, 0.12) 0%, transparent 70%);
  top: -8%;
  right: -5%;
  animation-delay: 0s;
}

.admin-orb--2 {
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(32, 74, 151, 0.08) 0%, transparent 70%);
  bottom: -5%;
  left: -5%;
  animation-delay: -5s;
}

.admin-orb--3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(29, 53, 87, 0.06) 0%, transparent 70%);
  top: 40%;
  left: 55%;
  animation-delay: -10s;
}

@keyframes adminOrbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(50px, -35px) scale(1.08); }
  50% { transform: translate(-40px, 30px) scale(0.92); }
  75% { transform: translate(30px, 45px) scale(1.05); }
}

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

@keyframes adminOrbPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.admin-bg-decorative::after {
  display: none;
}

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

.admin-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.admin-line {
  position: absolute;
  background: transparent;
}

.admin-line--1 {
  width: 1px;
  height: 100%;
  left: 20%;
  top: 0;
  animation: adminLineMove 20s ease-in-out infinite;
}

.admin-line--2 {
  width: 1px;
  height: 100%;
  right: 25%;
  top: 0;
  animation: adminLineMove 25s ease-in-out infinite reverse;
}

@keyframes adminLineMove {
  0%, 100% { transform: translateY(0); opacity: 0.3; }
  50% { transform: translateY(-50px); opacity: 0.6; }
}

.admin-grid-bg {
  position: absolute;
  inset: 0;
  background: transparent;
}

.admin-panel { 
  padding: 3rem 2rem; 
  max-width: 900px; 
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
/* Forzar menú oculto hasta autenticación explícita (evita sesión restaurada) */
#admin-menu { display: none !important; }
#admin-menu.admin-authenticated { display: block !important; }
#admin-login.admin-hidden { display: none !important; }

/* Forzar visibilidad: login visible por defecto, menú oculto hasta autenticación */
#admin-login { display: block !important; }
#admin-menu { display: none !important; }
#admin-menu.admin-authenticated { display: block !important; }
#admin-login.admin-authenticated { display: none !important; }

/* Forzar visibilidad: login visible por defecto, menú oculto hasta autenticación */
#admin-login { display: block !important; }
#admin-menu { display: none !important; }
#admin-menu.admin-authenticated { display: block !important; }
#admin-login.admin-hidden { display: none !important; }

/* Forzar visibilidad: login visible por defecto, menú oculto hasta autenticación */
#admin-login { display: block !important; }
#admin-menu { display: none !important; }
#admin-menu.admin-authenticated { display: block !important; }
#admin-login.admin-hidden { display: none !important; }

/* Forzar: menú/app/anuncios ocultos hasta autenticación; login visible por defecto */
#admin-menu, #admin-app, #admin-anuncios { display: none !important; }
#admin-menu.is-authenticated, #admin-app.is-visible, #admin-anuncios.is-visible { display: block !important; }
#admin-login { display: block !important; }
#admin-login.is-hidden { display: none !important; }

/* Forzar que el menú esté oculto hasta autenticación; login visible por defecto */
#admin-menu { display: none !important; }
#admin-menu.is-authenticated { display: block !important; }
#admin-login { display: block; }
#admin-login[hidden] { display: none !important; }

/* Forzar: login visible y menú oculto por defecto; menú solo visible tras autenticación */
#admin-login { display: block !important; }
#admin-menu { display: none !important; }
#admin-menu.admin-authenticated { display: block !important; }
#admin-login.admin-authenticated { display: none !important; }

.admin-login-box {
  background: #fff;
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  text-align: center;
}
.admin-login-box h1 { font-size: 1.5rem; margin-bottom: 0.5rem; color: #1d3557; }
.admin-login-box p { color: #666; margin-bottom: 1.5rem; }
.admin-login-box input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 1rem;
}
.admin-login-box button {
  width: 100%;
  padding: 0.9rem;
  background: #204A97;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  min-height: 48px;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.2);
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.admin-login-box button:hover { background: #1a3d7a; }
.admin-login-box button:active { transform: scale(0.98); background: #152a4d; }
.admin-login-field { text-align: left; margin-bottom: 1rem; }
.admin-login-field label { display: block; font-size: 0.9rem; font-weight: 600; color: #1d3557; margin-bottom: 0.35rem; }
.admin-login-error { color: #c53030; font-size: 0.95rem; margin: 0.75rem 0 1rem; min-height: 1.2em; padding: 0.6rem 0.75rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; font-weight: 500; }
.admin-login-error[hidden] { display: none !important; }
.admin-login-back { display: inline-block; margin-top: 1.5rem; color: #204A97; font-size: 0.9rem; text-decoration: none; }
.admin-login-back:hover { text-decoration: underline; }
.admin-login-warning {
  font-size: 0.85rem;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1.25rem;
  font-weight: 500;
}
.admin-hint { font-size: 0.8rem; color: #999; margin-top: 1rem; }

.admin-header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid rgba(32, 74, 151, 0.15);
}

.admin-header-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.admin-title-main {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  background: linear-gradient(135deg, #1d3557 0%, #204A97 50%, #1d3557 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: adminTitleShimmer 6s ease-in-out infinite;
  margin: 0;
  flex: 1;
  min-width: 200px;
}

@keyframes adminTitleShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-header-actions--spaced {
  gap: 2rem;
  margin-top: 0.5rem;
}

/* En "Editar anuncios": Menú como botón principal, Volver al sitio como enlace secundario */
.admin-header-actions--spaced .admin-back {
  background: transparent;
  border: none;
  padding: 0.5rem 0;
  font-weight: 500;
  color: #5a7aa8;
}

.admin-header-actions--spaced .admin-back:hover {
  background: transparent;
  border: none;
  box-shadow: none;
  transform: none;
  color: #204A97;
  text-decoration: underline;
}

.admin-header-actions--spaced .admin-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(32, 74, 151, 0.2);
  border-radius: 12px;
  color: #204A97;
  text-decoration: none;
  transition: all 0.25s ease;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.2);
}

.admin-header-actions--spaced .admin-back-btn:hover {
  background: #fff;
  border-color: rgba(32, 74, 151, 0.4);
  text-decoration: none;
  transform: translateX(-4px);
  box-shadow: 0 4px 12px rgba(32, 74, 151, 0.15);
}

.admin-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #204A97;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.6rem 1.25rem;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(32, 74, 151, 0.2);
  border-radius: 12px;
  transition: all 0.25s ease;
  min-height: 44px; /* Tamaño mínimo táctil */
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.2);
  touch-action: manipulation;
}

.admin-back:hover {
  background: #fff;
  border-color: rgba(32, 74, 151, 0.4);
  transform: translateX(-4px);
  box-shadow: 0 4px 12px rgba(32, 74, 151, 0.15);
}

.admin-back svg {
  transition: transform 0.25s ease;
}

.admin-back:hover svg {
  transform: translateX(-2px);
}

.admin-back-btn {
  color: #204A97;
  text-decoration: none;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
}

.admin-back-btn:hover {
  text-decoration: underline;
}

.admin-logout {
  padding: 0.6rem 1.25rem;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(29, 53, 87, 0.2);
  border-radius: 12px;
  color: #1d3557;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.25s ease;
  min-height: 44px; /* Tamaño mínimo táctil */
  -webkit-tap-highlight-color: rgba(29, 53, 87, 0.2);
  touch-action: manipulation;
}

.admin-logout:hover {
  background: #fff;
  border-color: rgba(29, 53, 87, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(29, 53, 87, 0.15);
}

.admin-menu-main {
  text-align: center;
  padding: 2rem 0;
  position: relative;
}

.admin-menu-content {
  position: relative;
  z-index: 1;
}

.admin-menu-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(32, 74, 151, 0.25);
  color: #204A97;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 999px;
  margin-bottom: 2rem;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 12px rgba(29, 53, 87, 0.08);
}

.admin-badge-dot {
  width: 7px;
  height: 7px;
  background: #204A97;
  border-radius: 50%;
  animation: adminPulse 2s ease-in-out infinite;
}

@keyframes adminPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.admin-menu-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 700;
  color: #1d3557;
  margin-bottom: 0.75rem;
  line-height: 1.2;
  position: relative;
}

.admin-menu-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  margin: 1rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #204A97, #24324f);
  animation: adminLineGlow 3s ease infinite alternate;
}

@keyframes adminLineGlow {
  0% { width: 40px; opacity: 0.6; }
  100% { width: 80px; opacity: 1; }
}

.admin-menu-subtitle {
  font-size: 1.05rem;
  color: rgba(29, 53, 87, 0.7);
  margin-bottom: 3rem;
  font-weight: 400;
}

.admin-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 380px;
  margin: 0 auto;
}

.admin-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem 2rem;
  font-size: 1.15rem;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(32, 74, 151, 0.25);
  min-height: 56px;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.2);
  touch-action: manipulation;
}

.admin-menu-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.admin-menu-btn:hover::before {
  opacity: 1;
}

.admin-menu-btn svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.admin-menu-btn--naranja {
  background: linear-gradient(135deg, #204A97 0%, #2a5bb8 50%, #204A97 100%);
  background-size: 200% 100%;
  color: #fff;
  box-shadow: 0 8px 32px rgba(32, 74, 151, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  animation: adminButtonShimmer 4s ease-in-out infinite;
}

@keyframes adminButtonShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.admin-menu-btn--naranja:hover {
  background: linear-gradient(135deg, #1a3d7a 0%, #204A97 50%, #1a3d7a 100%);
  background-size: 200% 100%;
  box-shadow: 0 12px 40px rgba(32, 74, 151, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  transform: translateY(-4px);
}

.admin-menu-btn--naranja:hover svg {
  transform: scale(1.1) rotate(5deg);
}

.admin-menu-btn--naranja:active {
  transform: translateY(-2px) scale(0.98);
  box-shadow: 0 6px 20px rgba(32, 74, 151, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.admin-menu-btn--azul {
  background: linear-gradient(135deg, #1e4d6b 0%, #2a6b8f 50%, #1e4d6b 100%);
  background-size: 200% 100%;
  color: #fff;
  box-shadow: 0 8px 32px rgba(30, 77, 107, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.admin-menu-btn--azul:hover {
  background: linear-gradient(135deg, #183d52 0%, #1e4d6b 50%, #183d52 100%);
  background-size: 200% 100%;
  box-shadow: 0 12px 40px rgba(30, 77, 107, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  transform: translateY(-4px);
}

.admin-menu-btn--azul:hover svg {
  transform: scale(1.1) rotate(5deg);
}

.admin-menu-btn--azul:active {
  transform: translateY(-2px) scale(0.98);
}

.admin-menu-btn--verde {
  background: linear-gradient(135deg, #0d6b3a 0%, #128c4a 50%, #0d6b3a 100%);
  background-size: 200% 100%;
  color: #fff;
  box-shadow: 0 8px 32px rgba(13, 107, 58, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.admin-menu-btn--verde:hover {
  background: linear-gradient(135deg, #0a552e 0%, #0d6b3a 50%, #0a552e 100%);
  background-size: 200% 100%;
  box-shadow: 0 12px 40px rgba(13, 107, 58, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  transform: translateY(-4px);
}

.admin-menu-btn--verde:hover svg {
  transform: scale(1.1) rotate(5deg);
}

.admin-menu-btn--verde:active {
  transform: translateY(-2px) scale(0.98);
}

.admin-menu-btn span {
  position: relative;
  z-index: 1;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-actions--solo-count {
  margin-bottom: 1rem;
}
.btn-admin {
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.2);
  touch-action: manipulation;
}
.btn-primary { background: #204A97; color: #fff; }
.btn-primary:hover { background: #1a3d7a; }
.btn-primary:active { background: #152a4d; transform: scale(0.98); }
.admin-count { color: #666; font-size: 0.9rem; }

.admin-list { display: flex; flex-direction: column; gap: 1rem; }
.admin-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.admin-card-img {
  width: 100px;
  height: 70px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.admin-card-body { flex: 1; min-width: 0; }
.admin-card-nombre { font-weight: 600; font-size: 1.05rem; margin-bottom: 0.25rem; }
.admin-card-meta { font-size: 0.85rem; color: #666; margin-bottom: 0.5rem; }
.admin-card-badge { display: inline-block; background: #204A97; color: #fff; font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: 4px; margin-right: 0.5rem; }
.admin-card-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.admin-card-actions button {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #ddd;
  background: #fff;
  color: #1d3557;
  min-height: 44px; /* Tamaño mínimo táctil */
  min-width: 44px;
  -webkit-tap-highlight-color: rgba(29, 53, 87, 0.1);
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.admin-card-actions button:hover { background: #f5f5f5; }
.admin-card-actions button:active { transform: scale(0.95); }
.admin-card-actions .btn-delete { color: #c00; border-color: #fcc; }
.admin-card-actions .btn-delete:hover { background: #fff5f5; }
.admin-card-actions .btn-delete:active { background: #ffe5e5; }

.admin-anuncio-actions { flex-wrap: wrap; align-items: center; gap: 0.75rem; }

.admin-anuncio-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 90px;
  flex-shrink: 0;
  color: #8a9bb5;
  font-size: 1rem;
  letter-spacing: -0.2em;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}
.admin-anuncio-drag-handle:hover {
  color: #204A97;
  background: rgba(32, 74, 151, 0.06);
}
.admin-anuncio-drag-handle:active {
  cursor: grabbing;
}

.admin-anuncio-item {
  transition: box-shadow 0.2s ease, opacity 0.2s ease;
}
.admin-anuncio-item.admin-anuncio-dragging {
  opacity: 0.6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.admin-anuncio-item.admin-anuncio-drag-over {
  box-shadow: 0 0 0 2px #204A97;
  border-radius: 12px;
}

.admin-anuncio-item .admin-anuncio-thumb {
  width: 160px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  pointer-events: none;
}
.admin-anuncios-list .admin-card { display: flex; align-items: center; gap: 1rem; }

.admin-anuncios-guardar-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(32, 74, 151, 0.15);
}

.admin-btn-guardar-anuncios {
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.admin-anuncios-guardar-msg {
  font-size: 0.9rem;
  color: #1d3557;
  font-weight: 500;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem 4rem;
  overflow-y: auto;
}
.admin-modal[hidden] {
  display: none !important;
}
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 0;
}
.admin-modal-box {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
}
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #eee;
}
.admin-modal-header h2 { font-size: 1.2rem; }
.admin-modal-close {
  width: 44px;
  height: 44px;
  border: none;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.admin-modal-close:hover { background: #eee; }
.admin-modal-close:active { transform: scale(0.9); background: #ddd; }

.admin-form { padding: 1.5rem; }
.form-section { margin-bottom: 1.5rem; }
.form-section h3 { font-size: 0.95rem; color: #204A97; margin-bottom: 0.75rem; }

.form-section-foto { margin-bottom: 1.5rem; }
.form-foto-box { margin-bottom: 1rem; }
.form-foto-preview {
  width: 100%;
  min-height: 180px;
  background: #f0f0f0;
  border: 2px dashed #ccc;
  border-radius: 12px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.form-foto-preview img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
}
.form-foto-placeholder {
  color: #999;
  font-size: 0.9rem;
  padding: 1rem;
  text-align: center;
}
.form-foto-box label { display: block; font-weight: 500; font-size: 0.9rem; margin-bottom: 0.35rem; }
.form-foto-box input { margin-top: 0; }
.form-row { margin-bottom: 1rem; }
.form-row label { display: block; font-weight: 500; font-size: 0.9rem; margin-bottom: 0.35rem; }
.form-row input, .form-row select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
.form-row-double { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-check { display: flex; align-items: center; gap: 0.5rem; }
.form-row-check input { width: auto; }
.form-hint { font-size: 0.8rem; color: #999; margin-top: 0.5rem; }
.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}
.btn-secondary {
  padding: 0.75rem 1.5rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  color: #1d3557;
  cursor: pointer;
  min-height: 44px;
  font-weight: 600;
  font-size: 0.95rem;
  -webkit-tap-highlight-color: rgba(29, 53, 87, 0.1);
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.btn-secondary:hover { background: #f9f9f9; }
.btn-secondary:active { transform: scale(0.98); background: #f0f0f0; }
.form-actions .btn-primary { 
  padding: 0.75rem 1.75rem;
  min-height: 44px;
  font-size: 0.95rem;
}
.form-actions .btn-primary:active { transform: scale(0.98); }

/* ——— Modal editar con estructura de cliente ——— */
.admin-modal--vivienda .admin-modal-box--vivienda {
  max-width: 1100px;
  width: 100%;
  max-height: 92vh;
  background: linear-gradient(165deg, #ffffff 0%, #f8fafd 50%, #f0f4fa 100%);
  border: 1px solid rgba(32, 74, 151, 0.15);
  border-radius: 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-form--vivienda {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.admin-form-body--grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  align-items: start;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem 1.25rem 1rem;
}

.admin-form-footer {
  flex-shrink: 0;
  margin: 0;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.98);
  border-top: 2px solid rgba(32, 74, 151, 0.15);
  box-shadow: 0 -4px 20px rgba(32, 74, 151, 0.08);
}

.admin-form-section {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(32, 74, 151, 0.12);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
}

.admin-form-section:last-child {
  margin-bottom: 0;
}

.admin-form-section .mv-section-title {
  margin-top: 0;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(32, 74, 151, 0.12);
  font-size: 1.05rem;
}

.admin-form-col-media,
.admin-form-col-datos {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.admin-form-col-media .admin-fotos-gallery,
.admin-form-col-media .admin-videos-gallery {
  margin-bottom: 0.5rem;
}

.admin-form-section--fotos .admin-galeria-hint,
.admin-form-section--videos .admin-galeria-hint {
  margin-bottom: 0.75rem;
}

.admin-caracteristicas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.5rem;
}

.admin-caracteristicas-grid .admin-carac-row {
  border-bottom: none;
  padding: 0.35rem 0;
}

.admin-caracteristicas-grid .admin-carac-row span {
  min-width: 100px;
}

.mv-precio-block-wrap .mv-precio-block {
  margin-bottom: 0.75rem;
}

.mv-precio-block-wrap .admin-input-inline {
  margin-bottom: 0;
  margin-top: 0.75rem;
  display: block;
}

.admin-modal-close--vivienda {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(32,74,151,0.2);
  border-radius: 12px;
  color: #1d3557;
  cursor: pointer;
}

/* ——— Modal vista previa anuncio (recortar/mover) ——— */
/* Mismo ancho máximo que el carrusel en index (1400px) para representación exacta */
.admin-modal--anuncio-preview .admin-modal-box--anuncio-preview {
  max-width: min(1480px, calc(100vw - 2rem));
  width: 100%;
  padding: 1.5rem;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(32, 74, 151, 0.15);
}

.admin-modal-close--anuncio-preview {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(32,74,151,0.2);
  border-radius: 12px;
  color: #1d3557;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-modal-close--anuncio-preview:hover {
  background: #fff;
  border-color: rgba(32,74,151,0.35);
}

.admin-anuncio-preview-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  color: #1d3557;
}

.admin-anuncio-preview-hint {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: #666;
}

/* Recuadro: mismo tamaño que ocupa el anuncio en la página inicial (carrusel 1400×580) */
.anuncio-preview-exact-wrap {
  margin: 0 auto 1.25rem;
  max-width: 1400px;
  width: 100%;
}

.anuncio-preview-exact-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #204A97;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.anuncio-preview-frame {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 1400px;
  /* Proporción exacta del carrusel escritorio: ancho × (580/1400) */
  aspect-ratio: 1400 / 580;
  overflow: hidden;
  background: #1a2744;
  border: 3px solid rgba(32, 74, 151, 0.5);
  border-radius: 8px;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Proporción móvil: 9:16 (vertical, pantalla de celular) */
.anuncio-preview-frame.anuncio-preview-frame--mobile {
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  aspect-ratio: 9 / 16;
}

.anuncio-preview-frame-caption {
  display: block;
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.4rem;
  text-align: center;
}

.anuncio-preview-img {
  position: absolute;
  display: block;
  pointer-events: none;
  will-change: transform;
  top: 0;
  left: 0;
}

/* Sección Recortar imagen */
.admin-anuncio-preview-recortar {
  background: rgba(32, 74, 151, 0.06);
  border: 1px solid rgba(32, 74, 151, 0.15);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.admin-anuncio-recortar-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #1d3557;
  margin-bottom: 0.35rem;
}

.admin-anuncio-recortar-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.4;
}

.admin-anuncio-preview-zoom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0;
}

.admin-anuncio-zoom-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid rgba(32, 74, 151, 0.25);
  background: #fff;
  color: #204A97;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-anuncio-zoom-btn:hover {
  background: rgba(32, 74, 151, 0.08);
  border-color: rgba(32, 74, 151, 0.4);
}

.admin-anuncio-zoom-label {
  min-width: 4rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1d3557;
}

.admin-anuncio-preview-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Móvil: modal más cómodo, botones siempre visibles abajo */
@media (max-width: 768px) {
  .admin-modal--anuncio-preview {
    align-items: stretch;
    padding: 0;
  }
  .admin-modal--anuncio-preview .admin-modal-box--anuncio-preview {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    height: 100%;
    border-radius: 0;
    padding: max(env(safe-area-inset-top), 0.5rem) 1rem 0 1rem;
    overflow: hidden;
  }
  .admin-modal--anuncio-preview .admin-anuncio-preview-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .admin-anuncio-preview-title {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
  }
  .admin-anuncio-preview-hint {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
  }
  .anuncio-preview-exact-wrap {
    margin-bottom: 1rem;
  }
  .anuncio-preview-frame.anuncio-preview-frame--mobile {
    max-height: min(48vh, 400px);
    width: auto;
    max-width: 90vw;
    aspect-ratio: 9 / 16;
    margin-left: auto;
    margin-right: auto;
  }
  .admin-anuncio-preview-recortar {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
  }
  .admin-anuncio-recortar-hint {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
  }
  .admin-anuncio-preview-actions {
    flex-shrink: 0;
    padding: 1rem 0 max(max(env(safe-area-inset-bottom), 1rem), 1rem);
    margin: 0 -1rem 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    background: #fff;
    border-top: 1px solid rgba(32, 74, 151, 0.12);
    gap: 0.75rem;
  }
  .admin-anuncio-preview-actions .admin-btn-secondary,
  .admin-anuncio-preview-actions .btn-admin {
    flex: 1;
    min-width: 0;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    min-height: 48px;
  }
}

.admin-btn-secondary {
  padding: 0.65rem 1.5rem;
  border-radius: 12px;
  border: 2px solid rgba(32, 74, 151, 0.25);
  background: #fff;
  color: #204A97;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-btn-secondary:hover {
  background: rgba(32, 74, 151, 0.08);
  border-color: rgba(32, 74, 151, 0.4);
}

.admin-form--vivienda { padding: 0; }
.admin-form-body { padding: 1.25rem 1.25rem 2rem; }
.admin-galeria-editable .mv-galeria-main { min-height: 280px; }
.admin-foto-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 0.9rem;
}
.admin-input-inline, .admin-nombre-input, .admin-precio-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(32, 74, 151, 0.25);
  border-radius: 8px;
  font-size: inherit;
  background: rgba(255,255,255,0.95);
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
.admin-nombre-input { font-size: 1.2rem; font-weight: 700; }
.admin-precio-input { font-size: 1.5rem; font-weight: 800; }
.admin-precio-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.admin-precio-moneda {
  min-width: 90px;
  text-align: center;
}

.admin-badge-select {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  border: 1px solid rgba(32, 74, 151, 0.3);
  background: rgba(32, 74, 151, 0.08);
  color: #1d3557;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

.admin-estado-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

#prop-estado {
  margin-bottom: 0;
}

#prop-tipo-oferta {
  min-width: 180px;
}
.admin-textarea-desc, .admin-textarea-comod {
  width: 100%;
  padding: 0.85rem;
  border: 1px solid rgba(32, 74, 151, 0.2);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: rgba(255,255,255,0.95);
  resize: vertical;
  min-height: 120px;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

/* ——— Comodidades (agregar desde lista) ——— */
.admin-comodidades-hint { font-size: 0.85rem; color: rgba(29,53,87,0.8); margin-bottom: 0.75rem; }
.admin-comodidades-add {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.admin-comodidad-buscar-container {
  position: relative;
  flex: 0 1 auto;
  width: 100%;
  max-width: 220px;
  min-width: 0;
}
.admin-comodidad-sugerencias {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(32, 74, 151, 0.25);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 100;
  padding: 4px 0;
}
.admin-comodidad-sugerencia-item {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  border: none;
  background: none;
  text-align: left;
  font-size: 0.95rem;
  color: #1d3557;
  cursor: pointer;
  transition: background 0.15s ease;
}
.admin-comodidad-sugerencia-item:hover,
.admin-comodidad-sugerencia-item:focus {
  background: rgba(32, 74, 151, 0.08);
  outline: none;
}
.admin-comodidad-buscar-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
  border: 1px solid rgba(32, 74, 151, 0.25);
  border-radius: 8px;
  background: rgba(255,255,255,0.95);
  min-height: 44px;
}
.admin-comodidad-buscar-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(29, 53, 87, 0.5);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-comodidad-buscar {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  background: transparent;
  min-height: 44px;
}
.admin-comodidad-buscar::placeholder { color: rgba(29, 53, 87, 0.5); }
.admin-comodidad-buscar:focus { outline: none; }
.admin-comodidad-buscar-wrap:focus-within {
  border-color: rgba(32, 74, 151, 0.5);
  box-shadow: 0 0 0 2px rgba(32, 74, 151, 0.1);
}
.admin-select-comodidad {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(32, 74, 151, 0.25);
  border-radius: 8px;
  font-size: 1rem;
  background: rgba(255,255,255,0.95);
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
.admin-btn-agregar-comod {
  padding: 0.65rem 1.25rem;
  background: rgba(32, 74, 151, 0.12);
  border: 1px solid rgba(32, 74, 151, 0.4);
  border-radius: 8px;
  color: #204A97;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.2);
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.admin-btn-agregar-comod:hover { background: rgba(32, 74, 151, 0.2); }
.admin-btn-agregar-comod:active { transform: scale(0.95); background: rgba(32, 74, 151, 0.25); }
.admin-comodidades-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 2rem;
}
.admin-comodidad-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.5rem;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(32, 74, 151, 0.3);
  border-radius: 8px;
  font-size: 0.85rem;
  color: #1d3557;
}
.admin-comodidad-chip-remove {
  padding: 0 0.2rem;
  margin: 0;
  border: none;
  background: none;
  color: #999;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
}
.admin-comodidad-chip-remove:hover { color: #c00; background: rgba(200,0,0,0.08); }
.admin-comodidades-empty { font-size: 0.88rem; color: #999; margin: 0; }

.admin-caracteristicas-edit { display: flex; flex-direction: column; gap: 0.5rem; }
.admin-carac-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(32, 74, 151, 0.12);
}
.admin-carac-row span { min-width: 110px; font-weight: 600; }
.admin-carac-row input {
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(32, 74, 151, 0.25);
  border-radius: 8px;
  width: 100px;
  min-height: 44px;
  font-size: 0.95rem;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
.admin-detalle-edit .admin-input-detalle, .admin-detalle-edit .admin-select-detalle {
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(32, 74, 151, 0.2);
  border-radius: 8px;
  min-width: 140px;
  min-height: 44px;
  font-size: 0.95rem;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
.admin-select-comuna { min-width: 180px; max-height: 200px; }
.admin-unidades-edit input { 
  width: 80px; 
  padding: 0.65rem 0.5rem; 
  margin-right: 0.5rem;
  min-height: 44px;
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
.admin-map-coords {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.admin-map-coords input {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(32, 74, 151, 0.2);
  border-radius: 6px;
  font-size: 0.85rem;
}
.admin-form-actions-vivienda {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.admin-form-footer.admin-form-actions-vivienda {
  margin-top: 0;
  padding-top: 1rem;
}

.admin-guardado-ok-msg {
  display: none;
  font-size: 0.95rem;
  color: #0d8050;
  font-weight: 600;
  margin-right: auto;
}

.admin-guardado-ok-msg--visible {
  display: inline-block;
}

/* Propiedad destacada: bloque y checkbox */
.admin-form-extra {
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(32, 74, 151, 0.2);
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
}

.admin-destacada-label {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  color: #1d3557;
  font-size: 1rem;
  user-select: none;
}

.admin-destacada-check {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: #204A97;
  cursor: pointer;
  flex-shrink: 0;
}

.admin-destacada-text {
  letter-spacing: 0.01em;
}

/* Botones Cancelar y Guardar del formulario vivienda */
.admin-btn-cancelar {
  padding: 0.75rem 1.75rem;
  min-height: 46px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid rgba(32, 74, 151, 0.35);
  background: #fff;
  color: #204A97;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.15);
  touch-action: manipulation;
  outline: none;
}

.admin-btn-cancelar:hover {
  background: rgba(32, 74, 151, 0.06);
  border-color: rgba(32, 74, 151, 0.5);
  color: #1a3d7a;
}

.admin-btn-cancelar:active {
  transform: scale(0.98);
  background: rgba(32, 74, 151, 0.1);
}

.admin-btn-guardar {
  padding: 0.75rem 1.75rem;
  min-height: 46px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  background: linear-gradient(180deg, #204A97 0%, #1a3d7a 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(32, 74, 151, 0.35);
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline: none;
}

.admin-btn-guardar:hover {
  background: linear-gradient(180deg, #1a3d7a 0%, #152a5c 100%);
  box-shadow: 0 6px 18px rgba(32, 74, 151, 0.4);
  transform: translateY(-1px);
}

.admin-btn-guardar:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 10px rgba(32, 74, 151, 0.3);
}

.admin-zona-edit { padding: 1rem 1.25rem; border-top: 1px solid rgba(32, 74, 151, 0.15); }

/* Pestañas Transporte / Educación / Comercio — estilo moderno y más grandes */
.admin-zona-edit .mv-zona-tabs,
.mv-zona-section .mv-zona-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0 1rem;
  border-bottom: none;
}

.admin-zona-edit .mv-zona-tab,
.mv-zona-section .mv-zona-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  min-height: 48px;
  border: 2px solid rgba(32, 74, 151, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: #5a7aa8;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.15);
  touch-action: manipulation;
}

.admin-zona-edit .mv-zona-tab:hover,
.mv-zona-section .mv-zona-tab:hover {
  background: rgba(32, 74, 151, 0.06);
  border-color: rgba(32, 74, 151, 0.35);
  color: #204A97;
}

.admin-zona-edit .mv-zona-tab.is-active,
.mv-zona-section .mv-zona-tab.is-active {
  background: linear-gradient(180deg, rgba(32, 74, 151, 0.14) 0%, rgba(32, 74, 151, 0.08) 100%);
  border-color: #204A97;
  color: #204A97;
  box-shadow: 0 2px 12px rgba(32, 74, 151, 0.2);
}

.admin-zona-edit .mv-zona-tab.is-active::after,
.mv-zona-section .mv-zona-tab.is-active::after {
  display: none;
}

.admin-zona-edit .mv-zona-tab svg,
.mv-zona-section .mv-zona-tab svg {
  flex-shrink: 0;
  color: inherit;
  width: 20px;
  height: 20px;
}

.admin-zona-edit .mv-zona-intro { font-size: 0.82rem; color: rgba(29,53,87,0.8); margin-bottom: 0.75rem; }
.admin-zona-edit .mv-zona-intro-note,
.mv-zona-section .mv-zona-intro-note { display: block; font-size: 0.75rem; color: rgba(29,53,87,0.6); margin-top: 0.35rem; font-style: italic; }

.admin-zona-detectados-wrap { margin-bottom: 1rem; }
.admin-btn-detectar-zona {
  padding: 0.65rem 1.25rem;
  background: rgba(32, 74, 151, 0.15);
  border: 1px solid rgba(32, 74, 151, 0.4);
  border-radius: 8px;
  color: #204A97;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.2);
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.admin-btn-detectar-zona:hover:not(:disabled) { background: rgba(32, 74, 151, 0.25); }
.admin-btn-detectar-zona:active:not(:disabled) { transform: scale(0.95); background: rgba(32, 74, 151, 0.3); }
.admin-btn-detectar-zona:disabled { opacity: 0.7; cursor: wait; }
.admin-zona-detectados-hint { font-size: 0.8rem; color: rgba(29,53,87,0.7); margin: 0.35rem 0 0.5rem 0; }
.admin-zona-detectados { margin-top: 0.5rem; max-height: 220px; overflow-y: auto; }
.admin-zona-detectados-loading, .admin-zona-detectados-empty, .admin-zona-detectados-error { font-size: 0.88rem; color: #666; margin: 0; padding: 0.5rem 0; }
.admin-zona-cat { margin-bottom: 0.75rem; }
.admin-zona-cat strong { font-size: 0.85rem; color: #1d3557; display: block; margin-bottom: 0.25rem; }
.admin-zona-det-list { list-style: none; margin: 0; padding: 0; }
.admin-zona-det-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; padding: 0.25rem 0; font-size: 0.85rem; }
.admin-zona-det-nombre { flex: 1; min-width: 0; }
.admin-zona-det-dist { color: #666; font-size: 0.8rem; }
.admin-zona-det-add {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  background: rgba(32, 74, 151, 0.12);
  border: 1px solid rgba(32, 74, 151, 0.35);
  border-radius: 4px;
  color: #204A97;
  cursor: pointer;
  font-weight: 600;
}
.admin-zona-det-add:hover { background: rgba(32, 74, 151, 0.2); }
.admin-textarea-zona {
  width: 100%;
  padding: 0.85rem;
  border: 1px solid rgba(32, 74, 151, 0.2);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}
.admin-mapa-wrap .admin-mapa-hint,
.mv-detalle-section--con-mapa .admin-mapa-hint { font-size: 0.85rem; color: rgba(29,53,87,0.8); margin-bottom: 0.5rem; margin-top: 0.75rem; }
.admin-mapa-interactivo { cursor: crosshair; }
.admin-map-coords label { font-size: 0.8rem; margin-right: 0.25rem; }

/* Separación entre campos (Comuna, Dirección, Nº, Tipo) */
.admin-detalle-edit .mv-detalle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.admin-detalle-edit .mv-detalle-row:last-child {
  margin-bottom: 0;
}
.admin-detalle-edit .mv-detalle-label {
  min-width: 120px;
  font-weight: 600;
  color: #1d3557;
  font-size: 0.95rem;
}
.admin-detalle-edit .admin-input-detalle,
.admin-detalle-edit .admin-select-detalle {
  flex: 1;
  min-width: 140px;
}

/* Contenedor del mapa: altura fija para que Leaflet se dibuje (admin no carga styles.css) */
#admin-mapa-mini.mv-mapa-mini,
.mv-detalle-section--con-mapa .mv-mapa-mini.admin-mapa-interactivo {
  width: 100%;
  height: 280px;
  min-height: 280px;
  margin-top: 0.75rem;
  margin-bottom: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(32, 74, 151, 0.25);
  background: #e8eef5;
  z-index: 1;
}
.mv-detalle-section--con-mapa .mv-mapa-mini .leaflet-control-attribution {
  display: none;
}

.mv-detalle-section--con-mapa .admin-mapa-hint { margin-top: 0.75rem; margin-bottom: 0.5rem; }
.admin-mapa-btn-wrap { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.admin-btn-google-maps {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  background: rgba(32, 74, 151, 0.12);
  border: 1px solid rgba(32, 74, 151, 0.4);
  border-radius: 8px;
  color: #204A97;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.2);
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.admin-btn-google-maps:hover { background: rgba(32, 74, 151, 0.2); }
.admin-btn-google-maps:active { transform: scale(0.95); background: rgba(32, 74, 151, 0.25); }
.mv-detalle-row--direccion { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.mv-detalle-row--direccion .admin-input-direccion { flex: 1; min-width: 140px; }
.admin-btn-geocode {
  padding: 0.65rem 1.25rem;
  background: rgba(32, 74, 151, 0.12);
  border: 1px solid rgba(32, 74, 151, 0.4);
  border-radius: 8px;
  color: #204A97;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.2);
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.admin-btn-geocode:hover:not(:disabled) { background: rgba(32, 74, 151, 0.2); }
.admin-btn-geocode:active:not(:disabled) { transform: scale(0.95); background: rgba(32, 74, 151, 0.25); }
.admin-btn-geocode:disabled { opacity: 0.7; cursor: wait; }

/* ——— Galería de fotos editable ——— */
.admin-galeria-hint { font-size: 0.88rem; color: rgba(29,53,87,0.8); margin-bottom: 1rem; }
.admin-fotos-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.admin-videos-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.admin-foto-thumb {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 10px;
  overflow: hidden;
  background: #f0f0f0;
  border: 2px solid rgba(32, 74, 151, 0.25);
}
.admin-video-thumb {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: 10px;
  overflow: hidden;
  background: #f0f0f0;
  border: 2px solid rgba(32, 74, 151, 0.25);
}
.admin-foto-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.admin-video-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.admin-foto-thumb-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.2s;
}
.admin-foto-thumb:hover .admin-foto-thumb-actions { opacity: 1; }
.admin-video-thumb:hover .admin-foto-thumb-actions { opacity: 1; }
.admin-foto-thumb-btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.85rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.admin-foto-thumb-btn--edit { background: #204A97; color: #fff; }
.admin-foto-thumb-btn--edit:hover { background: #2a5bb8; }
.admin-foto-thumb-btn--edit:active { transform: scale(0.95); background: #1a3d7a; }
.admin-foto-thumb-btn--del { background: #c00; color: #fff; }
.admin-foto-thumb-btn--del:hover { background: #e00; }
.admin-foto-thumb-btn--del:active { transform: scale(0.95); background: #a00; }
.admin-foto-thumb-num {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.admin-foto-opciones { display: flex; flex-direction: column; gap: 0.75rem; }
.admin-foto-url-row label { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 0.35rem; }
.admin-foto-o { font-size: 0.85rem; color: #999; margin: 0.25rem 0; text-align: center; }
.admin-btn-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(32, 74, 151, 0.08);
  border: 2px dashed rgba(32, 74, 151, 0.4);
  border-radius: 10px;
  color: #204A97;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  width: 100%;
  -webkit-tap-highlight-color: rgba(32, 74, 151, 0.2);
  touch-action: manipulation;
}
.admin-btn-upload:hover {
  background: rgba(32, 74, 151, 0.12);
  border-color: #204A97;
}
.admin-btn-upload:active {
  transform: scale(0.98);
  background: rgba(32, 74, 151, 0.15);
}
.admin-foto-nombre { font-size: 0.82rem; color: #666; margin-left: 0.5rem; }

/* Ocultar "Añadir anuncio (móvil)" en el panel Editar anuncios (móvil) - añadir desde el menú principal */
#admin-anuncios-mobile .admin-anuncios-add-wrap {
  display: none;
}

@media (max-width: 800px) {
  .admin-form-body .modal-vivienda-body,
  .admin-form-body--grid { grid-template-columns: 1fr; }
  .admin-caracteristicas-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .admin-header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .admin-menu-buttons {
    max-width: 100%;
    gap: 1.25rem;
  }

  .admin-menu-btn {
    padding: 1.1rem 1.75rem;
    font-size: 1.05rem;
    min-height: 56px;
  }

  .admin-card-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }

  .admin-card-actions button {
    width: 100%;
    justify-content: center;
  }

  .admin-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .btn-admin {
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
  }

  .admin-mapa-btn-wrap {
    flex-direction: column;
  }

  .admin-btn-geocode,
  .admin-btn-google-maps {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .admin-panel {
    padding: 2rem 1rem;
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px) + 2rem);
  }

  .form-row-double { grid-template-columns: 1fr; }
  .admin-card { flex-direction: column; }
  .admin-card-img { width: 100%; height: 140px; }
  
  .admin-header-actions {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }

  .admin-back,
  .admin-logout {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    min-height: 48px;
  }

  .admin-menu-buttons {
    flex-direction: column;
    width: 100%;
    gap: 1rem;
  }

  .admin-menu-btn {
    width: 100%;
    padding: 1.15rem 1.5rem;
    font-size: 1rem;
    min-height: 56px;
    justify-content: center;
    gap: 0.75rem;
  }

  .admin-menu-title {
    font-size: 2rem;
  }

  .admin-menu-subtitle {
    font-size: 0.95rem;
    margin-bottom: 2.5rem;
  }

  .admin-menu-btn svg {
    width: 22px;
    height: 22px;
  }

  .admin-comodidades-add {
    flex-direction: column;
    gap: 0.75rem;
  }

  .admin-comodidad-buscar-container {
    width: 100%;
    max-width: none;
  }

  .admin-select-comodidad {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  .admin-btn-agregar-comod {
    width: 100%;
    min-height: 48px;
  }

  .admin-carac-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .admin-carac-row input {
    width: 100%;
    min-height: 48px;
  }

  .admin-detalle-edit .admin-input-detalle,
  .admin-detalle-edit .admin-select-detalle {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  .admin-select-comuna {
    width: 100%;
    min-height: 48px;
  }

  .admin-unidades-edit input {
    width: 100%;
    min-height: 48px;
    margin-bottom: 0.5rem;
  }

  .admin-textarea-desc,
  .admin-textarea-comod,
  .admin-textarea-zona {
    font-size: 1rem;
    min-height: 140px;
  }

  .admin-input-inline,
  .admin-nombre-input,
  .admin-precio-input {
    min-height: 48px;
    font-size: 1rem;
  }

  .admin-badge-select {
    min-height: 48px;
    font-size: 1rem;
  }

  .form-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .form-actions .btn-primary,
  .form-actions .btn-secondary {
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
  }

  .admin-form-actions-vivienda {
    flex-direction: column;
  }

  .admin-form-actions-vivienda .admin-btn-cancelar,
  .admin-form-actions-vivienda .admin-btn-guardar {
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
  }

  .admin-modal {
    padding: 1rem 0.5rem 2rem;
  }

  .admin-modal-close--vivienda {
    width: 44px;
    height: 44px;
  }

  /* Optimización móvil: menos jank en pantalla y desplegables */
  .admin-orb {
    filter: blur(25px);
  }
  .admin-line {
    animation: none;
    opacity: 0.2;
  }
  .admin-form input,
  .admin-form select,
  .admin-form button,
  .admin-badge-select,
  .admin-select-comuna,
  .admin-select-comodidad,
  .admin-detalle-edit .admin-select-detalle {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .admin-modal,
  .admin-panel-vivienda,
  .admin-form-section {
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
}
