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

:root {
  --primary:       #8D6E63;
  --primary-dark:  #5D4037;
  --primary-light: #D7CCC8;
  --surface:       #FDFBF7;
  --surface-2:     #FFFFFF;
  --surface-3:     #F5F5F5;
  --border:        rgba(93, 64, 55, 0.15);
  --text-primary:  #3E2723;
  --text-secondary:#795548;
  --error:         #E53935;
  --success:       #43A047;
  --warning:       #FDD835;
  --radius:        16px;
  --shadow:        0 15px 35px rgba(93, 64, 55, 0.1);
}

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ─── Animated Background ────────────────────── */
.auth-bg {
  position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
  animation: blobFloat 8s ease-in-out infinite alternate;
}
.blob-1 { width: 500px; height: 500px; background: radial-gradient(circle, var(--primary-light), transparent); top: -150px; left: -150px; animation-delay: 0s; }
.blob-2 { width: 400px; height: 400px; background: radial-gradient(circle, #FBE9E7, transparent); bottom: -100px; right: -100px; animation-delay: 3s; }
.blob-3 { width: 300px; height: 300px; background: radial-gradient(circle, #FFF3E0, transparent); top: 50%; left: 50%; transform: translate(-50%,-50%); animation-delay: 6s; }

@keyframes blobFloat {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.1); }
}

/* ─── Container ──────────────────────────────── */
.auth-container {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ─── Card ───────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow);
  animation: cardSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Logo ───────────────────────────────────── */
.auth-logo {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 2rem;
}
.logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(93, 64, 55, 0.3);
}
.logo-text {
  font-size: 1.4rem; font-weight: 800;
  color: var(--primary-dark);
}

/* ─── Header ─────────────────────────────────── */
.auth-header { margin-bottom: 1.75rem; }
.auth-header h1 {
  font-size: 1.6rem; font-weight: 700;
  line-height: 1.2; color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.auth-header p { font-size: 0.9rem; color: var(--text-secondary); }

/* ─── Alert ──────────────────────────────────── */
.alert {
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  display: none;
  animation: fadeIn 0.3s ease;
}
.alert.show { display: flex; align-items: flex-start; gap: 0.5rem; }
.alert.error { background: rgba(229,57,53,0.1); border: 1px solid rgba(229,57,53,0.3); color: var(--error); }
.alert.success { background: rgba(67,160,71,0.1); border: 1px solid rgba(67,160,71,0.3); color: var(--success); }

@keyframes fadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

/* ─── Form ───────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
}
.forgot-link {
  font-size: 0.78rem; color: var(--primary);
  text-decoration: none; transition: color 0.2s;
}
.forgot-link:hover { color: var(--primary-dark); }

.input-wrapper {
  position: relative; display: flex; align-items: center;
}
.input-icon {
  position: absolute; left: 0.9rem;
  color: var(--text-secondary); pointer-events: none;
  transition: color 0.2s;
}
.input-wrapper input {
  width: 100%; padding: 0.78rem 3rem 0.78rem 2.75rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.9rem; font-family: inherit;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
}
.input-wrapper input::placeholder { color: rgba(121, 85, 72, 0.5); }
.input-wrapper input:focus {
  border-color: var(--primary);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(141, 110, 99, 0.15);
}
.input-wrapper input:focus + .input-icon,
.input-wrapper:focus-within .input-icon { color: var(--primary-dark); }
.input-wrapper input.input-error { border-color: var(--error) !important; }

.toggle-password {
  position: absolute; right: 0.9rem;
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 4px;
  display: flex; align-items: center;
  transition: color 0.2s;
}
.toggle-password:hover { color: var(--primary-dark); }

.field-error {
  display: block; font-size: 0.75rem;
  color: var(--error); margin-top: 0.3rem;
  min-height: 1rem;
  animation: fadeIn 0.2s ease;
}

/* ─── Password Strength ──────────────────────── */
.strength-bars {
  display: flex; gap: 4px; margin-bottom: 0.3rem;
}
.strength-bar {
  flex: 1; height: 4px; border-radius: 99px;
  background: var(--border);
  transition: background 0.3s, transform 0.2s;
}
.strength-bar.active { transform: scaleY(1.2); }
.strength-label { font-size: 0.72rem; color: var(--text-secondary); }

/* ─── Checkbox ───────────────────────────────── */
.checkbox-wrapper {
  display: flex; align-items: flex-start; gap: 0.6rem;
  cursor: pointer; margin-bottom: 0.3rem;
}
.checkbox-wrapper input[type="checkbox"] { display: none; }
.checkmark {
  width: 18px; height: 18px; min-width: 18px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; margin-top: 1px;
}
.checkbox-wrapper input:checked ~ .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}
.checkbox-wrapper input:checked ~ .checkmark::after {
  content: ''; width: 10px; height: 6px;
  border-left: 2px solid white; border-bottom: 2px solid white;
  transform: rotate(-45deg) translateY(-1px); display: block;
}
.checkbox-label { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }
.terms-link { color: var(--primary); text-decoration: none; }
.terms-link:hover { text-decoration: underline; }

/* ─── Buttons ────────────────────────────────── */
.btn-primary {
  width: 100%; padding: 0.85rem;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white; font-size: 0.92rem; font-weight: 600;
  border: none; border-radius: 10px;
  cursor: pointer; margin-top: 1.25rem;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 8px 24px rgba(93, 64, 55, 0.3);
  position: relative; overflow: hidden;
}
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.btn-primary:hover:not(:disabled)::after { opacity: 1; }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(93, 64, 55, 0.45); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary.loading .btn-text { opacity: 0; }
.btn-primary.loading .btn-spinner { display: block; }
.btn-spinner {
  display: none; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.7s linear infinite; position: absolute;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-oauth {
  width: 100%; padding: 0.85rem;
  background: white;
  color: var(--text-primary); font-size: 0.92rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; margin-bottom: 1.25rem;
  display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  transition: transform 0.15s, box-shadow 0.15s, background-color 0.15s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.btn-oauth:hover {
  background: var(--surface-3);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.btn-oauth svg {
  width: 20px; height: 20px;
}
/* ─── Divider ────────────────────────────────── */
.auth-divider {
  display: flex; align-items: center; gap: 1rem;
  margin: 1.5rem 0 1.25rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-divider span { font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; }

/* ─── Switch ─────────────────────────────────── */
.auth-switch { text-align: center; font-size: 0.85rem; color: var(--text-secondary); }
.switch-link {
  color: var(--primary); font-weight: 600;
  text-decoration: none; margin-left: 0.3rem; transition: color 0.2s;
}
.switch-link:hover { color: var(--primary-dark); }

.hidden { display: none !important; }

/* ─── Success State ──────────────────────────── */
.success-state {
  text-align: center;
  padding: 1rem 0;
  animation: fadeIn 0.5s ease;
}
.success-icon {
  width: 80px; height: 80px;
  background: rgba(67, 160, 71, 0.1);
  color: var(--success);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
}
.success-state h2 { font-size: 1.5rem; color: var(--text-primary); margin-bottom: 0.75rem; }
.success-state p { color: var(--text-secondary); margin-bottom: 1.5rem; line-height: 1.6; }
.btn-secondary {
  background: none; border: 1px solid var(--border);
  padding: 0.75rem 1.5rem; border-radius: 10px;
  color: var(--text-primary); font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--primary); }
