/* === BOBUL CRM — ESTILOS COMPARTIDOS DE AUTH ===
   Carga este archivo desde cada página de /afiliados/{registro,login,recuperar,...}/
   Mantiene 100% consistencia con la landing principal.
*/

:root {
  --bg: #F5F6F7;
  --surface: #FFFFFF;
  --surface-alt: #FAFBFC;
  --ink: #1A1F2B;
  --ink-soft: #3D4654;
  --ink-mute: #6B7280;
  --line: #E5E7EB;
  --line-soft: #EEF0F2;
  --accent-green: #1FAA6F;
  --accent-green-dark: #178A57;
  --accent-green-soft: #E6F5EE;
  --accent-blue: #2D6BFF;
  --accent-blue-soft: #E8F0FF;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --warning: #D97706;
  --warning-soft: #FEF3C7;
  --success: #1FAA6F;
  --success-soft: #E6F5EE;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, 0.10);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --maxw: 1180px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
::selection { background: var(--accent-green-soft); color: var(--ink); }

/* === TOPBAR === */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.logo-dot { width: 8px; height: 8px; background: var(--accent-green); border-radius: 50%; }

.topbar-link {
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 500;
  transition: color 0.2s;
}
.topbar-link:hover { color: var(--accent-blue); }

/* === AUTH LAYOUT (hero lateral) === */
.auth-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
}
@media (max-width: 960px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-hero { display: none !important; }
}

.auth-hero {
  background: var(--ink);
  color: #fff;
  padding: 64px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-hero::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(31,170,111,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.auth-hero::after {
  content: '';
  position: absolute;
  bottom: -250px;
  left: -150px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(45,107,255,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.auth-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 440px;
}
.auth-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-green);
  background: rgba(31, 170, 111, 0.15);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 28px;
}
.auth-hero-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
}
.auth-hero h1 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.auth-hero h1 em {
  font-style: italic;
  color: var(--accent-green);
  font-weight: 500;
}
.auth-hero-sub {
  font-size: 16.5px;
  line-height: 1.65;
  color: rgba(255,255,255,0.75);
  margin-bottom: 40px;
}
.auth-hero-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.auth-hero-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 14.5px;
  line-height: 1.55;
  color: rgba(255,255,255,0.85);
}
.auth-hero-check {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(31, 170, 111, 0.2);
  color: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}
.auth-hero-list strong { color: #fff; font-weight: 600; }

.auth-hero-foot {
  position: relative;
  z-index: 1;
  font-size: 12.5px;
  color: rgba(255,255,255,0.45);
  margin-top: 48px;
}

/* === FORM SIDE === */
.auth-form-side {
  padding: 64px 56px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
@media (max-width: 760px) {
  .auth-form-side { padding: 48px 28px; }
}
.auth-form-inner {
  max-width: 460px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-form-inner.tight {
  justify-content: flex-start;
  padding-top: 24px;
}

.auth-form-header { margin-bottom: 32px; }
.auth-form-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-green);
  background: var(--accent-green-soft);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
h1.auth-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: clamp(1.75rem, 3vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 12px;
}
h1.auth-title em {
  font-style: italic;
  color: var(--accent-green);
  font-weight: 500;
}
.auth-subtitle {
  font-size: 15.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* === FORM FIELDS === */
.form-group {
  margin-bottom: 20px;
}
.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 480px) {
  .form-group-row { grid-template-columns: 1fr; gap: 0; }
  .form-group-row .form-group { margin-bottom: 20px; }
}
.form-group-row .form-group { margin-bottom: 0; }

label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 7px;
}
label .label-hint {
  font-weight: 400;
  color: var(--ink-mute);
  font-size: 12.5px;
  margin-left: 4px;
}
label .label-required {
  color: var(--danger);
  font-weight: 600;
  margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--ink);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
input::placeholder, textarea::placeholder {
  color: var(--ink-mute);
  opacity: 1;
}
input:hover, select:hover, textarea:hover {
  border-color: var(--ink-mute);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px var(--accent-green-soft);
}
input.has-error, select.has-error, textarea.has-error {
  border-color: var(--danger);
}
input.has-error:focus, select.has-error:focus, textarea.has-error:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}
textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.55;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

