/* =============================================================
   MisEstrellas — hoja de estilos única
   Minimalista. Solo lo necesario. Botones grandes donde importa.
   Un solo idioma: español.
   ============================================================= */

:root {
  --naranja: #FF8C42;
  --naranja-fuerte: #FF7A24;
  --naranja-suave: rgba(255, 140, 66, 0.12);

  --fondo: #121212;
  --superficie: #1C1C1C;
  --superficie-alta: #262626;
  --borde: #2E2E2E;

  --texto: #FFFFFF;
  --texto-medio: #A8A8A8;
  --texto-suave: #6E6E6E;

  --verde: #35C759;
  --rojo: #FF4D4F;
  --amarillo: #FFB020;

  --r: 16px;
  --r-chico: 12px;
  --sombra: 0 8px 32px rgba(0, 0, 0, 0.45);

  --ancho: 480px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

/* ---------- Estructura ---------- */

.pantalla {
  max-width: var(--ancho);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 88px; /* espacio para la barra inferior */
}

.pantalla.sin-barra { padding-bottom: 24px; }

.contenido { flex: 1; padding: 0 20px; }

/* ---------- Encabezado ---------- */

.encabezado {
  padding: 24px 20px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.encabezado h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.6px;
  flex: 1;
}

.encabezado .sub {
  font-size: 14px;
  color: var(--texto-medio);
  font-weight: 400;
  margin-top: 2px;
}

.volver {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--superficie);
  border: 1px solid var(--borde);
  color: var(--texto);
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.volver:active { background: var(--superficie-alta); }

/* ---------- Botones ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 16px 24px;
  border: none;
  border-radius: var(--r);
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.12s;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-principal { background: var(--naranja); color: #1A1A1A; }
.btn-principal:active:not(:disabled) { background: var(--naranja-fuerte); }

.btn-secundario {
  background: var(--superficie);
  color: var(--texto);
  border: 1px solid var(--borde);
}

.btn-texto {
  background: none;
  color: var(--texto-medio);
  min-height: 48px;
  font-weight: 500;
  font-size: 15px;
}

.btn-peligro { background: transparent; color: var(--rojo); border: 1px solid rgba(255,77,79,0.3); }

/* El botón gigante: el que el mesero y el cliente usan todo el día */
.btn-gigante {
  min-height: 76px;
  font-size: 19px;
  font-weight: 700;
  border-radius: 20px;
}

/* ---------- Campos ---------- */

.campo { margin-bottom: 18px; }

.campo label {
  display: block;
  font-size: 14px;
  color: var(--texto-medio);
  margin-bottom: 8px;
  font-weight: 500;
}

.campo input, .campo select, .campo textarea {
  width: 100%;
  padding: 17px 18px;
  background: var(--superficie);
  border: 1.5px solid var(--borde);
  border-radius: var(--r-chico);
  color: var(--texto);
  font-size: 17px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.campo input:focus, .campo select:focus, .campo textarea:focus {
  border-color: var(--naranja);
}

.campo input::placeholder { color: var(--texto-suave); }
.campo input[readonly] { opacity: 0.55; }
.campo textarea { resize: vertical; min-height: 96px; }

.ayuda { font-size: 13px; color: var(--texto-suave); margin-top: 7px; }

/* Campo de dinero: grande, para que el mesero no se equivoque */
.campo-dinero input {
  font-size: 34px;
  font-weight: 700;
  text-align: center;
  padding: 22px 18px;
  letter-spacing: -0.5px;
}

/* Código de 6 dígitos */
.campo-codigo input {
  font-size: 30px;
  text-align: center;
  letter-spacing: 12px;
  font-weight: 700;
  padding: 20px 12px;
}

/* ---------- Tarjetas ---------- */

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 14px;
}

.tarjeta-toca { cursor: pointer; transition: background 0.15s; }
.tarjeta-toca:active { background: var(--superficie-alta); }

/* Tarjeta de puntos de un restaurante */
.tarjeta-puntos {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.tarjeta-puntos.urgente { border-color: rgba(255,176,32,0.5); }
.tarjeta-puntos.vencida { opacity: 0.5; }
.tarjeta-puntos.pausada { border-color: rgba(255,140,66,0.4); }

.tp-arriba { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.tp-nombre { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.tp-visitas { font-size: 13px; color: var(--texto-suave); margin-top: 3px; }

.tp-plata { text-align: right; flex-shrink: 0; }
.tp-pesos { font-size: 27px; font-weight: 800; color: var(--naranja); letter-spacing: -0.8px; }
.tp-puntos { font-size: 13px; color: var(--texto-medio); margin-top: 1px; }

.tp-abajo {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--borde);
  display: flex; align-items: center; gap: 8px;
  font-size: 14px;
}

.tp-vence { color: var(--texto-medio); }
.tp-vence.urgente { color: var(--amarillo); font-weight: 600; }
.tp-vence.vencida { color: var(--rojo); }

/* Aviso de puntos que aún no se pueden usar */
.tp-pendiente {
  margin-top: 12px;
  padding: 11px 14px;
  background: var(--naranja-suave);
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--naranja);
  line-height: 1.4;
}

/* Aviso de restaurante pausado */
.tp-pausada {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(255,140,66,0.1);
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--naranja);
  line-height: 1.45;
}

/* ---------- Total grande ---------- */

.total {
  text-align: center;
  padding: 20px 0 32px;
}
.total .etiqueta { font-size: 14px; color: var(--texto-medio); margin-bottom: 8px; }
.total .valor {
  font-size: 52px; font-weight: 800; color: var(--naranja);
  letter-spacing: -2px; line-height: 1;
}
.total .detalle { font-size: 14px; color: var(--texto-suave); margin-top: 10px; }

/* ---------- Cifras (admin) ---------- */

.cifras { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }

.cifra {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--r-chico);
  padding: 18px 16px;
}
.cifra .n { font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.cifra .t { font-size: 13px; color: var(--texto-medio); margin-top: 5px; line-height: 1.3; }
.cifra.destacada .n { color: var(--naranja); }

/* ---------- Listas ---------- */

.fila {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--borde);
  cursor: pointer;
}
.fila:last-child { border-bottom: none; }
.fila:active { opacity: 0.7; }

