/* ============================================================
   componentes.css — Estructura de la app (layout + navegación)
   y piezas reutilizables: botones, tarjetas, chips, avisos.
   Mobile-first: primero el celular, luego @media para laptop.
   ============================================================ */

/* ---------- Estructura general ---------- */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Entrada suave de la app después del splash */
.app.entrando { animation: appEntra .5s var(--curva) both; }
@keyframes appEntra {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Cabecera (solo celular) ---------- */
.cabecera {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--esp-3);
  height: calc(var(--alto-cabecera) + var(--seguro-arriba));
  padding: var(--seguro-arriba) var(--esp-4) 0;
  background: color-mix(in srgb, var(--fondo) 82%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--borde);
}
.cabecera .logo { width: 30px; height: 30px; }
.cabecera-titulo { font-weight: 700; font-size: var(--txt-lg); }
.cabecera-marca { margin-left: auto; font-size: var(--txt-xs); color: var(--texto-2); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- Contenido principal ---------- */
.vista {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--esp-5) var(--esp-4) calc(var(--alto-nav) + var(--seguro-abajo) + var(--esp-8));
  outline: none;
}
.vista.cambiando { animation: vistaEntra .35s var(--curva) both; }
@keyframes vistaEntra {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Navegación principal ----------
   En celular: barra inferior con botón central "Nuevo".
   En laptop: menú lateral fijo (ver @media al final). */
.nav-principal {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--alto-nav) + var(--seguro-abajo));
  padding-bottom: var(--seguro-abajo);
  background: color-mix(in srgb, var(--superficie) 88%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--borde);
}
.nav-marca { display: none; }
.nav-lista {
  list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: var(--alto-nav);
  align-items: center;
}
.nav-enlace {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: 100%; min-height: 48px;
  color: var(--texto-2);
  font-size: 11px; font-weight: 600;
  transition: color var(--rapido) ease;
}
.nav-enlace svg { width: 22px; height: 22px; }
.nav-enlace[aria-current="page"] { color: var(--acento); }
.nav-enlace:active { transform: scale(.94); }

/* Botón central "Nuevo" */
.nav-nuevo .nav-enlace { color: var(--acento-texto); }
.nav-nuevo .nav-enlace span.burbuja {
  display: grid; place-items: center;
  width: 48px; height: 48px; margin-top: -18px;
  border-radius: 16px;
  background: var(--acento);
  box-shadow: 0 6px 20px var(--brillo), var(--sombra-2);
  transition: transform var(--rapido) ease;
}
.nav-nuevo .nav-enlace span.burbuja svg { width: 24px; height: 24px; }
.nav-nuevo .nav-enlace .etiqueta { color: var(--texto-2); }
.nav-nuevo .nav-enlace[aria-current="page"] .etiqueta { color: var(--acento); }

/* ---------- Encabezado de cada pantalla ---------- */
.titulo-vista { margin-bottom: var(--esp-6); }
.titulo-vista h1 { font-size: var(--txt-2xl); }
.titulo-vista p { color: var(--texto-2); margin-top: var(--esp-1); }
.sobretitulo {
  display: inline-block;
  font-size: var(--txt-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--acento);
  margin-bottom: var(--esp-2);
}
.seccion { margin-top: var(--esp-8); }
.seccion > h2 { font-size: var(--txt-lg); margin-bottom: var(--esp-3); }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--esp-2);
  min-height: 48px; padding: 0 var(--esp-5);
  border-radius: var(--radio-md);
  font-weight: 700; font-size: var(--txt-md);
  transition: background-color var(--rapido) ease, transform var(--rapido) ease, border-color var(--rapido) ease;
  user-select: none;
}
.boton svg { width: 20px; height: 20px; }
.boton:active { transform: scale(.97); }
.boton-primario { background: var(--acento); color: var(--acento-texto); }
.boton-primario:hover { background: var(--acento-hover); }
.boton-secundario { background: var(--superficie-2); border: 1px solid var(--borde-fuerte); }
.boton-secundario:hover { border-color: var(--texto-2); }
.boton-fantasma { color: var(--texto-2); padding: 0 var(--esp-3); }
.boton-fantasma:hover { color: var(--texto); }
.boton[disabled] { opacity: .45; pointer-events: none; }
.boton-bloque { width: 100%; }

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio-lg);
  padding: var(--esp-5);
}
.tarjeta h3 { font-size: var(--txt-md); }
.tarjeta p { color: var(--texto-2); font-size: var(--txt-sm); }

