/* ═══════════════════════════════════════════════════════════
   NAVI — Portal de Bros
   Pensado para el teléfono: el Bro trabaja en la calle, no en un escritorio.
   Mismos tokens que navi5web.com para que se sienta la misma marca.
   ═══════════════════════════════════════════════════════════ */

:root {
  --navy: #0A0F1E;
  --navy-2: #1A2240;
  --navy-3: #232C52;
  --teal: #00D4A0;
  --teal-bright: #00E5C0;
  --blue: #3D7BFF;
  --white: #FFFFFF;
  --text: #E8ECF6;
  --text-dim: #9AA5C0;
  --border: rgba(255, 255, 255, 0.08);
  --border-teal: rgba(0, 212, 160, 0.25);
  --glass: rgba(26, 34, 64, 0.72);
  --grad: linear-gradient(120deg, #00E5C0 0%, #00B4D8 50%, #3D7BFF 100%);
  --danger: #FF5D73;
  --danger-soft: rgba(255, 93, 115, 0.14);
  --warn: #FFC24B;
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  /* Alto de la barra inferior + zona segura del teléfono */
  --tabbar: calc(64px + env(safe-area-inset-bottom, 0px));
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--navy);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}

[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- Tipografía ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: 1.2; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; font-weight: 700; }
.dim { color: var(--text-dim); }
.small { font-size: 0.8rem; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 13px 20px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:active { transform: none; }
.btn--primary { background: var(--grad); color: var(--navy); }
.btn--ghost { background: transparent; border: 1px solid var(--border); color: var(--text); font-weight: 600; }
.btn--ghost:hover { border-color: var(--border-teal); }
.btn--danger { background: var(--danger-soft); border: 1px solid rgba(255,93,115,0.4); color: #FFC2CC; font-weight: 600; }
.btn--full { width: 100%; }
/* 44px es el mínimo cómodo para el pulgar: el Bro usa esto en la calle. */
.btn--sm { min-height: 44px; padding: 10px 16px; font-size: 0.84rem; }

/* ---------- Estructura ---------- */
.app { max-width: 560px; margin: 0 auto; padding-bottom: var(--tabbar); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--grad);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  flex-shrink: 0;
  object-fit: cover;
  border: 2px solid transparent;
}
.avatar--photo { background: var(--navy-3); }
.topbar__who { flex: 1; min-width: 0; }
.topbar__name { font-family: var(--font-display); font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__meta { font-size: 0.72rem; color: var(--text-dim); }

/* Interruptor de disponibilidad: la acción más importante del día */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 46px; height: 28px; border-radius: 999px;
  background: var(--navy-3); border: 1px solid var(--border);
  position: relative; transition: background 0.2s ease, border-color 0.2s ease;
}
.switch__track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--text-dim); transition: transform 0.2s ease, background 0.2s ease;
}
.switch input:checked + .switch__track { background: rgba(0,212,160,0.22); border-color: var(--border-teal); }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: var(--teal); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--teal); outline-offset: 2px; }
.switch__label { font-family: var(--font-display); font-weight: 700; font-size: 0.75rem; color: var(--text-dim); }
.switch input:checked ~ .switch__label { color: var(--teal); }

