/* =============================================================================
   app.css — Complementos de la app funcional (NO pisa el design system).
   Solo componentes nuevos que no existían en la fase de wireframes.
   ============================================================================= */

/* --- Mensajes flash --------------------------------------------------------- */
.app-flash {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  border: 2px solid var(--neutral-900);
  box-shadow: 3px 3px 0 var(--neutral-900);
}
.app-flash--success { background: var(--success-100); color: #0a7355; }
.app-flash--error   { background: #FFE2E2; color: #B42323; }

/* --- Login ------------------------------------------------------------------ */
.auth-stage {
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(160deg, var(--primary-900) 0%, var(--accent-500) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
}
.auth-hero {
  width: 100%;
  max-width: 460px;
  text-align: center;
  color: var(--neutral-0);
  padding: var(--space-11) var(--space-6) var(--space-9);
}
.auth-hero__logo {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  letter-spacing: -0.03em;
}
.auth-hero__logo .dot { color: var(--gold-500); }
.auth-hero__tagline { opacity: 0.85; margin-top: var(--space-2); font-size: var(--text-base); }

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--neutral-0);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  margin-top: auto;
  padding: var(--space-7) var(--space-6) var(--space-9);
  box-shadow: var(--shadow-xl);
  flex: 1;
}
@media (min-width: 900px) {
  .auth-stage { justify-content: center; padding: var(--space-9) var(--space-4); }
  .auth-card  { margin-top: var(--space-6); border-radius: var(--radius-xl); flex: 0; }
}

.field { margin-bottom: var(--space-4); }
.field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--neutral-700);
  margin-bottom: 6px;
}
.field__control {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border: 2px solid var(--neutral-300);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  transition: border-color var(--transition-base);
}
.field__control:focus-within { border-color: var(--accent-500); }
.field__control i { color: var(--neutral-500); flex-shrink: 0; }
.field__control input {
  border: 0;
  outline: 0;
  flex: 1;
  padding: var(--space-3) 0;
  background: transparent;
  font-size: var(--text-base);
}

.btn-block {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--accent-500);
  color: var(--neutral-0);
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 2px solid var(--neutral-900);
  box-shadow: 3px 3px 0 var(--neutral-900);
  transition: transform var(--transition-fast);
}
.btn-block:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--neutral-900); }

.auth-error {
  background: #FFE2E2;
  color: #B42323;
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-4);
  text-align: center;
}

/* --- Header de sección (back + título) -------------------------------------- */
.screen-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--neutral-0);
  border-bottom: 1px solid var(--neutral-300);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.screen-header__back {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--neutral-100);
}
.screen-header__title { font-size: var(--text-xl); font-weight: var(--weight-bold); }

/* --- Form genérico de carga ------------------------------------------------- */
.form-card { background: var(--neutral-0); border-radius: var(--radius-lg); padding: var(--space-5); margin: var(--space-4); box-shadow: var(--shadow-sm); }
.form-card select,
.form-card input,
.form-card textarea {
  width: 100%;
  border: 2px solid var(--neutral-300);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-base);
  background: var(--neutral-0);
}
.form-card select:focus,
.form-card input:focus,
.form-card textarea:focus { outline: 0; border-color: var(--accent-500); }

/* --- Empty state ------------------------------------------------------------ */
.empty-state { text-align: center; padding: var(--space-9) var(--space-6); color: var(--neutral-500); }
.empty-state i { color: var(--neutral-300); margin-bottom: var(--space-3); }

/* =============================================================================
   APP REAL — sin chasis de celular (eso era solo preview de wireframes).
   Mobile: pantalla completa (ya lo hace base.css).
   Desktop: columna de app centrada y limpia, NADA de marco/notch/status bar.
   Estas reglas pisan el media query de preview de base.css.
   ============================================================================= */

/* La barra de estado simulada (9:41 + íconos) no va nunca en la app real. */
.status-bar { display: none !important; }

/* Bottom-nav: altura adaptable al safe-area REAL del dispositivo.
   El diseño original fijaba 64px + 34px (home indicator del iPhone); en
   pantallas sin esa barra (desktop, Android, PWA) sobraban 34px vacíos. */
.bottom-nav {
  height: auto;
  min-height: 58px;
  padding-top: 4px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
}

/* Marca del nav (logo lateral): solo visible en desktop. */
.nav-brand { display: none; }
/* Contenedor de contenido: full width en mobile. */
.app-content { width: 100%; }
.app-content__spacer { height: calc(72px + env(safe-area-inset-bottom, 0px)); }

/* =============================================================================
   DESKTOP (≥900px) — Plataforma web: sidebar a la izquierda + contenido ancho.
   En mobile NO aplica nada de esto: se mantiene la app a pantalla completa con
   bottom-nav (responsive intacto).
   ============================================================================= */
@media (min-width: 900px) {
  .stage {
    display: block;
    padding: 0;
    min-height: 100vh;
    background: var(--neutral-100);
  }

  /* El contenedor pasa a ser fila: [ sidebar | contenido ] a pantalla completa */
  .phone {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: row;
  }
  .phone::before { display: none !important; }
  .frame-label   { display: none !important; }

  /* El bottom-nav se transforma en SIDEBAR lateral */
  .bottom-nav {
    position: relative;
    order: -1;
    width: 248px;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: var(--space-5) var(--space-3);
    border-top: none;
    border-right: 1px solid var(--neutral-300);
    box-shadow: none;
    background: var(--neutral-0);
    flex: 0 0 248px;
  }
  .nav-brand {
    display: block;
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    letter-spacing: -0.02em;
    color: var(--neutral-900);
    padding: var(--space-2) var(--space-3) var(--space-6);
  }
  .nav-brand span { color: var(--gold-500); }

  .bottom-nav__item {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-3);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
  }
  .bottom-nav__item i { width: 22px; height: 22px; }
  .bottom-nav__item--active { background: var(--primary-100); color: var(--accent-500); }
  .bottom-nav__item--active::before { display: none; }
  .bottom-nav__badge { position: static; margin-left: auto; }

  /* Área principal scrollable, ocupa el resto del ancho */
  .screen { flex: 1; height: 100%; min-height: 0; }

  /* Contenido centrado a un ancho cómodo de lectura, con aire */
  .app-content {
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--space-6) var(--space-7) 0;
  }
  .app-content__spacer { height: var(--space-7); }

  /* Headers de pantalla: el padding lateral lo da app-content */
  .header-mobile,
  .screen-header {
    padding-left: 0;
    padding-right: 0;
    padding-top: var(--space-5);
  }
}
