/* =========================================================
   auth.css — Login, registro, perfil + modal de producto
   v2.1 — Split-screen desktop + pill FAB mobile
   ========================================================= */

/* ================================================================
   ANIMACIONES
   ================================================================ */
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ---- Página base ---- */
.auth-page {
  min-height: 100dvh;
  background: var(--bg);
}

/* ================================================================
   SPLIT-SCREEN LAYOUT
   Desktop: 50% imagen | 50% formulario
   Móvil: imagen de fondo + tarjeta flotante centrada
   ================================================================ */

/* El <main> es el contenedor split en desktop */
.auth-main {
  display: flex;
  flex-direction: row;
  min-height: calc(100dvh - var(--nav-h));
}

/* ---- Mitad izquierda: imagen con blur ---- */
.auth-split-img {
  display: none; /* oculto en móvil */
  flex: 0 0 50%;
  position: relative;
  overflow: hidden;
  /* Sin background aquí: lo pone ::before para poder blurearlo */
}
/* Imagen borrosa de fondo (inset negativo para ocultar bordes del blur) */
.auth-split-img::before {
  content: '';
  position: absolute;
  inset: -24px;
  background-image: url('https://images.unsplash.com/photo-1513104890138-7c749659a591?w=900&q=80');
  background-size: cover;
  background-position: center;
  filter: blur(7px);
  z-index: 0;
}
.auth-split-img-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    160deg,
    rgba(10, 25, 5, .60) 0%,
    rgba(0, 0, 0, .42) 50%,
    rgba(30, 55, 12, .65) 100%
  );
}
/* Logo centrado, grande y nítido sobre el fondo borroso */
.auth-split-img-brand {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px;
  text-align: center;
}
.auth-logo-hero {
  width: min(340px, 70%);
  opacity: .95;
  /* Nítido: sin filtro blur heredado del padre */
  filter: drop-shadow(0 4px 24px rgba(0,0,0,.4));
}
.auth-logo-sub {
  color: rgba(255,255,255,.80);
  font-size: 1rem;
  letter-spacing: .12em;
  font-weight: 500;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  text-transform: uppercase;
}

/* ---- Mitad derecha: panel del formulario ---- */
.auth-split-panel {
  flex: 0 0 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 4vw, 60px) clamp(20px, 5vw, 72px);
  overflow-y: auto;
  background: var(--bg-elev);
}

/* ---- Tarjeta de formulario ---- */
.auth-card {
  background: var(--bg-elev);
  width: 100%;
  max-width: 400px;
  animation: authCardIn .42s cubic-bezier(.2,.7,.3,1) both;
  /* En desktop el panel ya tiene fondo blanco; sin borde ni sombra extra */
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.auth-card--wide { max-width: 680px; }

/* ---- Título y subtítulo ---- */
.auth-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.auth-sub {
  color: var(--text-muted);
  font-size: .9rem;
  margin: 0 0 32px;
}

/* ---- Tabs ---- */
.auth-tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  padding: 4px;
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 0;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  border-radius: 999px;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  cursor: pointer;
}
.auth-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(88,121,59,.35);
}

/* ---- Panels ---- */
.auth-panel.hidden { display: none; }

/* ---- Google button ---- */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 0 20px;
  background: #fff;
  border: 1.5px solid #E0E0E0;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition:
    border-color var(--t-fast),
    box-shadow var(--t-fast),
    transform var(--t-spring);
}
@media (hover: hover) and (pointer: fine) {
  .btn-google:hover {
    border-color: #C0C0C0;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    transform: translateY(-2px);
  }
}
.btn-google:active { transform: scale(.98); }

/* ---- Divider ---- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-dim);
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---- Campos ---- */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}
.field-group label {
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}
.field-group input,
.field-group textarea {
  background: #F9FAFB;
  border: 1.5px solid #E5E7EB;
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0 16px;
  font-size: .95rem;
  font-family: var(--font-body);
  width: 100%;
  height: 52px;
  transition:
    border-color .16s ease,
    box-shadow .16s ease,
    background .16s ease;
  outline: none;
}
.field-group textarea { height: auto; padding: 14px 16px; resize: vertical; }
.field-group input:focus,
.field-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}
.field-group input[readonly]  { opacity: .55; cursor: default; }
.field-group input:invalid:not(:placeholder-shown) { border-color: var(--danger); }

/* Wrapper para toggle visibilidad contraseña */
.field-pw-wrap { position: relative; display: flex; }
.field-pw-wrap input { flex: 1; padding-right: 48px; }
.field-pw-toggle {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 48px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--text-dim); cursor: pointer; font-size: .9rem;
  transition: color var(--t-fast);
}
.field-pw-toggle:hover { color: var(--accent); }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
@media (max-width: 540px) {
  .field-row { grid-template-columns: 1fr; }
}

.req { color: var(--accent); }
.opt { color: var(--text-dim); font-size: .72rem; text-transform: none; letter-spacing: 0; }

