/* ═══════════════════════════════════════════════════════════════
   XALO MOBILITY — Design System
   Tema oscuro · Acento #fe5000
   Compartido por entregas, login y futuros módulos
   ═══════════════════════════════════════════════════════════════ */

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #fe5000;
  --primary-dark:   #cc3f00;
  --primary-light:  rgba(254, 80, 0, 0.12);
  --primary-mid:    rgba(254, 80, 0, 0.28);

  /* Semánticos */
  --success:        #22c55e;
  --success-light:  rgba(34, 197, 94, 0.12);
  --success-mid:    rgba(34, 197, 94, 0.28);
  --error:          #f87171;
  --error-light:    rgba(248, 113, 113, 0.12);
  --warning:        #fbbf24;
  --warning-light:  rgba(251, 191, 36, 0.12);

  /*
   * Jerarquía de superficies (de más oscuro a más claro):
   * --header-bg  #000000  → negro puro: header, bottom nav, nav shell
   * --bg         #080808  → fondo de página/pantallas internas
   * --card       #141414  → tarjetas, listas, contenedores primarios
   * --card2      #1e1e1e  → sheets, modales, capas elevadas sobre --card
   */
  --bg:             #080808;
  --card:           #141414;
  --card2:          #1e1e1e;
  --header-bg:      #000000;

  /* Texto */
  --text:           #f0f0f0;
  --text2:          #cccccc;
  --muted:          #888888;
  --muted2:         #555555;

  /* Bordes */
  --border:         #252525;
  --border2:        #333333;

  /* Radios */
  --r:              14px;
  --r-sm:           8px;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

/* ── APP SHELL ───────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
}

/* ── HEADER ──────────────────────────────────────────────────── */
#app-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
  position: relative;
  z-index: 10;
}

.header-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.header-logo-img {
  height: 32px;
  width: auto;
  display: block;
  object-fit: contain;
}

.header-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.header-brand-main {
  font-size: .95rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.header-brand-sub {
  font-size: .65rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 900;
  flex-shrink: 0;
  letter-spacing: .01em;
}

.header-greeting {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.header-greeting-hello {
  font-size: .62rem;
  color: var(--muted);
  font-weight: 500;
}
.header-greeting-name {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: .7rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-logout:hover { color: var(--primary); border-color: var(--primary); }
.btn-logout svg { flex-shrink: 0; }

/* ── BOTTOM NAV ──────────────────────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--header-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
#bottom-nav.hidden { display: none; }

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 4px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: color .15s;
  color: var(--muted2);
  position: relative;
}
.nav-tab svg { width: 22px; height: 22px; transition: transform .2s; }
.nav-tab-label { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.nav-tab.active { color: var(--primary); }
.nav-tab.active svg { transform: scale(1.1); }
.nav-tab.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}

/* ── BOTONES ─────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--r-sm);
  padding: 0 20px;
  height: 52px;
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.btn-xl { height: 60px; font-size: 1rem; border-radius: var(--r); gap: 12px; }
.btn-full { width: 100%; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(254, 80, 0, .25);
}
.btn-primary:hover  { background: var(--primary-dark); }
.btn-primary:active { background: var(--primary-dark); transform: scale(.98); }

.btn-secondary {
  background: var(--card2);
  color: var(--text2);
  border: 1.5px solid var(--border2);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: none;
  height: 40px;
  padding: 0 12px;
  font-size: .82rem;
}
.btn-ghost:hover { color: var(--primary); }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.badge-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,.2); }
.badge-error   { background: var(--error-light);   color: var(--error);   border: 1px solid rgba(248,113,113,.2); }
.badge-warning { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(251,191,36,.2); }
.badge-muted   { background: var(--card2);         color: var(--muted);   border: 1px solid var(--border2); }

/* ── FORMULARIOS ─────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
.form-label .req { color: var(--primary); }

.input-text,
.input-full {
  height: 48px;
  border: 1.5px solid var(--border2);
  border-radius: var(--r-sm);
  padding: 0 14px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card2);
  outline: none;
  transition: border-color .15s;
}
.input-text  { flex: 1; }
.input-full  { width: 100%; }
.input-text:focus, .input-full:focus { border-color: var(--primary); }
.input-text::placeholder, .input-full::placeholder { color: var(--muted2); }

/* ── OVERLAYS / MODALES ──────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.modal-box {
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, .6);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
  transform: translateY(16px);
  transition: transform .2s;
}
.overlay.show .modal-box { transform: translateY(0); }

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-icon-error   { background: var(--error-light);   color: var(--error); }
.modal-icon-loading { background: var(--primary-light); }
.modal-icon-warning { background: var(--warning-light); color: var(--warning); }

.modal-title { font-size: 1rem;   font-weight: 800; color: var(--text); }
.modal-body  { font-size: .875rem; color: var(--muted); line-height: 1.6; }
.modal-btn-row { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.modal-ventana-info {
  background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.2);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  width: 100%;
  text-align: left;
}
.modal-ventana-info p    { margin: 0 0 4px; font-size: .75rem; color: var(--warning); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.modal-ventana-info span { font-size: .88rem; color: var(--text2); font-weight: 500; }

/* ── SPINNER ─────────────────────────────────────────────────── */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--primary-mid);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ───────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  background: var(--card2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 100px;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  z-index: 200;
  transition: opacity .25s ease, transform .25s cubic-bezier(.175,.885,.32,1.275);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
  pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── UTILIDADES ──────────────────────────────────────────────── */
.section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted2);
}

.empty-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 16px;
  color: var(--muted2);
  text-align: center;
  background: var(--card);
  border-radius: var(--r);
  border: 1px solid var(--border);
}
.empty-list svg { opacity: .3; }
.empty-list p   { font-size: .82rem; }

.loading-line {
  height: 32px;
  background: linear-gradient(90deg, var(--border) 25%, var(--card2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 6px;
  margin-bottom: 10px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.divider-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted2);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.divider-label::before,
.divider-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.mt-auto  { margin-top: auto; }
.flex-col { display: flex; flex-direction: column; gap: 12px; }
.two-col  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── DESKTOP: shell adaptaciones ────────────────────────────── */
@media (min-width: 768px) {
  /* Header: limitar ancho interior y centrar contenido */
  #app-header {
    padding: 0 max(24px, calc(50% - 560px));
    height: 68px;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  /* Bottom nav: altura generosa en desktop */
  #bottom-nav { height: 60px; }
  .nav-tab { padding: 8px 4px; }
  .nav-tab-label { font-size: .65rem; }

  /* Toast: sube un poco más en desktop */
  #toast { bottom: 72px; }
}
