/* ============================================================
   style.css — Coem Crea
   Tokens de marca (--cc-) + base + componentes compartidos.
   ADN: Coem Market, variante "taller de noche".
   Regla: ningún color suelto en componentes — todo por tokens.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;1,400&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&display=swap');

:root {
  /* FONDOS Y SUPERFICIES */
  --cc-fondo:          #1e1005;
  --cc-superficie:     #2c1b0c;
  --cc-superficie-2:   #3a2c14;
  --cc-borde:          rgba(245, 237, 216, 0.12);
  --cc-borde-card:     rgba(252, 244, 212, 0.10);
  --cc-borde-fuerte:   rgba(252, 244, 212, 0.30);
  --cc-velo:           rgba(30, 16, 5, 0.72);

  /* TEXTO */
  --cc-crema:          #fcf4d4;
  --cc-crema-suave:    #f5edd8;
  --cc-crema-mute:     rgba(252, 244, 212, 0.62);
  --cc-crema-tenue:    rgba(252, 244, 212, 0.50);   /* 0.50 = contraste AA (4.9:1) para ayudas chicas */

  /* ACENTOS */
  --cc-naranja:        #f05404;
  --cc-naranja-hover:  #d94a03;
  --cc-naranja-suave:  rgba(240, 84, 4, 0.14);
  --cc-terracota:      #c4622d;
  --cc-dorado:         #b8933a;
  --cc-dorado-suave:   rgba(184, 147, 58, 0.16);

  /* SISTEMA */
  --cc-success:        #1D9E75;
  --cc-warning:        #854F0B;
  --cc-error:          #993C1D;
  --cc-error-suave:    rgba(153, 60, 29, 0.22);

  /* TIPOGRAFÍA */
  --cc-font-serif:     'Playfair Display', Georgia, serif;
  --cc-font-sans:      'DM Sans', system-ui, sans-serif;

  /* RADIOS */
  --cc-radius-sm:      4px;
  --cc-radius-md:      10px;
  --cc-radius-lg:      16px;
  --cc-radius-xl:      24px;
  --cc-radius-pill:    50px;

  /* SOMBRAS Y MOVIMIENTO */
  --cc-shadow-md:      0 12px 32px rgba(0, 0, 0, 0.35);
  --cc-glow-accion:    0 8px 24px rgba(240, 84, 4, 0.25);
  --cc-ring:           0 0 0 3px rgba(240, 84, 4, 0.22);
  --cc-trans:          0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── BASE ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--cc-font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--cc-crema);
  background: var(--cc-fondo);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--cc-font-sans); color: inherit; }
a { color: var(--cc-crema); text-decoration: none; border-bottom: 1px solid var(--cc-terracota); transition: var(--cc-trans); }
a:hover { color: var(--cc-naranja); border-bottom-color: var(--cc-naranja); }

::selection { background: var(--cc-naranja); color: var(--cc-crema); }

.page-wrapper {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── TIPOGRAFÍA DE MARCA ───────────────────────────────── */
.brand-phrase {
  font-family: var(--cc-font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.125rem;
  color: var(--cc-crema-mute);
  line-height: 1.4;
}

.screen-title {
  font-family: var(--cc-font-serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--cc-crema);
}

.subtitle {
  font-size: 1rem;
  color: var(--cc-crema-mute);
  line-height: 1.5;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cc-terracota);
  text-align: center;
  margin-bottom: 16px;
}

/* ── LOCKUP DE MARCA ───────────────────────────────────── */
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 0;
}
.brand:hover { border: 0; }
.brand__mark {
  height: 20px;
  width: auto;
  display: block;
  transform: translateY(2px);
}
.brand__word {
  font-family: var(--cc-font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--cc-crema);
}
.brand--lg .brand__mark { height: 34px; transform: translateY(4px); }
.brand--lg .brand__word { font-size: 2.25rem; }

/* ── TOPBAR ────────────────────────────────────────────── */
.topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 0;
  position: relative;
  z-index: 2;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--cc-crema-mute);
}

.topbar__avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--cc-superficie-2);
  border: 1px solid var(--cc-borde);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--cc-crema);
  flex-shrink: 0;
}

