/* ============================================
   SummitData TradLog — Auth Pages CSS
   assets/css/auth.css
   ============================================ */

:root {
  --midnight: #0f172a;
  --gold: #fcc900;
  --gold-dim: rgba(252,201,0,0.1);
  --slate: #1e293b;
  --card-bg: #111b2d;
  --border: rgba(255,255,255,0.08);
  --text: #f1f5f9;
  --muted: #64748b;
  --green: #22c55e;
  --red: #ef4444;
  --font: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  background: var(--midnight);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport height — handles mobile browser chrome */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  /* iOS safe-area support */
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* BG EFFECTS */
.auth-bg {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  overflow: hidden;
}
.auth-glow {
  position: absolute; top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 800px; height: 600px;
  background: radial-gradient(circle at 50% 30%, rgba(252,201,0,0.1) 0%, transparent 65%);
}
.auth-glow-2 {
  position: absolute; bottom: -100px; right: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(59,130,246,0.07) 0%, transparent 65%);
}

/* WRAP */
.auth-wrap {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column;
  align-items: center; gap: 20px;
}

/* BRAND */
.auth-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  font-size: 17px; font-weight: 800; color: var(--text);
  letter-spacing: -0.3px;
}
.auth-brand .gold { color: var(--gold); }
.auth-brand .sub  { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.auth-logo { height: 30px; }

/* CARD */
.auth-card {
  width: 100%;
  background: linear-gradient(145deg, var(--slate), var(--card-bg));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 36px 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

.auth-card-header {
  text-align: center;
  margin-bottom: 24px;
}
.auth-card-header h1 {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.auth-card-header p { font-size: 13px; color: var(--muted); font-weight: 500; }

/* FREE BADGE */
.free-badge {
  background: var(--gold-dim);
  border: 1px solid rgba(252,201,0,0.25);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 12px; font-weight: 700; color: var(--gold);
  text-align: center;
  margin-bottom: 20px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* ALERT */
.alert {
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 18px;
  line-height: 1.5;
}
.alert i { margin-top: 1px; flex-shrink: 0; }
.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5;
}
.alert-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  color: #86efac;
}

/* FORM */
.form-grp {
  margin-bottom: 16px;
  display: flex; flex-direction: column; gap: 7px;
}
.form-lbl {
  font-size: 10px; font-weight: 800;
  color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
}
.forgot-link {
  font-size: 11px; font-weight: 600;
  color: var(--gold); text-decoration: none;
  letter-spacing: 0; text-transform: none;
  transition: opacity 0.2s;
  /* larger tap target on touch */
  padding: 4px 0;
}
.forgot-link:hover { opacity: 0.75; }
.input-wrap { position: relative; }
.input-icon {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px; color: var(--muted);
  pointer-events: none;
}
.form-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 44px 12px 40px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px; font-weight: 500;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  /* Prevent iOS zoom on focus (font-size must be >= 16px or field zooms) */
  font-size: max(14px, 16px);
}
.form-input:focus {
  border-color: var(--gold);
  background: rgba(252,201,0,0.03);
}
.form-input::placeholder { color: rgba(100,116,139,0.7); }
.pw-toggle {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 15px;
  /* larger tap area */
  padding: 8px;
  border-radius: 6px;
  transition: color 0.2s;
  touch-action: manipulation;
}
.pw-toggle:hover { color: var(--text); }

/* PASSWORD STRENGTH */
.pw-strength {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
}
.pw-bars { display: flex; gap: 4px; flex: 1; }
.pw-bar {
  flex: 1; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.1);
  transition: background 0.3s;
}
.pw-label { font-size: 10px; font-weight: 700; white-space: nowrap; min-width: 70px; }

/* CHECKBOX */
.form-check { margin-bottom: 20px; }
.check-wrap {
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer; font-size: 12px; color: var(--muted); font-weight: 600;
  line-height: 1.5;
}
.check-wrap input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; min-width: 18px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid var(--border);
  border-radius: 5px; cursor: pointer;
  transition: all 0.2s;
  position: relative; margin-top: 1px;
}
.check-wrap input[type="checkbox"]:checked {
  background: var(--gold); border-color: var(--gold);
}
.check-wrap input[type="checkbox"]:checked::after {
  content: '';
  position: absolute; top: 2px; left: 5px;
  width: 5px; height: 9px;
  border: 2px solid var(--midnight);
  border-top: none; border-left: none;
  transform: rotate(45deg);
}
.check-wrap a { color: var(--gold); text-decoration: none; }
.check-wrap a:hover { text-decoration: underline; }