/* Tarjeta destacada de bienvenida */
.hero {
  position: relative; overflow: hidden;
  padding: var(--esp-6);
  background:
    radial-gradient(120% 140% at 100% 0%, var(--acento-suave), transparent 55%),
    var(--superficie);
}
.hero h2 { font-size: var(--txt-xl); max-width: 22ch; }
.hero p { margin: var(--esp-2) 0 var(--esp-5); max-width: 42ch; font-size: var(--txt-md); }
.hero .logo-fondo {
  position: absolute; right: -28px; bottom: -28px;
  width: 150px; opacity: .07; color: var(--texto); pointer-events: none;
}

/* Rejilla de tarjetas */
.rejilla { display: grid; gap: var(--esp-3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* Chips (etiquetas pequeñas) */
.chip {
  display: inline-flex; align-items: center; gap: var(--esp-1);
  padding: 4px 10px; border-radius: var(--radio-total);
  font-size: var(--txt-xs); font-weight: 700;
  background: var(--superficie-2); color: var(--texto-2); border: 1px solid var(--borde);
}
.chip-acento { background: var(--acento-suave); color: var(--acento); border-color: transparent; }

/* Acceso rápido (tarjeta pequeña con ícono) */
.acceso { display: flex; flex-direction: column; gap: var(--esp-3); min-height: 120px; }
.acceso .icono-caja {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--radio-md); background: var(--acento-suave); color: var(--acento);
}
.acceso .icono-caja svg { width: 22px; height: 22px; }
.acceso .chip { align-self: flex-start; margin-top: auto; }

/* ---------- Estado vacío ---------- */
.vacio {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--esp-3); padding: var(--esp-10) var(--esp-5);
  border: 1px dashed var(--borde-fuerte); border-radius: var(--radio-lg);
}
.vacio .icono-caja {
  display: grid; place-items: center; width: 56px; height: 56px;
  border-radius: var(--radio-lg); background: var(--superficie-2); color: var(--texto-2);
}
.vacio .icono-caja svg { width: 26px; height: 26px; }
.vacio p { color: var(--texto-2); max-width: 36ch; font-size: var(--txt-sm); }

/* ---------- Filas de ajustes ---------- */
.lista-ajustes { display: flex; flex-direction: column; gap: var(--esp-3); }
.fila {
  display: flex; align-items: center; gap: var(--esp-4);
  min-height: 64px;
}
.fila .textos { flex: 1; min-width: 0; }
.fila .textos p { margin-top: 2px; }

/* Selector de paleta (temporal, para decidir en la fase 1) */
.opciones-paleta { display: grid; gap: var(--esp-3); grid-template-columns: 1fr 1fr; }
.opcion-paleta {
  text-align: left;
  display: flex; flex-direction: column; gap: var(--esp-3);
  padding: var(--esp-4);
  border-radius: var(--radio-lg);
  border: 2px solid var(--borde);
  transition: border-color var(--rapido) ease, transform var(--rapido) ease;
}
.opcion-paleta:active { transform: scale(.98); }
.opcion-paleta[aria-checked="true"] { border-color: var(--acento); box-shadow: 0 0 0 4px var(--acento-suave); }
.opcion-paleta .muestras { display: flex; gap: 4px; }
.opcion-paleta .muestras span { flex: 1; height: 34px; border-radius: 6px; border: 1px solid rgb(255 255 255 / .08); }
.opcion-paleta strong { font-size: var(--txt-sm); }
.opcion-paleta small { color: var(--texto-2); font-size: var(--txt-xs); font-family: ui-monospace, Menlo, monospace; }