/* ---------- Vistas ---------- */
.view { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.view__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card--teal { border-color: var(--border-teal); }

/* ---------- Aviso de alertas apagadas ---------- */
.alertbar {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 194, 75, 0.1);
  border: 1px solid rgba(255, 194, 75, 0.35);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.alertbar__txt { flex: 1; font-size: 0.82rem; line-height: 1.45; }
.alertbar__txt b { color: var(--warn); }

/* ---------- Filas de lista (chats, solicitudes) ---------- */
.row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.row:active { transform: scale(0.99); }
.row:hover { border-color: var(--border-teal); }
.row--live { border-color: var(--teal); background: linear-gradient(180deg, rgba(0,212,160,0.07), var(--navy-2)); }
.row__main { flex: 1; min-width: 0; }
.row__title { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__sub { font-size: 0.76rem; color: var(--text-dim); margin-top: 2px; }
.row__go { color: var(--teal); font-weight: 800; flex-shrink: 0; }

.pill {
  font-family: var(--font-display); font-weight: 800; font-size: 0.68rem;
  border-radius: 999px; padding: 5px 10px; white-space: nowrap; flex-shrink: 0;
  letter-spacing: 0.02em;
}
.pill--live { background: var(--teal); color: var(--navy); }
.pill--off { background: rgba(255,255,255,0.06); color: var(--text-dim); border: 1px solid var(--border); }
.pill--wait { background: rgba(255,194,75,0.16); color: var(--warn); border: 1px solid rgba(255,194,75,0.35); }
.pill--ok { background: rgba(0,212,160,0.14); color: var(--teal-bright); border: 1px solid var(--border-teal); }

/* Punto que late en los chats en vivo */
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--navy); margin-right: 5px;
  animation: latir 1.4s ease-in-out infinite;
}
@keyframes latir { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Estados vacíos ---------- */
.empty { text-align: center; padding: 44px 20px; }
.empty__icon { font-size: 2.6rem; display: block; margin-bottom: 12px; opacity: 0.85; }
.empty__title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.empty__desc { font-size: 0.86rem; color: var(--text-dim); line-height: 1.6; max-width: 34ch; margin: 0 auto; }

/* ---------- Carga (esqueletos, no ruedas) ---------- */
.skeleton { background: var(--navy-2); border-radius: var(--radius-sm); height: 74px; animation: pulso 1.4s ease-in-out infinite; }
@keyframes pulso { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------- Ganancias ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--navy-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
}
.stat--wide { grid-column: 1 / -1; border-color: var(--border-teal); background: linear-gradient(160deg, rgba(0,212,160,0.1), var(--navy-2)); }
.stat__label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.stat__num { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; margin-top: 4px; }
.stat--wide .stat__num { font-size: 2.1rem; color: var(--teal); }
.stat__sub { font-size: 0.76rem; color: var(--text-dim); margin-top: 2px; }

.note {
  font-size: 0.78rem; color: var(--text-dim); line-height: 1.6;
  background: var(--navy-2); border: 1px dashed var(--border-teal);
  border-radius: var(--radius-sm); padding: 12px 14px;
}

/* ---------- Perfil ---------- */
.photo-edit { display: flex; align-items: center; gap: 16px; }
.photo-edit .avatar { width: 78px; height: 78px; font-size: 1.7rem; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.78rem; color: var(--text-dim); font-weight: 600; }
.field input, .field select, .field textarea {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.field__hint { font-size: 0.72rem; color: var(--text-dim); }
.field__count { font-size: 0.72rem; color: var(--text-dim); text-align: right; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Idiomas como fichas seleccionables */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--navy);
  border-radius: 999px; padding: 9px 14px; font-size: 0.84rem;
  cursor: pointer; transition: all 0.15s ease; min-height: 40px;
}
.chip[aria-pressed="true"] { background: rgba(0,212,160,0.14); border-color: var(--teal); color: var(--teal-bright); font-weight: 600; }

/* Medidor de perfil completo */
.meter { background: var(--navy-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.meter__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.meter__pct { font-family: var(--font-display); font-weight: 800; color: var(--teal); }
.meter__bar { height: 7px; background: var(--navy); border-radius: 999px; overflow: hidden; }
.meter__fill { height: 100%; background: var(--grad); border-radius: 999px; transition: width 0.4s ease; }
.meter__todo { font-size: 0.78rem; color: var(--text-dim); margin-top: 8px; line-height: 1.5; }

/* ---------- Barra inferior ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex;
  background: rgba(10, 15, 30, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  max-width: 560px; margin: 0 auto;
}
.tab {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 4px; color: var(--text-dim);
  font-family: var(--font-body); font-weight: 600; font-size: 0.68rem;
  position: relative; min-height: 60px; justify-content: center;
}
.tab__icon { font-size: 1.25rem; line-height: 1; }
.tab[aria-selected="true"] { color: var(--teal-bright); }
.tab[aria-selected="true"] .tab__icon { transform: translateY(-1px); }
.tab__badge {
  position: absolute; top: 6px; left: 50%; margin-left: 6px;
  min-width: 18px; height: 18px; border-radius: 999px;
  background: var(--danger); color: var(--white);
  font-family: var(--font-display); font-weight: 800; font-size: 0.65rem;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 100dvh; }
.chat__head {
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  border-bottom: 1px solid var(--border); background: var(--navy);
}
.iconbtn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--navy-2); border: 1px solid var(--border);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 1rem;
}
.timer {
  font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--teal); color: var(--navy);
  border-radius: 999px; padding: 5px 12px; font-size: 0.88rem; flex-shrink: 0;
}
.timer--low { background: var(--danger); color: var(--white); }
.msgs { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 9px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 0.92rem; line-height: 1.5; }
.msg--in { align-self: flex-start; background: var(--navy-2); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg--out { align-self: flex-end; background: var(--teal); color: var(--navy); border-bottom-right-radius: 5px; }
.msg--sys {
  align-self: center; background: rgba(0,212,160,0.08); border: 1px dashed var(--border-teal);
  color: var(--text-dim); font-size: 0.76rem; text-align: center; max-width: 92%;
}
.msg time { display: block; font-size: 0.63rem; opacity: 0.6; margin-top: 4px; text-align: right; }
.composer {
  display: flex; gap: 9px; padding: 11px 12px calc(11px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border); background: var(--navy-2);
}
.composer input {
  flex: 1; background: var(--navy); border: 1px solid var(--border);
  border-radius: 999px; padding: 13px 16px; font-size: 0.95rem; outline: none;
}
.composer input:focus { border-color: var(--teal); }
.composer button {
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: var(--grad); color: var(--navy); font-size: 1.05rem; cursor: pointer; flex-shrink: 0;
}
.composer input:disabled, .composer button:disabled { opacity: 0.45; }
.chat__locked {
  padding: 14px; background: var(--navy-2); border-top: 1px solid var(--border);
  text-align: center; font-size: 0.84rem; color: var(--text-dim);
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login__box { width: 100%; max-width: 400px; }
.login__brand { text-align: center; margin-bottom: 26px; }
.login__logo {
  display: inline-block; background: var(--grad); color: var(--navy);
  font-family: var(--font-display); font-weight: 800; font-size: 1.3rem;
  padding: 6px 16px; border-radius: 12px; margin-bottom: 12px;
}
.login__title { font-size: 1.3rem; margin-bottom: 6px; }
.login__sub { font-size: 0.88rem; color: var(--text-dim); line-height: 1.55; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login__foot { margin-top: 20px; text-align: center; font-size: 0.82rem; color: var(--text-dim); line-height: 1.6; }
.login__foot a { color: var(--teal); font-weight: 600; }

/* ---------- Aviso flotante ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--tabbar) + 14px); z-index: 60;
  background: var(--navy-3); border: 1px solid var(--border-teal);
  border-radius: 999px; padding: 12px 20px; font-size: 0.86rem; font-weight: 600;
  max-width: min(92vw, 420px); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 14px 40px rgba(0,0,0,0.5);
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--bad { border-color: rgba(255,93,115,0.5); }

/* ---------- Escritorio: dos columnas ---------- */
@media (min-width: 900px) {
  .app { max-width: 1080px; padding-bottom: 24px; }
  .tabbar { max-width: 1080px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .stat--wide { grid-column: span 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::after { animation: none !important; transition: none !important; }
}
