/* main.css
 * Global styles for the Lobelia launcher screen and shared utility classes.
 */
:root {
  --lobelia-green: #2e8b57;
  --lobelia-green-dark: #1f5e3b;
  --lobelia-cream: #efe5cf;
  --lobelia-wood: #3a2a1e;
  --lobelia-gold: #cfa15b;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --radius: 16px;
  --radius-pill: 999px;
  --gap: 14px;
}

html,
body {
  height: 100%;
  margin: 0;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--lobelia-wood);
  min-height: 100dvh;
  display: grid;
  place-items: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1c1a16;
}

.app {
  width: 100vw;
  height: 100dvh;
  max-width: min(100vw, 56.25vh);
  max-height: min(100dvh, calc(100vw * 16 / 9));
  aspect-ratio: 9 / 16;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: url('../images/Choma.png') center/cover no-repeat;
  background-blend-mode: normal;
}

.app::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.18) 100%);
}

.content {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap);
  margin-top: 160px;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  user-select: none;
  letter-spacing: 0.2px;
  font-weight: 700;
  text-align: center;
  transition: transform 0.06s ease, filter 0.15s ease, box-shadow 0.15s ease;
  display: inline-block;
  text-decoration: none;
  color: inherit;
  background: rgba(239, 229, 207, 0.92);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.35), var(--shadow);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary {
  width: 50%;
  max-width: 200px;
  padding: 14px 18px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.btn-small {
  padding: 1.2vh 1.5vw;
  border-radius: var(--radius-pill);
  width: auto;
  min-width: 120px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-weight: 600;
  font-size: clamp(0.85rem, 1.5vw, 1rem);
}

.btn-google {
  padding: 10px 12px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

@media (hover: hover) {
  .btn-primary:hover,
  .btn-small:hover,
  .btn-google:hover {
    filter: brightness(1.03);
  }
}

.top-right {
  position: absolute;
  top: 2%;
  right: 2%;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1%;
  pointer-events: auto;
}

.flag-btn {
  width: 2.5vw;
  min-width: 22px;
  height: 1.7vw;
  min-height: 15px;
  border: none;
  background-size: cover;
  background-position: center;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bottom {
  position: absolute;
  bottom: 2%;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.bottom > * {
  pointer-events: auto;
}

.btn-disabled {
  opacity: 0.55;
  filter: saturate(0.2) contrast(0.95);
  pointer-events: auto;
}

@media (hover: hover) {
  .btn-disabled:hover {
    filter: saturate(0.25) contrast(0.98);
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 999;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(239, 229, 207, 0.98);
  color: #1c1a16;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.12);
  width: min(92vw, 420px);
  padding: 18px;
  display: none;
  z-index: 1000;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.modal p {
  margin: 0 0 14px;
  line-height: 1.35;
}

.modal .actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal .btn-ok {
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  background: var(--lobelia-cream);
  box-shadow: var(--shadow);
  font-weight: 700;
  cursor: pointer;
}

.modal-open .modal,
.modal-open .modal-backdrop {
  display: block;
}

/* Debug Grid Styles */
.app {
  position: relative; /* Asegura que la cuadrícula sea relativa a este contenedor */
}

.layout-grid {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(20, 1fr);
  gap: 0;
  padding: 0;
  margin: 0;
  background-color: transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.layout-grid.is-visible {
  opacity: 0.9;
  visibility: visible;
}

.layout-grid__cell {
  background-color: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.3);
  display: flex;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: rgba(255, 0, 0, 0.7);
  text-transform: uppercase;
  font-weight: 600;
}

/* Media Queries para dispositivos móviles */
@media (max-width: 768px) {
  .app {
    border-radius: 0;
  }
  
  .layout-grid__cell {
    font-size: 7px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .app {
    max-width: calc(100vh * 9 / 16);
    max-height: 100vh;
  }
  
  .flag-btn {
    width: 22px;
    height: 15px;
  }
}

/* Estilos para botones CTA Card */
.cta-card {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  transition: transform 0.12s ease, filter 0.18s ease;
}

.cta-card:hover,
.cta-card:focus-visible {
  transform: scale(1.02);
  filter: brightness(1.05);
}

.cta-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
}

.cta-card__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.7));
  color: white;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border-radius: 0 0 var(--radius) var(--radius);
}

.main-action,
.flyer-action {
  position: relative;
  z-index: 15;
  pointer-events: auto;
}

/* Estilos para el layout principal */
.home-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  height: 100%;
}

.mini-gallery {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.main-action,
.flyer-action {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80px;
}

.cta-card {
  pointer-events: auto;
  z-index: 16;
}

/* Modal PDF específico (alta especificidad para evitar sobreescrituras) */
#pdf-backdrop.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none; /* se activa por JS */
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10000;
}
#pdf-backdrop .modal-card {
  width: min(96vw, 980px);
  height: min(90vh, 900px);
  background: #111;
  border: 1px solid #3d3d3d;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
#pdf-backdrop .modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  border-radius: 999px;
  padding: 6px 10px;
  background: linear-gradient(180deg, #ead39a, #cfa15b);
  border: 1px solid #b79045;
  font-weight: 800;
  cursor: pointer;
}
#pdf-backdrop .modal-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #222;
}

/* Control de visibilidad de modales (evita backdrops siempre visibles) */
.modal-backdrop {
  display: none !important;
}
.modal[aria-hidden="true"],
.modal-backdrop[aria-hidden="true"] {
  display: none !important;
}
.modal[aria-hidden="false"] {
  display: block !important;
}
#pdf-backdrop[aria-hidden="false"] {
  display: flex !important;
}
