/* ══════════════════════════════════════════════════════════════════
   pages-app.css — GelatoMaps App Layer
   Estilos para: PWA install banner, Bottom nav, Ripple,
   Scroll animations, Scroll-to-top, Header scroll, Page transitions.
   Complementa pages-nav.js y pages-app.js.
   Autor: Dpto 06 UX & Diseño — GelatoMaps
   ══════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────
   1. PAGE TRANSITION
   ──────────────────────────────────────────────────────────────── */
html.gm-page-loading {
  opacity: 0;
}
html.gm-page-loaded {
  opacity: 1;
  transition: opacity 0.18s ease;
}
html.gm-page-exit {
  opacity: 0;
  transition: opacity 0.18s ease;
}

/* ─────────────────────────────────────────────────────────────────
   2. RIPPLE EFFECT
   ──────────────────────────────────────────────────────────────── */
.gm-rpl {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
  transform: scale(0);
  animation: gm-ripple 0.55s cubic-bezier(0, 0.5, 0.5, 1) forwards;
}

@keyframes gm-ripple {
  to {
    transform: scale(1);
    opacity: 0;
  }
}

/* ─────────────────────────────────────────────────────────────────
   3. SCROLL ENTRANCE ANIMATIONS
   ──────────────────────────────────────────────────────────────── */
.gm-will-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1) var(--gm-delay, 0s),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1) var(--gm-delay, 0s);
}

.gm-revealed {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .gm-will-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ─────────────────────────────────────────────────────────────────
   4. TAB BOUNCE — micro-animación al seleccionar
   ──────────────────────────────────────────────────────────────── */
@keyframes gm-tab-bounce {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.88); }
  70%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.gm-tab-bounce {
  animation: gm-tab-bounce 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both !important;
}

/* ─────────────────────────────────────────────────────────────────
   5. HEADER SCROLL STATE
   ──────────────────────────────────────────────────────────────── */
#gl-hdr {
  transition: box-shadow 0.25s ease, backdrop-filter 0.25s ease, background 0.25s ease;
}

#gl-hdr.gm-hdr-scrolled {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 24px rgba(0, 0, 0, 0.4);
  background: rgba(7, 14, 26, 0.95);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

/* ─────────────────────────────────────────────────────────────────
   6. SCROLL TO TOP BUTTON
   ──────────────────────────────────────────────────────────────── */
.gm-stt {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent-a85);
  border: 1.5px solid rgba(94, 234, 212, 0.3);
  color: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--color-accent-a40);
  opacity: 0;
  transform: translateY(16px) scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 490;
  backdrop-filter: blur(8px);
}

.gm-stt:hover {
  background: var(--color-accent);
  transform: translateY(0) scale(1.06) !important;
  box-shadow: 0 6px 28px var(--color-accent-a50);
}

.gm-stt-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

@media (max-width: 600px) {
  .gm-stt {
    bottom: 80px; /* encima del bottom nav */
    right: 14px;
    width: 40px;
    height: 40px;
  }
  /* blog.html tiene su propio scroll-to-top (.scroll-to-top#scrollToTop)
     en bottom:24px — lo subimos por encima del bottom nav */
  .scroll-to-top {
    bottom: 76px !important;
    right: 14px !important;
  }
}

/* ─────────────────────────────────────────────────────────────────
   7. PWA INSTALL BANNER
   ──────────────────────────────────────────────────────────────── */
.gm-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  padding: 0 16px env(safe-area-inset-bottom) 16px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gm-install-banner.gm-install-visible {
  transform: translateY(0);
}

.gm-install-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1A2235;
  border: 1px solid var(--color-border-md);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 16px 20px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

.gm-install-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.gm-install-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gm-install-text strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-white);
  font-family: var(--display, 'Plus Jakarta Sans', sans-serif);
}

