/* =========================================================================
   Garage Labrín · Capa de movimiento y componentes 2.0
   Evolución de la identidad existente (tokens de gl-tokens.css): mismos rojos,
   mismos fondos oscuros, sin colores nuevos salvo el verde oficial de WhatsApp.
   Todo el movimiento usa transform/opacity (sin repintados costosos) y se
   desactiva con prefers-reduced-motion.
   ========================================================================= */

/* ---------- Transición suave entre páginas (navegadores compatibles) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 180ms; animation-timing-function: var(--gl-ease, ease); }

/* ---------- Hero: entrada escalonada y línea roja con barrido de luz ---------- */
.hero-content > * {
  animation: gl-subir 640ms var(--gl-ease, ease) both;
}
.hero-content > *:nth-child(2) { animation-delay: 90ms; }
.hero-content > *:nth-child(3) { animation-delay: 180ms; }
.hero-content > *:nth-child(4) { animation-delay: 270ms; }
.hero-content > *:nth-child(5) { animation-delay: 360ms; }
.hero::after {
  background: linear-gradient(90deg, transparent 0%, var(--gl-red) 35%, var(--gl-red-bright) 50%, var(--gl-red) 65%, transparent 100%);
  background-size: 200% 100%;
  animation: gl-barrido 6s linear infinite;
}

@keyframes gl-subir { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes gl-aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes gl-barrido { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes gl-pulso { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(1.55); opacity: 0; } }
@keyframes gl-shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes gl-toast { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Botones: microinteracciones ---------- */
.btn-primary, .btn-secondary, .btn-nav, .footer-btn { position: relative; overflow: hidden; }
.btn-primary::after, .footer-btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .22) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 620ms var(--gl-ease, ease);
  pointer-events: none;
}
.btn-primary:hover::after, .footer-btn-primary:hover::after { transform: translateX(120%); }
.btn-primary:active, .btn-secondary:active, .footer-btn:active, .slot:active { transform: scale(.97); }

/* ---------- Aparición progresiva extendida (main.js añade .reveal) ---------- */
.timeline-item.reveal, .section h2.reveal, .gl-legal section.reveal { will-change: opacity, transform; }

/* ---------- Tarjetas de servicio: icono con elevación al pasar el cursor ---------- */
.service-card .gl-icon, .feature-card .gl-icon { transition: transform 260ms var(--gl-ease, ease); }
.service-card:hover .gl-icon, .feature-card:hover .gl-icon { transform: translateY(-3px) rotate(-6deg); }

/* ---------- Paneles: entrada discreta del contenido y avisos ---------- */
.admin-main { animation: gl-aparecer 220ms ease both; }
.alert { animation: gl-toast 260ms var(--gl-ease, ease) both; }
.alert[data-cerrable] { position: relative; padding-right: 48px; }
.alert__cerrar {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: transparent; color: inherit; cursor: pointer; font-size: 20px; line-height: 1;
}
.alert__cerrar:hover { background: rgba(255, 255, 255, .08); }
.alert.is-saliendo { opacity: 0; transform: translateY(-6px); transition: opacity 200ms, transform 200ms; }

/* KPIs: el número cuenta hacia arriba (gl-motion.js) */
.admin-stat-card strong { font-variant-numeric: tabular-nums; }

/* Skeleton para miniaturas mientras cargan */
.gl-galeria__mini,
.gl-skeleton {
  background: linear-gradient(90deg, var(--gl-field) 25%, var(--gl-raised) 37%, var(--gl-field) 63%);
  background-size: 400% 100%;
  animation: gl-shimmer 1.4s ease infinite;
}


/* ---------- WhatsApp flotante (solo vistas públicas) ---------- */
.gl-wa-float {
  position: fixed;
  right: calc(22px + env(safe-area-inset-right, 0px));
  bottom: calc(22px + 56px + 14px + env(safe-area-inset-bottom, 0px));
  z-index: 2990;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gl-whatsapp, #128c7e);
  color: #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
  text-decoration: none;
  transition: transform 200ms var(--gl-ease, ease), box-shadow 200ms;
  animation: gl-subir 500ms 900ms var(--gl-ease, ease) both;
}
.gl-wa-float::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--gl-whatsapp, #128c7e);
  z-index: -1;
  animation: gl-pulso 2.6s 2s ease-out 3;
}
.gl-wa-float .gl-icon { width: 28px; height: 28px; }
.gl-wa-float:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 14px 30px rgba(0, 0, 0, .5); }
.gl-wa-float:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.gl-wa-float__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.footer-btn-whatsapp .gl-icon { width: 20px; height: 20px; }
/* Con el asistente abierto el botón se retira para no tapar la conversación */
body.gl-chat-abierto .gl-wa-float { opacity: 0; pointer-events: none; transform: scale(.8); }
@media (max-width: 760px) {
  .gl-wa-float { right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + 56px + 12px + env(safe-area-inset-bottom, 0px)); }
}
@media print { .gl-wa-float { display: none; } }