.fila-inicial {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--superficie-alta);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; color: var(--naranja);
  flex-shrink: 0;
}
.fila-medio { flex: 1; min-width: 0; }
.fila-titulo { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-sub { font-size: 13.5px; color: var(--texto-suave); margin-top: 2px; }
.fila-derecha { text-align: right; flex-shrink: 0; }
.fila-valor { font-weight: 700; font-size: 17px; color: var(--naranja); }
.fila-nota { font-size: 12.5px; color: var(--texto-suave); margin-top: 2px; }

/* ---------- Etiquetas ---------- */

.etiq {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.etiq-verde { background: rgba(53,199,89,0.15); color: var(--verde); }
.etiq-naranja { background: var(--naranja-suave); color: var(--naranja); }
.etiq-gris { background: var(--superficie-alta); color: var(--texto-suave); }
.etiq-roja { background: rgba(255,77,79,0.15); color: var(--rojo); }

/* ---------- Vacío ---------- */

.vacio { text-align: center; padding: 56px 24px; }
.vacio .icono { font-size: 46px; margin-bottom: 16px; opacity: 0.35; }
.vacio h3 { font-size: 18px; margin-bottom: 8px; font-weight: 600; }
.vacio p { color: var(--texto-medio); font-size: 15px; line-height: 1.5; margin-bottom: 24px; }

/* ---------- Barra inferior ---------- */

.barra {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: var(--ancho);
  margin: 0 auto;
  background: rgba(18,18,18,0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--borde);
  display: flex;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 50;
}

.barra a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0;
  color: var(--texto-suave);
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 500;
}
.barra a.activo { color: var(--naranja); }
.barra a .ico { font-size: 21px; line-height: 1; }

/* ---------- Acción fija abajo ---------- */

.accion-fija {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 16px 20px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--fondo) 62%, transparent);
  z-index: 40;
}