/* ---------- Avisos (toasts) ---------- */
.toasts {
  position: fixed; z-index: 90;
  left: var(--esp-4); right: var(--esp-4);
  bottom: calc(var(--alto-nav) + var(--seguro-abajo) + var(--esp-3));
  display: flex; flex-direction: column; align-items: center; gap: var(--esp-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--esp-3);
  max-width: 440px; width: 100%;
  padding: var(--esp-3) var(--esp-3) var(--esp-3) var(--esp-4);
  background: var(--superficie-2); border: 1px solid var(--borde-fuerte);
  border-radius: var(--radio-md); box-shadow: var(--sombra-3);
  font-size: var(--txt-sm);
  animation: toastEntra .3s var(--curva) both;
}
.toast.saliendo { animation: toastSale .25s ease both; }
.toast span { flex: 1; }
.toast .boton { min-height: 36px; padding: 0 var(--esp-3); font-size: var(--txt-sm); }
@keyframes toastEntra { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toastSale  { to   { opacity: 0; transform: translateY(8px); } }

/* ---------- Laptop / pantallas grandes ---------- */
@media (min-width: 900px) {
  .app { flex-direction: row; }
  .cabecera { display: none; }

  .nav-principal {
    position: sticky; top: 0; bottom: auto; right: auto;
    width: var(--ancho-lateral); height: 100dvh; flex-shrink: 0;
    padding: var(--esp-5) var(--esp-3);
    border-top: 0; border-right: 1px solid var(--borde);
    display: flex; flex-direction: column; gap: var(--esp-6);
  }
  .nav-marca {
    display: flex; align-items: center; gap: var(--esp-3);
    padding: 0 var(--esp-2);
  }
  .nav-marca .logo { width: 38px; height: 38px; }
  .nav-marca strong { display: block; font-size: var(--txt-md); line-height: 1.1; }
  .nav-marca small { color: var(--texto-2); font-size: var(--txt-xs); }

  .nav-lista { display: flex; flex-direction: column; align-items: stretch; gap: var(--esp-1); height: auto; }
  .nav-enlace {
    flex-direction: row; justify-content: flex-start; gap: var(--esp-3);
    height: 44px; padding: 0 var(--esp-3);
    border-radius: var(--radio-md);
    font-size: var(--txt-sm);
  }
  .nav-enlace:hover { background: var(--superficie-2); color: var(--texto); }
  .nav-enlace[aria-current="page"] { background: var(--acento-suave); color: var(--acento); }

  /* En laptop "Nuevo proyecto" va primero, como botón de acento */
  .nav-nuevo { order: -1; margin-bottom: var(--esp-3); }
  .nav-nuevo .nav-enlace {
    background: var(--acento); color: var(--acento-texto); justify-content: center; font-weight: 700;
  }
  .nav-nuevo .nav-enlace:hover { background: var(--acento-hover); color: var(--acento-texto); }
  .nav-nuevo .nav-enlace[aria-current="page"] { background: var(--acento); color: var(--acento-texto); }
  .nav-nuevo .nav-enlace span.burbuja { width: auto; height: auto; margin: 0; background: none; box-shadow: none; }
  .nav-nuevo .nav-enlace span.burbuja svg { width: 20px; height: 20px; }
  .nav-nuevo .nav-enlace .etiqueta,
  .nav-nuevo .nav-enlace[aria-current="page"] .etiqueta { color: var(--acento-texto); }

  .vista { padding: var(--esp-10) var(--esp-10) var(--esp-12); }
  .titulo-vista h1 { font-size: var(--txt-3xl); }
  .toasts { bottom: var(--esp-6); left: calc(var(--ancho-lateral) + var(--esp-6)); }
}