/* ── BOTONES ───────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  background: var(--cc-naranja);
  border: none;
  border-radius: var(--cc-radius-pill);
  padding: 16px 32px;
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--cc-crema);
  letter-spacing: 0.01em;
  transition: var(--cc-trans);
  box-shadow: var(--cc-glow-accion);
}
.btn-primary:hover {
  background: var(--cc-naranja-hover);
  transform: translateY(-2px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-primary .btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--cc-borde-fuerte);
  border-radius: var(--cc-radius-pill);
  padding: 11px 24px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--cc-crema);
  transition: var(--cc-trans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-secondary:hover {
  border-color: var(--cc-crema);
  transform: translateY(-1px);
}

.btn-ghost {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--cc-terracota);
  border-radius: 0;
  padding: 2px 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--cc-crema);
  transition: var(--cc-trans);
}
.btn-ghost:hover { color: var(--cc-naranja); border-bottom-color: var(--cc-naranja); }

.btn-logout {
  background: transparent;
  border: 1px solid var(--cc-borde);
  border-radius: var(--cc-radius-pill);
  padding: 7px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--cc-crema-mute);
  transition: var(--cc-trans);
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-logout svg {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none; stroke-width: 2; stroke-linecap: round;
}
.btn-logout:hover { color: var(--cc-crema); border-color: var(--cc-borde-fuerte); }

/* ── SPINNER ───────────────────────────────────────────── */
.spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid var(--cc-crema-tenue);
  border-top-color: var(--cc-crema);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}
.loading .spinner { display: block; }
.loading .btn-text { opacity: 0.75; }

/* ── CAMPOS ────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--cc-crema-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-left: 2px;
}

.field-wrap { position: relative; }

.field-input {
  width: 100%;
  background: var(--cc-superficie-2);
  border: 1px solid var(--cc-borde);
  border-radius: var(--cc-radius-md);
  padding: 13px 16px 13px 44px;
  font-family: var(--cc-font-sans);
  font-size: 1rem;
  color: var(--cc-crema);
  outline: none;
  transition: var(--cc-trans);
}
.field-input::placeholder { color: var(--cc-crema-tenue); }
.field-input:focus {
  border-color: var(--cc-naranja);
  box-shadow: var(--cc-ring);
}

.field-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  stroke: var(--cc-crema-tenue);
  fill: none; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
  transition: stroke var(--cc-trans);
}
.field-wrap:focus-within .field-icon { stroke: var(--cc-naranja); }

/* ── ERROR ─────────────────────────────────────────────── */
.error-msg {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--cc-error-suave);
  border: 1px solid var(--cc-error);
  border-radius: var(--cc-radius-md);
  padding: 11px 14px;
  font-size: 0.875rem;
  color: var(--cc-crema);
  margin-bottom: 16px;
}
.error-msg.visible {
  display: flex;
  animation: shake 0.4s ease;
}
.error-msg svg {
  width: 16px; height: 16px;
  stroke: var(--cc-crema); fill: none;
  stroke-width: 2; stroke-linecap: round; flex-shrink: 0;
}

/* ── HINT DE VALIDACIÓN ────────────────────────────────── */
.validation-hint {
  text-align: center;
  font-size: 0.875rem;
  color: var(--cc-crema-mute);
  min-height: 22px;
  margin-top: 12px;
  transition: opacity var(--cc-trans);
}
.validation-hint.error { color: var(--cc-crema); font-weight: 500; }

/* ── BARRA DE PROGRESO ─────────────────────────────────── */
.progress-wrap { width: 100%; margin-top: 20px; display: none; }
.progress-wrap.visible { display: block; }
.progress-bar-bg {
  background: var(--cc-superficie-2);
  border-radius: var(--cc-radius-pill);
  height: 6px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--cc-naranja);
  border-radius: var(--cc-radius-pill);
  width: 0%;
  transition: width 0.4s ease;
}
.progress-label {
  text-align: center;
  font-size: 0.875rem;
  color: var(--cc-crema-mute);
  margin-top: 8px;
}

/* ── DIVISOR ───────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 20px 0;
}
.divider__line { flex: 1; height: 1px; background: var(--cc-borde); }
.divider__dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--cc-terracota);
}

/* ── TOAST ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--cc-superficie-2);
  color: var(--cc-crema);
  padding: 12px 22px;
  border-radius: var(--cc-radius-pill);
  font-size: 0.875rem;
  z-index: 999;
  opacity: 0;
  transition: var(--cc-trans);
  white-space: nowrap;
  border: 1px solid var(--cc-borde);
  box-shadow: var(--cc-shadow-md);
}
.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast--error { border-color: var(--cc-error); background: var(--cc-error-suave); }

/* ── CHIP ──────────────────────────────────────────────── */
.chip {
  display: inline-block;
  background: var(--cc-superficie-2);
  border: 1px solid var(--cc-borde);
  border-radius: var(--cc-radius-sm);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cc-crema-suave);
}

@media (max-width: 480px) {
  .page-wrapper { padding: 0 12px 56px; }
  .brand--lg .brand__mark { height: 28px; }
  .brand--lg .brand__word { font-size: 1.85rem; }
}