/* ---------- Privacidad: avisos en formularios y enlaces legales ---------- */
.gl-aviso-privacidad {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 4px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--gl-line);
  border-left: 3px solid var(--gl-red);
  border-radius: var(--gl-r-md, 12px);
  background: var(--gl-field);
  color: var(--gl-muted);
  font-size: var(--gl-fs-sm, .875rem);
  line-height: 1.55;
}
.gl-aviso-privacidad .gl-icon { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px; color: var(--gl-red-text); }
.gl-aviso-privacidad a { color: var(--gl-text); text-decoration: underline; text-underline-offset: 3px; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-legal a { color: var(--gl-muted); font-size: 14px; text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.footer-legal a:hover, .footer-legal a:focus-visible { color: var(--gl-text); text-decoration: underline; }

/* ---------- Páginas legales ---------- */
.gl-legal { max-width: 920px; margin: 0 auto; padding: clamp(32px, 6vw, 64px) var(--gl-gutter, 16px); }
.gl-legal__meta { color: var(--gl-muted); font-size: var(--gl-fs-sm, .875rem); margin: 6px 0 24px; }
.gl-legal section { margin: 0 0 22px; padding: 20px 22px; border: 1px solid var(--gl-line); border-radius: var(--gl-r-lg, 18px); background: linear-gradient(180deg, var(--gl-surface), var(--gl-surface-2)); }
.gl-legal h2 { font-size: var(--gl-fs-h3, 1.25rem); margin: 0 0 10px; color: var(--gl-text); }
.gl-legal h3 { font-size: 1.05rem; margin: 16px 0 8px; color: var(--gl-text); }
.gl-legal p, .gl-legal li, .gl-legal td, .gl-legal th { color: var(--gl-text-2); line-height: 1.65; }
.gl-legal a { color: var(--gl-text); text-decoration: underline; text-underline-offset: 3px; }
.gl-legal table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.gl-legal th, .gl-legal td { padding: 10px 12px; border-bottom: 1px solid var(--gl-line); text-align: left; vertical-align: top; font-size: var(--gl-fs-sm, .875rem); }
.gl-legal th { color: var(--gl-muted); text-transform: uppercase; letter-spacing: .06em; font-size: var(--gl-fs-xs, .75rem); }
.gl-legal .gl-pendiente, .gl-legal mark { background: var(--gl-red-a13); color: var(--gl-red-tint); padding: 1px 6px; border-radius: 6px; }

/* ---------- Estado de solicitudes / chips de privacidad ---------- */
.gl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: var(--gl-fs-xs, .75rem); font-weight: 800; border: 1px solid var(--gl-line); background: var(--gl-raised); color: var(--gl-text-2); white-space: nowrap; }
.gl-chip--ok { border-color: rgba(32, 201, 151, .45); color: var(--gl-ok); }
.gl-chip--warn { border-color: rgba(245, 179, 1, .45); color: var(--gl-warn); }
.gl-chip--rojo { border-color: var(--gl-red-a35); color: var(--gl-red-text); }
.gl-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.gl-tabs a { padding: 9px 14px; min-height: 40px; display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; border: 1px solid var(--gl-line); color: var(--gl-text-2); text-decoration: none; font-weight: 700; transition: background-color 160ms, border-color 160ms; }
.gl-tabs a:hover { background: var(--gl-raised); }
.gl-tabs a[aria-current="page"] { background: var(--gl-red-a13); border-color: var(--gl-red-a35); color: var(--gl-white); }
.gl-tabs .gl-icon { width: 16px; height: 16px; }
.gl-tabla-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gl-controles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.gl-control { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--gl-line); border-radius: 14px; background: var(--gl-field); }
.gl-control strong { display: block; color: var(--gl-text); }
.gl-control small { color: var(--gl-muted); }

/* ---------- Movimiento reducido: sin animaciones decorativas ---------- */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .hero-content > *, .hero::after, .gl-wa-float, .gl-wa-float::before, .admin-main, .alert,
  .gl-galeria__mini, .gl-skeleton { animation: none !important; }
  .btn-primary::after, .footer-btn-primary::after { display: none; }
  .service-card:hover .gl-icon, .feature-card:hover .gl-icon { transform: none; }
}

/* Estado vacío reutilizable */
.empty-state { padding: 22px; border: 1px dashed var(--gl-line); border-radius: 14px; color: var(--gl-muted); text-align: center; background: var(--gl-field); }

/* Landmark principal sin efecto visual y verde de WhatsApp con contraste AA (texto blanco 6:1) */
.gl-main { display: block; }
.footer-btn-whatsapp, .gl-wa-float, .gl-wa-float::before { background: #0b6e63; }
