/* ==========================================================================
   All Cancún — Base / reset
   Diseño exclusivo para teléfono en vertical.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  /* Ancla la escala: el diseño se ve idéntico en Mac y en todo teléfono.
     Sin esto, el "tamaño de texto" del navegador móvil infla el rem y
     desacomoda la interfaz. 16px = base de escritorio. */
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html,
body {
  background: var(--color-bg);
  color: var(--color-text);
  overscroll-behavior: none;
  /* Diseño exclusivo de teléfono: nunca hay desplazamiento lateral */
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

/* Los SVG inline llegan sin dimensiones y, mientras carga el CSS de cada
   vista, se pintan al tamaño por defecto del navegador (300x150): eso es el
   parpadeo de "iconos grandes y feos" al cambiar de vista. Un tamaño base
   evita el salto; cada componente afina el suyo después. */
svg:not([width]):not([height]) {
  width: 1em;
  height: 1em;
}

svg {
  flex-shrink: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* App shell: columna vertical, ancho de teléfono centrado */
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--app-max-width);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--color-bg);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  overflow: hidden;
  position: relative;
  isolation: isolate;
  /* El contenido nunca se desborda del marco de teléfono */
  overflow-x: hidden;
}

/* Fondo inmersivo: negro azulado con dos halos de color */
#app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 55% at 0% 0%, rgba(47, 214, 196, 0.16) 0%, transparent 60%),
    radial-gradient(90% 45% at 100% 4%, rgba(120, 95, 255, 0.18) 0%, transparent 62%),
    radial-gradient(100% 40% at 50% 112%, rgba(255, 122, 89, 0.1) 0%, transparent 68%),
    linear-gradient(180deg, #0c1017 0%, #0b0e13 48%, #080a0f 100%);
}

.screen {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  /* Sin min-height: 0 el hijo flex no encoge y el scroll interno
     se rompe en Safari: el contenido se sale y no hay forma de llegar
     al final. Es el bug clásico del flex column + overflow. */
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* Barra inferior de pestañas: flota sobre el contenido */
.app-dock {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3) calc(var(--safe-bottom) + var(--space-2));
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--color-border);
  z-index: 10;
}

.app-dock[hidden] {
  display: none;
}

/* --- Pestañas de la barra inferior --- */
.dock-tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--tap-min);
  padding: var(--space-1) 2px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition: color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}

.dock-tab__ico {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  position: relative;
}

.dock-tab__ico svg {
  width: 21px;
  height: 21px;
}

.dock-tab__label {
  font-size: 10.5px;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.01em;
  line-height: 1;
}

.dock-tab.is-active {
  color: var(--color-brand);
  background: var(--color-brand-soft);
}

.dock-tab.is-active .dock-tab__label {
  font-weight: var(--font-weight-semibold);
}

/* Punto de aviso sobre el icono (pedidos nuevos) */
.dock-tab__dot {
  position: absolute;
  top: -1px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--color-brand);
  box-shadow: 0 0 0 2px var(--color-surface);
}

.dock-tab.is-active .dock-tab__dot {
  box-shadow: 0 0 0 2px var(--color-brand-soft);
}

/* Utilidades */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
