/* ===== Fuente Hanson ===== */
@font-face {
  font-family: 'Hanson';
  src: url('../fonts/Hanson-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --maroon:      #9b3d50;
  --maroon-dark: #7e3141;
  --maroon-mid:  #b04e63;
  --white:       #ffffff;
  --ink:         #1d1d1d;
  --field-bg:    rgba(255,255,255,0.15);
  --field-bg-focus: rgba(255,255,255,0.25);

  --font-title: 'Hanson', 'Arial Black', Arial, sans-serif;
  --font-body:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0; padding: 0;
  width: 100%;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ===== Contenedor móvil ===== */
body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
  background: #111;
}

.phone {
  position: relative;
  width: 100%;
  max-width: 420px;
  min-height: 100vh;
  background: var(--maroon);
  overflow: hidden;
}

@media (min-width: 480px) {
  body { padding: 24px 0; background: #1a1a1a; }
  .phone {
    min-height: 760px;
    max-height: calc(100vh - 48px);
    border-radius: 32px;
    box-shadow: 0 32px 64px rgba(0,0,0,.55);
  }
}

/* ===== Sistema de pantallas ===== */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--safe-top) + 48px) 36px calc(var(--safe-bottom) + 32px);
  opacity: 0;
  transition: opacity .3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.is-active { display: flex; opacity: 1; }

.screen--maroon { background: var(--maroon); color: var(--white); }
.screen--white  { background: var(--white);  color: var(--ink);   }

/* ===== Logo PNG ===== */
.logo {
  display: block;
  object-fit: contain;
  width: auto;
}
/* Logo en fondos oscuros (maroon): forzar blanco */
.screen--maroon .logo {
  filter: brightness(0) invert(1);
}
/* Logo en fondos blancos: sin filtro */
.screen--white .logo { filter: none; }

.logo--big { height: 110px; max-width: 180px; }
.logo--md  { height: 110px; max-width: 170px; }
.logo--sm  { height:  90px; max-width: 140px; }

/* ===== Splash ===== */
.splash {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 52px;
  width: 100%;
}

/* Logo splash: fade+scale d'entrada, rotació lenta contínua */
.splash .logo {
  animation:
    logoIn   0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    logoSpin 12s linear 0.9s infinite;
  transform-origin: center center;
}

@keyframes logoIn {
  from { opacity: 0; transform: scale(0.55); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes logoSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.loader {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.8);
  border-top-color: transparent;
  border-right-color: transparent;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.from-mark {
  margin: 0;
  padding-top: 10px;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: .05em;
  color: var(--white);
  opacity: .85;
  text-align: center;
  line-height: 1.2;
}
.from-mark strong {
  display: block;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .14em;
  margin-top: 5px;
  opacity: 1;
}
.screen--white .from-mark { color: var(--ink); }

/* ===== Auth (login / register) ===== */
.auth {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 8px 0 4px;
}

.auth-title {
  margin: 20px 0 30px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .16em;
  color: var(--white);
  text-align: center;
  line-height: 1;
}

/* ===== Formularios ===== */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.field { display: block; width: 100%; }
.field input {
  width: 100%;
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,.6);
  background: var(--field-bg);
  color: var(--white);
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition: background .18s ease, border-color .18s ease;
}
.field input::placeholder {
  color: rgba(255,255,255,.65);
  font-weight: 300;
}
.field input:focus {
  background: var(--field-bg-focus);
  border-color: rgba(255,255,255,.9);
}
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--white);
  -webkit-box-shadow: 0 0 0 1000px var(--maroon) inset;
  caret-color: var(--white);
}

/* ===== Botón pill ===== */
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 44px;
  margin: 24px 0 0;
  padding: 0 28px;
  border-radius: 999px;
  border: 1.5px solid var(--white);
  background: transparent;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .04em;
  transition: background .18s ease, transform .12s ease;
}
.pill-btn:hover  { background: rgba(255,255,255,.15); }
.pill-btn:active { transform: scale(.97); }

/* Variante outline (pantallas blancas) */
.pill-btn--outline {
  border-color: var(--maroon);
  background: var(--white);
  color: var(--maroon);
  width: auto;
  min-width: 120px;
}
.pill-btn--outline:hover { background: #fdf0f2; }

.pill-btn--end {
  margin-top: auto;
  align-self: flex-end;
  margin-right: 0;
  margin-bottom: 0;
}

/* ===== Links debajo del login ===== */
.auth-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  font-size: 13px;
  color: rgba(255,255,255,.85);
}
.auth-links a {
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: opacity .15s ease;
}
.auth-links a:hover { opacity: .75; }

/* ===== Toggle Usuari / Empresa ===== */
.role-toggle {
  display: inline-flex;
  margin: 0 0 24px;
  padding: 3px;
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  gap: 2px;
}
.role {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.8);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.role.is-active {
  background: var(--white);
  color: var(--maroon);
}

/* ===== Onboarding ===== */
.screen--onboard {
  padding: 0;
  flex-direction: column;
  align-items: stretch;
}

.illus-frame {
  width: 100%;
  height: 52%;
  flex-shrink: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: none;
  box-shadow: none;
  outline: none;
  margin-bottom: -1px;
  position: relative;
}
.illus-frame::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: linear-gradient(to bottom, transparent, #ffffff);
  pointer-events: none;
}

.illus--video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.illus--img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
}

.onboard-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px 36px calc(var(--safe-bottom) + 36px);
}

.onboard-text {
  margin: 0 0 18px;
  text-align: left;
  width: 100%;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

/* ===== Chips de preferencias ===== */
.prefs {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 24px;
}
.chip {
  border: 1.5px solid var(--maroon);
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.chip:hover { background: #fdf0f2; }
.chip:active { transform: scale(.95); }
.chip.is-selected { background: var(--maroon); color: var(--white); border-color: var(--maroon); }

.onboard-body .pill-btn--outline {
  margin-top: auto;
  align-self: flex-end;
  width: auto;
}

/* ===== Animación entrada suave ===== */
.screen.is-active .auth,
.screen.is-active .onboard {
  animation: fadeSlide .35s ease both;
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