.field-hint {
  font-size: 12.5px;
  color: var(--ink-mute);
  margin-top: 6px;
  line-height: 1.5;
}
.field-error {
  display: none;
  font-size: 12.5px;
  color: var(--danger);
  margin-top: 6px;
  line-height: 1.4;
}
.form-group.has-error .field-error { display: block; }
.form-group.has-error .field-hint { display: none; }

/* === PASSWORD INPUT (con toggle de visibilidad) === */
.password-wrapper {
  position: relative;
}
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-mute);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}
.password-toggle:hover { color: var(--ink); }

/* === CHECKBOX === */
.checkbox-group {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.checkbox-group input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent-green);
  cursor: pointer;
}
.checkbox-group label {
  margin: 0;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink-soft);
  line-height: 1.55;
  cursor: pointer;
}
.checkbox-group label a {
  color: var(--accent-blue);
  font-weight: 500;
}
.checkbox-group label a:hover { text-decoration: underline; }
.checkbox-group.has-error {
  border-color: var(--danger);
  background: var(--danger-soft);
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 15px;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent-green);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-green-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(31, 170, 111, 0.25);
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--ink-mute); }
.btn-full {
  width: 100%;
  padding: 14px 22px;
  font-size: 15.5px;
  font-weight: 600;
}

.btn .spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-text { opacity: 0.7; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === ALERTS === */
.alert {
  display: none;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
  font-size: 14px;
  line-height: 1.55;
  border: 1px solid transparent;
}
.alert.is-visible { display: block; }
.alert-danger {
  background: var(--danger-soft);
  color: #991B1B;
  border-color: rgba(220, 38, 38, 0.2);
}
.alert-success {
  background: var(--success-soft);
  color: #065F46;
  border-color: rgba(31, 170, 111, 0.25);
}
.alert-warning {
  background: var(--warning-soft);
  color: #92400E;
  border-color: rgba(217, 119, 6, 0.2);
}
.alert-info {
  background: var(--accent-blue-soft);
  color: #1E40AF;
  border-color: rgba(45, 107, 255, 0.2);
}
.alert strong { font-weight: 600; }

/* === FORM ACTIONS / LINKS === */
.form-actions {
  margin-top: 8px;
}
.form-links {
  margin-top: 24px;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.6;
}
.form-links a {
  color: var(--accent-blue);
  font-weight: 500;
}
.form-links a:hover { text-decoration: underline; }
.form-links .separator {
  margin: 0 10px;
  color: var(--line);
}

/* === SECTION INSIDE FORM (para registro paso 2) === */
.form-section {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.form-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.form-section-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.form-section-sub {
  font-size: 13.5px;
  color: var(--ink-mute);
  line-height: 1.55;
  margin-bottom: 20px;
}

/* === MINI FOOTER (en form side) === */
.auth-mini-foot {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-mute);
}
.auth-mini-foot a {
  color: var(--ink-mute);
  text-decoration: underline;
  text-decoration-color: var(--line);
}
.auth-mini-foot a:hover { color: var(--ink); text-decoration-color: var(--ink-mute); }

/* === SUCCESS CARDS (para páginas tipo /confirmado) === */
.success-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
  max-width: 480px;
  margin: 0 auto;
}
.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--accent-green-soft);
  color: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
}
.success-icon.error {
  background: var(--danger-soft);
  color: var(--danger);
}
.success-icon.info {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
}
.success-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 24px;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.success-desc {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.65;
  margin-bottom: 28px;
}
.success-desc strong { color: var(--ink); font-weight: 600; }

/* === LOADER FULL PAGE === */
.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  flex: 1;
}
.page-loader .spinner {
  display: inline-block;
  width: 36px; height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