.gm-install-text span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.gm-install-btn {
  padding: 8px 18px;
  border-radius: 20px;
  background: var(--color-accent, #0D9488);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font, sans-serif);
  transition: background 0.18s, transform 0.15s;
  flex-shrink: 0;
}

.gm-install-btn:hover {
  background: var(--color-accent-dark);
  transform: scale(1.04);
}

.gm-install-close {
  background: none;
  border: none;
  color: var(--color-text-on-dark-low);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.18s;
  flex-shrink: 0;
}

.gm-install-close:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* ─────────────────────────────────────────────────────────────────
   8. BOTTOM APP NAV (mobile ≤600px)
   ──────────────────────────────────────────────────────────────── */
.gm-bottom-nav {
  display: none;
}

@media (max-width: 600px) {
  .gm-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 480;
    background: rgba(7, 14, 26, 0.97);
    border-top: 1px solid var(--color-border);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.5);
    height: calc(60px + env(safe-area-inset-bottom));
    align-items: stretch;
  }

  .gm-bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px 6px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: color 0.18s, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
  }

  .gm-bn-item:active {
    transform: scale(0.88);
  }

  .gm-bn-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .gm-bn-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
  }

  .gm-bn-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    font-family: var(--font, sans-serif);
  }

  /* Estado activo */
  .gm-bn-item.gm-bn-active {
    color: var(--color-accent, #0D9488);
  }

  .gm-bn-item.gm-bn-active .gm-bn-icon::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-accent-a10);
    z-index: -1;
  }

  /* Botón central especial — "Mapa" con acento */
  .gm-bn-item.gm-bn-special {
    color: var(--color-white);
  }

  .gm-bn-item.gm-bn-special .gm-bn-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-accent, #0D9488) 0%, #0b8079 100%);
    border-radius: 50%;
    margin-top: -16px;
    box-shadow: 0 4px 20px var(--color-accent-a50);
    border: 2px solid rgba(94, 234, 212, 0.2);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s;
  }

  .gm-bn-item.gm-bn-special:active .gm-bn-icon {
    transform: scale(0.9);
  }

  .gm-bn-item.gm-bn-special .gm-bn-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
  }
}

/* ─────────────────────────────────────────────────────────────────
   9. MICRO-INTERACCIONES ADICIONALES
   ──────────────────────────────────────────────────────────────── */

/* Cards — elevación al hover más pronunciada */
.gl-card,
.rec-card,
.sab-card,
.blog-card,
.promo-card {
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.22s ease,
              border-color 0.18s ease !important;
}

.gl-card:hover,
.rec-card:hover,
.sab-card:hover,
.blog-card:hover {
  transform: translateY(-4px) scale(1.01) !important;
  box-shadow: 0 12px 40px var(--color-overlay-sm) !important;
}

/* Botones principales — efecto de presión más pronunciado */
button:active:not(.gm-stt):not(.gm-install-btn),
a[role="button"]:active {
  transform: scale(0.95) !important;
  transition-duration: 0.08s !important;
}

/* Tipo cards en inicio — efecto de brillo en hover */
.tipo-card {
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.18s ease,
              box-shadow 0.22s ease !important;
  position: relative;
  overflow: hidden;
}

.tipo-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.tipo-card:hover::after {
  opacity: 1;
}

.tipo-card:hover {
  transform: translateY(-6px) !important;
  border-color: var(--color-accent-a40) !important;
  box-shadow: 0 16px 48px var(--color-accent-a15) !important;
}

/* ─────────────────────────────────────────────────────────────────
   10. FOCUS VISIBLE mejorado (accesibilidad)
   ──────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-accent, #0D9488) !important;
  outline-offset: 3px !important;
  border-radius: 4px;
}

/* ─────────────────────────────────────────────────────────────────
   11. INDICADOR DE CARGA DE PÁGINA (top progress bar)
   ──────────────────────────────────────────────────────────────── */
html.gm-page-loading::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--color-accent, #0D9488) 0%, var(--color-accent-light) 50%, var(--color-accent, #0D9488) 100%);
  background-size: 200% 100%;
  animation: gm-progress 1.2s linear infinite;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.3s;
}

@keyframes gm-progress {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
