/* ════════════════════════════════════════════════════════════
   Fun Over Here — Auth Pages CSS
   Mobile-first responsive design
   ════════════════════════════════════════════════════════════ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #1a1a2e;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-x: hidden;
}

/* ── Auth Container ───────────────────────────────────────── */
.auth-container {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Header ───────────────────────────────────────────────── */
.auth-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 32px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
  animation: shimmer 8s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { transform: translateX(-30%) translateY(-30%); }
  50% { transform: translateX(30%) translateY(30%); }
}

.auth-header .logo {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}

.auth-header .logo-emoji {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}

.auth-header .subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 6px;
  position: relative;
  z-index: 1;
}

/* ── Form Body ────────────────────────────────────────────── */
.auth-body {
  padding: 28px 24px 32px;
}

/* ── Form Groups ──────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px; /* 16px prevents iOS zoom */
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  color: #1a1a2e;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.form-group input::placeholder {
  color: #a0aec0;
}

.form-group input.error {
  border-color: #e53e3e;
  box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.1);
}

.form-group .input-hint {
  font-size: 12px;
  color: #a0aec0;
  margin-top: 4px;
}

/* ── Password Toggle ──────────────────────────────────────── */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #a0aec0;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: #667eea;
}

/* ── Password Strength ────────────────────────────────────── */
.password-strength {
  margin-top: 8px;
}

.strength-bar {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background-color 0.3s ease;
  width: 0;
}

.strength-fill.weak { width: 25%; background: #e53e3e; }
.strength-fill.fair { width: 50%; background: #ed8936; }
.strength-fill.good { width: 75%; background: #48bb78; }
.strength-fill.strong { width: 100%; background: #38a169; }

.strength-text {
  font-size: 11px;
  color: #a0aec0;
  text-align: right;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
  min-height: 50px;
  -webkit-appearance: none;
  appearance: none;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-facebook {
  background: #1877F2;
  color: #fff;
  box-shadow: 0 4px 16px rgba(24, 119, 242, 0.3);
  margin-bottom: 16px;
}

.btn-facebook:hover {
  background: #166fe5;
  transform: translateY(-1px);
}

.btn-facebook .fb-icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 18px;
  vertical-align: middle;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.divider span {
  padding: 0 12px;
  font-size: 13px;
  color: #a0aec0;
  font-weight: 500;
}

/* ── Alert Messages ───────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
  animation: fadeIn 0.3s ease;
}

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

.alert.show {
  display: block;
}

.alert-error {
  background: #fff5f5;
  color: #c53030;
  border: 1px solid #fed7d7;
}

.alert-success {
  background: #f0fff4;
  color: #276749;
  border: 1px solid #c6f6d5;
}

.alert-info {
  background: #ebf8ff;
  color: #2b6cb0;
  border: 1px solid #bee3f8;
}

/* ── Footer Links ─────────────────────────────────────────── */
.auth-footer {
  text-align: center;
  padding: 16px 24px 24px;
  border-top: 1px solid #f0f0f5;
}

.auth-footer a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-footer p {
  font-size: 14px;
  color: #718096;
  margin: 4px 0;
}

/* ── Loading Spinner ──────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* ── Success State ────────────────────────────────────────── */
.success-icon {
  font-size: 64px;
  text-align: center;
  margin: 24px 0 16px;
}

.success-message {
  text-align: center;
  font-size: 16px;
  color: #555;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ── Branding Footer ──────────────────────────────────────── */
.brand-footer {
  text-align: center;
  margin-top: 20px;
  padding: 8px;
}

.brand-footer a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 13px;
}

.brand-footer a:hover {
  color: #fff;
}

/* ── Responsive: Tablets and larger ───────────────────────── */
@media (min-width: 480px) {
  .auth-container {
    border-radius: 24px;
  }

  .auth-header {
    padding: 40px 32px;
  }

  .auth-body {
    padding: 32px 32px 36px;
  }

  .auth-header .logo {
    font-size: 32px;
  }
}

@media (min-width: 768px) {
  body {
    padding: 32px;
  }

  .auth-container {
    max-width: 480px;
  }
}

/* ── Safe area for notch devices ──────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ── Prevent pull-to-refresh interference on mobile ──────── */
body {
  overscroll-behavior-y: contain;
}

/* ── Reduced motion preference ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Dark mode support ────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #2d1b69 0%, #44337a 50%, #553c7b 100%);
  }

  .auth-container {
    background: #1a1a2e;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  }

  .auth-body {
    color: #e2e8f0;
  }

  .form-group label {
    color: #a0aec0;
  }

  .form-group input {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .form-group input:focus {
    background: #2d3748;
    border-color: #667eea;
  }

  .form-group input::placeholder {
    color: #718096;
  }

  .auth-footer {
    border-top-color: #2d3748;
  }

  .auth-footer p {
    color: #a0aec0;
  }

  .divider::before,
  .divider::after {
    background: #4a5568;
  }

  .divider span {
    color: #718096;
  }

  .strength-bar {
    background: #4a5568;
  }

  .alert-error {
    background: #2d1b1b;
    color: #fc8181;
    border-color: #4a1e1e;
  }

  .alert-success {
    background: #1b2d1b;
    color: #68d391;
    border-color: #1e4a1e;
  }

  .alert-info {
    background: #1b2333;
    color: #63b3ed;
    border-color: #1e3a5f;
  }

  .success-message {
    color: #a0aec0;
  }
}