/* ---- Error ---- */
.auth-error {
  background: rgba(192,57,43,.07);
  border: 1px solid rgba(192,57,43,.25);
  color: #b83228;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: .86rem;
  font-weight: 600;
  margin-bottom: 14px;
}

/* ---- Forgot ---- */
.auth-forgot {
  text-align: right;
  margin: -6px 0 14px;
  font-size: .82rem;
}
.auth-forgot a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--t-fast);
}
.auth-forgot a:hover { text-decoration-color: var(--accent); }

/* btn block con efecto hundimiento */
.btn-block { width: 100%; justify-content: center; }
.btn.btn-primary.btn-block {
  min-height: 52px;
  font-size: .9rem;
  letter-spacing: .06em;
  border-radius: 12px;
}
.btn.btn-primary.btn-block:active { transform: scale(.98) !important; }

/* ---- User badge + logout in nav ---- */
.user-badge {
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  padding: 4px 10px;
  border: 1px solid rgba(88,121,59,.3);
  border-radius: 999px;
  background: var(--accent-light);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
@media (hover: hover) and (pointer: fine) {
  .btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(192,57,43,.06);
  }
}

/* ================================================================
   DESKTOP: mostrar imagen izquierda
   ================================================================ */
@media (min-width: 900px) {
  .auth-page { background: var(--bg-soft); }
  .auth-split-img { display: block; }
  .auth-split-panel {
    box-shadow: none;
  }
}

/* ================================================================
   MÓVIL: imagen de fondo completa + tarjeta flotante
   ================================================================ */
@media (max-width: 899px) {
  .auth-page {
    background-image: url('https://images.unsplash.com/photo-1513104890138-7c749659a591?w=900&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
  }

  .auth-main {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - var(--nav-h));
    padding: clamp(20px, 5vw, 48px) 16px clamp(32px, 8vw, 64px);
    /* Oscurecer el fondo */
    background: rgba(0, 0, 0, .52);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }

  .auth-split-img { display: none !important; }
  .auth-split-panel {
    width: 100%;
    max-width: 440px;
    padding: 0;
    background: transparent;
  }

  .auth-card {
    background: #fff;
    border-radius: 24px;
    padding: clamp(24px, 6vw, 40px);
    border: none;
    box-shadow:
      0 8px 32px rgba(0,0,0,.28),
      0 32px 80px rgba(0,0,0,.22);
  }
}

/* ================================================================
   MODALES GLOBALES — Bottom sheet (móvil) / Scale-in (escritorio)
   ================================================================ */
@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0);    }
}

.product-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.product-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Móvil: bottom sheet */
.modal-box {
  position: relative;
  background: var(--bg-elev);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 100%;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 40px rgba(0,0,0,.14);
  transform: translateY(32px);
  transition: transform .32s cubic-bezier(.2,.7,.3,1);
}
.product-modal.open .modal-box { transform: translateY(0); }
/* Handle visual */
.modal-box::before {
  content: '';
  display: block;
  flex-shrink: 0;
  width: 40px; height: 4px;
  background: var(--line-hover);
  border-radius: 2px;
  margin: 12px auto 0;
}

/* Desktop: centrado + scale-in */
@media (min-width: 600px) {
  .product-modal {
    align-items: center;
    padding: 24px;
  }
  .modal-box {
    border-radius: var(--radius-lg);
    max-width: 520px;
    max-height: 82dvh;
    box-shadow: var(--shadow-lg);
    transform: scale(.96) translateY(12px);
    transition: transform .3s cubic-bezier(.2,.7,.3,1);
  }
  .product-modal.open .modal-box { transform: scale(1) translateY(0); }
  .modal-box::before { display: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.modal-title    { margin: 0; font-size: 1.2rem; font-family: var(--font-display); font-weight: 700; }
.modal-variante { font-size: .78rem; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.modal-close {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--text-muted);
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
@media (hover: hover) and (pointer: fine) {
  .modal-close:hover {
    border-color: var(--text);
    background: var(--surface);
    color: var(--text);
  }
}
.modal-close:active { transform: scale(.92); }

.modal-body {
  overflow-y: auto;
  padding: 18px 22px;
  flex: 1;
  overscroll-behavior: contain;
}

.modal-section { margin-bottom: 20px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section-title {
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 12px;
  font-weight: 700;
}
.modal-hint { font-size: .7rem; color: var(--text-dim); letter-spacing: 0; text-transform: none; }

.ing-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.ing-item label {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: .84rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
  user-select: none;
}
.ing-item input[type="checkbox"] { display: none; }
.ing-item label:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.modal-nota {
  width: 100%;
  background: #F9FAFB;
  border: 1.5px solid #E5E7EB;
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: .9rem;
  font-family: var(--font-body);
  resize: vertical;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.modal-nota:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}

.modal-section-nota { margin-top: 4px; }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid var(--line-soft);
  flex-shrink: 0;
}