/* SUBMIT BUTTON */
.btn-submit {
  width: 100%;
  background: var(--gold);
  color: var(--midnight);
  font-family: var(--font);
  font-size: 14px; font-weight: 800;
  padding: 14px;
  border: none; border-radius: 12px;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px;
  transition: all 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
  letter-spacing: 0.3px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-submit:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(252,201,0,0.35);
}
.btn-submit:active { transform: translateY(-1px); }

/* DIVIDER */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 16px;
  color: var(--muted); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}

/* FOOTER TEXT */
.auth-footer-text {
  text-align: center;
  font-size: 13px; color: var(--muted); font-weight: 600;
}
.auth-footer-text a {
  color: var(--gold); text-decoration: none; font-weight: 700;
  transition: opacity 0.2s;
}
.auth-footer-text a:hover { opacity: 0.75; }

/* BACK HOME */
.back-home {
  font-size: 12px; color: var(--muted); font-weight: 600;
  text-decoration: none; display: flex; align-items: center; gap: 5px;
  transition: color 0.2s;
  padding: 6px 0; /* bigger tap target */
}
.back-home:hover { color: var(--gold); }

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* --- Tablet / large phone (≤ 600px) --- */
@media (max-width: 600px) {
  body {
    align-items: flex-start; /* let content scroll naturally on tall forms */
    padding: 20px 14px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .auth-wrap {
    gap: 16px;
    /* keep vertically centred if content is shorter than viewport */
    min-height: calc(100dvh - 40px);
    justify-content: center;
  }

  .auth-card {
    padding: 28px 24px 24px;
    border-radius: 20px;
  }

  .auth-card-header {
    margin-bottom: 20px;
  }

  .auth-card-header h1 {
    font-size: 1.35rem;
  }

  .form-grp {
    margin-bottom: 14px;
  }

  .form-check {
    margin-bottom: 18px;
  }

  .auth-divider {
    margin: 16px 0 14px;
  }
}

/* --- Small phone (≤ 400px) --- */
@media (max-width: 400px) {
  body {
    padding: 16px 10px;
  }

  .auth-wrap { gap: 14px; }

  .auth-brand {
    font-size: 15px;
  }
  .auth-logo { height: 26px; }

  .auth-card {
    padding: 24px 18px 20px;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  }

  .auth-card-header h1 {
    font-size: 1.2rem;
  }

  .auth-card-header {
    margin-bottom: 18px;
  }

  /* Inputs: comfortable height on small screens */
  .form-input {
    padding: 13px 44px 13px 40px;
  }

  .btn-submit {
    padding: 15px;
    font-size: 13px;
  }

  .form-grp { margin-bottom: 12px; }
  .form-check { margin-bottom: 16px; }

  .alert { font-size: 12px; padding: 10px 14px; }

  .check-wrap { font-size: 11px; }

  .auth-footer-text { font-size: 12px; }
}

/* --- Very small (≤ 340px, e.g. iPhone SE 1st gen) --- */
@media (max-width: 340px) {
  .auth-card {
    padding: 20px 14px 18px;
    border-radius: 16px;
  }

  .auth-card-header h1 { font-size: 1.1rem; }

  .form-input { font-size: 15px; }

  .pw-label { min-width: 56px; font-size: 9px; }
}

/* --- Tablet (≤ 768px): slightly narrower card --- */
@media (max-width: 768px) {
  .auth-wrap { max-width: 420px; }
}

/* --- Reduce motion: respect OS preference --- */
@media (prefers-reduced-motion: reduce) {
  .btn-submit { transition: none; }
  .pw-bar     { transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* --- Landscape on mobile: reduce vertical gaps so form fits without scroll --- */
@media (max-height: 620px) and (orientation: landscape) {
  body { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }

  .auth-wrap { gap: 10px; min-height: auto; }

  .auth-brand { display: none; } /* hide logo to save vertical space */

  .auth-card {
    padding: 20px 28px 18px;
    border-radius: 18px;
  }

  .auth-card-header { margin-bottom: 14px; }
  .auth-card-header h1 { font-size: 1.2rem; }

  .form-grp { margin-bottom: 10px; gap: 5px; }
  .form-check { margin-bottom: 12px; }

  .form-input { padding: 10px 44px 10px 40px; }

  .btn-submit { padding: 12px; }

  .auth-divider { margin: 12px 0 10px; }

  .back-home { display: none; }
}