/* PreuOnline Matemáticas — Auth shared styles */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #fafbfe;
  --bg-alt: #f0f1f8;
  --bg-dark: #0b0e2a;
  --bg-card: #ffffff;
  --fg: #141838;
  --fg-muted: #5a5f88;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79,70,229,0.08);
  --coral: #e84530;
  --teal: #0a9e8a;
  --gold: #d4a017;
  --border: #e0e2ee;
  --shadow: 0 2px 12px rgba(11,14,42,0.06);
  --shadow-lg: 0 8px 32px rgba(11,14,42,0.10);
  --radius: 14px;
  --radius-sm: 8px;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --success: #16a34a;
  --danger: #dc2626;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08091a;
    --bg-alt: #0f1128;
    --bg-dark: #050618;
    --bg-card: #13153a;
    --fg: #e2e4f2;
    --fg-muted: #8a90b8;
    --accent: #7c73fa;
    --accent-hover: #9a94ff;
    --accent-soft: rgba(124,115,250,0.12);
    --coral: #f06050;
    --teal: #20c8b0;
    --gold: #f0c040;
    --border: #1e2148;
    --shadow: 0 2px 12px rgba(0,0,0,0.24);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);
    --success: #22c55e;
    --danger: #ef4444;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #08091a;
  --bg-alt: #0f1128;
  --bg-dark: #050618;
  --bg-card: #13153a;
  --fg: #e2e4f2;
  --fg-muted: #8a90b8;
  --accent: #7c73fa;
  --accent-hover: #9a94ff;
  --accent-soft: rgba(124,115,250,0.12);
  --coral: #f06050;
  --teal: #20c8b0;
  --gold: #f0c040;
  --border: #1e2148;
  --shadow: 0 2px 12px rgba(0,0,0,0.24);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);
  --success: #22c55e;
  --danger: #ef4444;
  color-scheme: dark;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
}

/* Split layout: branded panel left, form right */
.auth-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Branded left panel */
.auth-brand {
  flex: 0 0 420px;
  background: var(--bg-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}
.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(79,70,229,0.25) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(10,158,138,0.15) 0%, transparent 50%);
  pointer-events: none;
}
.brand-logo {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 40px;
}
.brand-sigma {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.brand-name span {
  color: var(--accent);
}
.brand-tagline {
  position: relative;
  z-index: 1;
  font-size: 18px;
  line-height: 1.6;
  text-align: center;
  color: rgba(255,255,255,0.85);
  max-width: 320px;
}
.brand-formulas {
  position: relative;
  z-index: 1;
  margin-top: 40px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: rgba(255,255,255,0.3);
  text-align: center;
  line-height: 2.2;
}

/* Right form panel */
.auth-form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 32px;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 440px;
}
.auth-card h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.auth-card .subtitle {
  color: var(--fg-muted);
  font-size: 15px;
  margin-bottom: 32px;
}

/* Form styles */
.form-group {
  margin-bottom: 20px;
}
.form-row {
  display: flex;
  gap: 16px;
}
.form-row .form-group {
  flex: 1;
  min-width: 0;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--fg);
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--bg-card);
  color: var(--fg);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input::placeholder {
  color: var(--fg-muted);
  opacity: 0.6;
}
.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group input.error {
  border-color: var(--danger);
}
.form-group .field-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
  display: none;
}
.form-group .field-error.show {
  display: block;
}
.password-wrapper {
  position: relative;
}
.password-wrapper input {
  padding-right: 48px;
}
.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-muted);
  font-size: 18px;
  padding: 4px;
  line-height: 1;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 14px;
}
.form-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--fg-muted);
}
.form-options a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.form-options a:hover {
  text-decoration: underline;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}
.btn.loading .spinner { display: block; }
.btn.loading .btn-text { opacity: 0; }

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

.form-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--fg-muted);
}
.form-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.form-footer a:hover { text-decoration: underline; }

/* Alert messages */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
}
.alert.show { display: block; }
.alert-error {
  background: rgba(220,38,38,0.08);
  color: var(--danger);
  border: 1px solid rgba(220,38,38,0.2);
}
.alert-success {
  background: rgba(22,163,74,0.08);
  color: var(--success);
  border: 1px solid rgba(22,163,74,0.2);
}

/* Back to home link */
.back-home {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 10;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}
.back-home:hover { color: #fff; }

/* Responsive: stack on mobile */
@media (max-width: 900px) {
  .auth-layout {
    flex-direction: column;
  }
  .auth-brand {
    flex: none;
    padding: 40px 24px 32px;
    min-height: auto;
  }
  .brand-formulas { display: none; }
  .auth-form-panel {
    padding: 32px 20px 48px;
  }
}
@media (max-width: 520px) {
  .auth-brand {
    padding: 32px 20px 24px;
  }
  .brand-tagline { font-size: 15px; }
  .form-row { flex-direction: column; gap: 0; }
  .auth-card h1 { font-size: 24px; }
}
