/* position:fixed — no sobrescribir en decoraciones.css */
#ficha-modal.ficha-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

#ficha-modal.ficha-modal[hidden] {
  display: none;
}

.ficha-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 77, 62, 0.6);
  backdrop-filter: blur(6px);
}

.ficha-dialog {
  position: relative;
  width: min(540px, 100%);
  height: min(85vh, 820px);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: linear-gradient(180deg, #fff 0%, #e8f5e9 100%);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  border: 4px solid var(--green-mid);
  animation: ficha-in 0.28s ease-out;
}

.ficha-dialog::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--ficha-bg, none);
  background-size: cover;
  background-position: center;
  opacity: var(--ficha-bg-opacity, 0.1);
  border-radius: 15px;
}

.ficha-dialog::after {
  content: "";
  position: absolute;
  top: 0.5rem;
  right: 3rem;
  width: 72px;
  height: 72px;
  background-image: var(--ficha-acento, none);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
}

@keyframes ficha-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ficha-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 5;
  width: 2.35rem;
  height: 2.35rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.98);
  color: var(--green-dark);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.ficha-close:hover {
  background: #fff;
  color: var(--green-mid);
}

.ficha-content {
  position: relative;
  z-index: 2;
  grid-row: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ficha-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.ficha-hero {
  position: relative;
  flex-shrink: 0;
  line-height: 0;
  background: linear-gradient(135deg, var(--green-mid) 0%, var(--green-light) 100%);
  border-bottom: 3px solid var(--gold);
}

.ficha-hero img {
  width: 100%;
  height: auto;
  max-height: min(28vh, 200px);
  object-fit: contain;
  object-position: center;
  display: block;
}

.ficha-hero-badge {
  position: absolute;
  bottom: 0.5rem;
  left: 0.75rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--gold);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  line-height: 1.3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ficha-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.ficha-body {
  padding: 1.15rem 1.35rem 1rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
}

.ficha-cat {
  display: inline-block;
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--gold);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.ficha-body h2 {
  margin: 0 0 0.25rem;
  font-size: 1.8rem;
  color: var(--green-dark);
  line-height: 1.15;
  background: linear-gradient(90deg, var(--green-mid) 0%, var(--green-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ficha-slogan {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--gold);
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ficha-destacado {
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.9rem;
  background: linear-gradient(90deg, var(--gold) 0%, #f39c12 100%);
  border-left: 5px solid var(--brown);
  border-radius: 0 10px 10px 0;
  font-size: 0.9rem;
  color: #fff;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ficha-descripcion {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
}

.ficha-servicios h3,
.ficha-datos h3 {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green-dark);
}

.ficha-servicios ul {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.ficha-servicios li {
  margin-bottom: 0.25rem;
}

.ficha-datos dl {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.ficha-dato {
  padding: 0.6rem 0.8rem;
  background: linear-gradient(135deg, #fff 0%, #fffde7 100%);
  border-radius: 8px;
  border: 2px solid var(--gold);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ficha-datos dt {
  font-size: 0.75rem;
  font-weight: 700;
  color: #c29800;
  margin-bottom: 0.15rem;
}

.ficha-datos dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.45;
}

.ficha-datos dd a {
  color: var(--gold);
  font-weight: 700;
}

.ficha-actions {
  grid-row: 2;
  flex-shrink: 0;
  margin: 0;
  padding: 1rem 1.25rem 1.1rem;
  background: linear-gradient(135deg, var(--green-mid) 0%, var(--green-dark) 100%);
  border-top: 3px solid var(--gold);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 4;
}

.ficha-actions[hidden] {
  display: none !important;
}

.ficha-actions-title {
  margin: 0 0 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  text-align: center;
}

.ficha-actions .btn {
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  font-weight: 700;
  border-radius: 10px;
}

.btn-llegar {
  background: var(--gold);
  color: #fff;
  padding: 0.75rem 1rem;
  border: none;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(241, 196, 15, 0.4);
}

.btn-llegar:hover {
  background: #f39c12;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(241, 196, 15, 0.5);
}

.btn-llamar {
  background: #fff;
  color: var(--green-dark);
  border: 2px solid var(--gold);
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-llamar:hover {
  background: #fffde7;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.ficha-link-mapa {
  margin: 0.15rem 0 0;
  padding: 0.35rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
  width: 100%;
  text-align: center;
}

.ficha-link-mapa:hover {
  color: var(--green-dark);
}

.btn-whatsapp {
  background: linear-gradient(180deg, #2ee66d 0%, #25d366 100%);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp:hover {
  background: linear-gradient(180deg, #25d366 0%, #1da851 100%);
  transform: translateY(-1px);
}

.btn-whatsapp svg {
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
}

.btn-outline {
  background: transparent;
  color: var(--green-mid);
  border: 2px solid var(--green-mid);
}

.btn-outline:hover {
  background: #e8f5e9;
}

.popup-actions {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.popup-actions a {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  text-decoration: none;
}

.popup-btn-ficha {
  background: var(--green-mid);
  color: #fff;
}

.popup-btn-llegar {
  background: var(--green-dark);
  color: #fff;
}

.popup-btn-llamar {
  background: #fff;
  color: var(--green-dark);
  border: 1px solid var(--green-mid);
}

.popup-btn-wa {
  background: #25d366;
  color: #fff;
}

.pauta-card-hint {
  margin: 0;
  padding: 0.35rem 0.65rem 0.55rem;
  font-size: 0.7rem;
  color: var(--teal);
  font-weight: 600;
  text-align: center;
}

/* Móvil y tablet: panel tipo hoja inferior (botones siempre visibles) */
@media (max-width: 768px) {
  #ficha-modal.ficha-modal {
    padding: 0;
    align-items: flex-end;
    justify-content: flex-end;
  }

  .ficha-dialog {
    width: 100%;
    max-width: 100%;
    height: calc(100svh - 2rem);
    max-height: calc(100svh - 2rem);
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  .ficha-close {
    top: calc(0.5rem + env(safe-area-inset-top, 0px));
    right: calc(0.5rem + env(safe-area-inset-right, 0px));
  }

  .ficha-hero img {
    max-height: min(22svh, 120px);
  }

  .ficha-body {
    padding: 0.85rem 1rem 0.75rem;
  }

  .ficha-body h2 {
    font-size: 1.35rem;
  }

  .ficha-slogan {
    font-size: 1rem;
  }

  .ficha-destacado {
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
  }

  .ficha-descripcion {
    font-size: 0.88rem;
  }

  .ficha-actions {
    padding: 0.6rem 0.9rem;
    padding-bottom: calc(0.7rem + env(safe-area-inset-bottom, 12px));
    gap: 0.4rem;
  }

  .ficha-actions .btn {
    min-height: 42px;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
  }

  .btn-whatsapp {
    font-size: 0.925rem;
    padding: 0.6rem 0.85rem;
  }

  .ficha-link-mapa {
    min-height: 38px;
    padding: 0.45rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 480px) {
  .ficha-hero img {
    max-height: min(20svh, 110px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ficha-dialog {
    animation: none;
  }
}