/* ---------- Modal ---------- */

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}
.modal.abierto { display: flex; }

.modal-caja {
  background: var(--superficie);
  border-radius: 24px 24px 0 0;
  padding: 28px 22px max(28px, env(safe-area-inset-bottom));
  width: 100%;
  max-width: var(--ancho);
  max-height: 92vh;
  overflow-y: auto;
  animation: subir 0.24s ease-out;
}

@keyframes subir { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-titulo { font-size: 21px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.4px; }
.modal-texto { color: var(--texto-medio); font-size: 15px; margin-bottom: 22px; line-height: 1.5; }
.modal-botones { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

/* ---------- Avisos ---------- */

.me-aviso {
  position: fixed;
  top: 16px; left: 16px; right: 16px;
  max-width: 448px;
  margin: 0 auto;
  padding: 15px 18px;
  border-radius: var(--r-chico);
  font-size: 15px;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--sombra);
  transform: translateY(-140%);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  line-height: 1.4;
}
.me-aviso.visible { transform: translateY(0); }
.me-aviso-info { background: var(--superficie-alta); color: var(--texto); border: 1px solid var(--borde); }
.me-aviso-ok { background: var(--verde); color: #06280F; }
.me-aviso-error { background: var(--rojo); color: #fff; }

/* ---------- Cargando ---------- */

.me-cargando {
  position: fixed; inset: 0;
  background: rgba(18,18,18,0.9);
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  z-index: 300;
}
/* El logo aparece encima del círculo que gira, con un latido suave */
.me-cargando::before {
  content: '';
  width: 68px; height: 68px;
  background: url('../images/logo-me-256.png') center / contain no-repeat;
  animation: latir 1.6s ease-in-out infinite;
}
@keyframes latir {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(0.92); opacity: 0.75; }
}
@media (prefers-reduced-motion: reduce) {
  .me-cargando::before { animation: none; }
}

.me-cargando p { color: var(--texto-medio); font-size: 15px; }

.me-spinner {
  width: 42px; height: 42px;
  border: 3px solid var(--borde);
  border-top-color: var(--naranja);
  border-radius: 50%;
  animation: girar 0.8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.cargando-linea { text-align: center; padding: 48px 0; color: var(--texto-suave); font-size: 15px; }

/* ---------- Utilidades ---------- */

.oculto { display: none !important; }
.centro { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }

.seccion-titulo {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--texto-suave);
  font-weight: 600;
  margin: 28px 0 12px;
}

/* ---------- La marca ---------- */

.logo-me { font-size: 27px; font-weight: 800; letter-spacing: -0.8px; }
.logo-me span { color: var(--naranja); }

/* La estrella grande de la pantalla de ingreso */
.logo-estrella {
  display: block;
  width: 108px; height: 108px;
  margin: 0 auto 14px;
  filter: drop-shadow(0 6px 20px rgba(255, 140, 66, 0.28));
}

/* La estrella pequeña que acompaña el título de una pantalla */
.logo-mini {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: block;
}

/* La estrella sobre el QR del mesero */
.logo-qr {
  width: 44px; height: 44px;
  display: block;
  margin: 0 auto 12px;
}

.nota-legal { font-size: 12.5px; color: var(--texto-suave); text-align: center; line-height: 1.6; }
.nota-legal a { color: var(--texto-medio); }

/* Botón fijo cuando la página TAMBIÉN tiene barra inferior */
.accion-fija.sobre-barra {
  bottom: calc(62px + env(safe-area-inset-bottom));
}
