@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Montserrat:wght@700;800;900&family=Space+Grotesk:wght@500;600;700&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

body {
  min-height: 100vh;
  background:
    radial-gradient(at 20% 0%, rgba(99,102,241,0.4) 0px, transparent 50%),
    radial-gradient(at 80% 0%, rgba(236,72,153,0.3) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(139,92,246,0.35) 0px, transparent 50%),
    #0a0f1f;
  /* Use flex-column with auto margins on the container so the card centers
     vertically when it fits AND remains fully scrollable when it overflows
     (avoiding the classic align-items:center cropping bug on tall forms). */
  display: flex;
  flex-direction: column;
  padding: 20px max(20px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  color: #f1f5f9;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.06) 1px, transparent 0);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

.auth-container {
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 2;
  /* auto margins on a flex-column child center vertically when there is
     extra space, but collapse to 0 when content overflows — so the top of
     the card is always reachable while scrolling. */
  margin: auto;
}

.auth-card {
  background: rgba(22,30,50,0.6);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 8px 16px rgba(99,102,241,0.2);
  border: 1px solid rgba(165,180,252,0.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  justify-content: center;
}
/* Single-img logo: gradient background shows when image is missing/loading
   or via the alt-text rendering when src fails. No wrapper, no fallback class. */
.brand-logo {
  width: 90px;
  height: 90px;
  border-radius: 22px;
  object-fit: cover;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  box-shadow: 0 12px 32px rgba(99,102,241,0.5), inset 0 2px 0 rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.15);
  transition: transform 0.25s;
  /* Style the alt-text rendering when image is absent/broken so it
     looks like the old "XN" fallback (centered, white, bold). */
  font-family: 'Montserrat', 'Space Grotesk', sans-serif;
  font-weight: 900;
  font-size: 36px;
  color: #fff;
  text-align: center;
  line-height: 86px; /* roughly 90px - 2*2px border */
  letter-spacing: -1px;
}
.brand-logo:hover { transform: scale(1.05) rotate(-2deg); }
.brand h1 {
  font-family: 'Montserrat', 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #a5b4fc 0%, #c084fc 50%, #f472b6 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brandGradient 6s ease infinite;
}
@keyframes brandGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.tabs {
  display: flex;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1;
  padding: 11px;
  background: transparent;
  border: none;
  border-radius: 9px;
  font-weight: 700;
  cursor: pointer;
  color: #94a3b8;
  transition: all 0.25s;
  font-size: 14px;
  font-family: inherit;
}
.tab-btn.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  box-shadow: 0 6px 14px rgba(99,102,241,0.4);
}

.form { display: none; flex-direction: column; gap: 14px; }
.form.active { display: flex; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 600;
}
.form input[type=email],
.form input[type=password],
.form input[type=text] {
  padding: 13px 16px;
  border: 1px solid rgba(165,180,252,0.15);
  border-radius: 11px;
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
  background: rgba(255,255,255,0.04);
  color: #f1f5f9;
}
.form input::placeholder { color: #64748b; }
.form input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.18);
  background: rgba(255,255,255,0.06);
}

.checkbox {
  flex-direction: row !important;
  align-items: center;
  font-size: 13px;
  color: #cbd5e1;
  cursor: pointer;
}
.checkbox input { width: 18px; height: 18px; margin-right: 10px; accent-color: #818cf8; cursor: pointer; }

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin: 4px 0;
}
.forgot-link {
  color: #a5b4fc;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}
.forgot-link:hover { color: #f472b6; }

.btn-primary {
  padding: 14px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s;
  font-family: inherit;
  box-shadow: 0 8px 20px rgba(99,102,241,0.4);
  letter-spacing: -0.2px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(99,102,241,0.5); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-ghost-auth {
  padding: 12px;
  background: rgba(255,255,255,0.04);
  color: #cbd5e1;
  border: 1px solid rgba(165,180,252,0.15);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-ghost-auth:hover { background: rgba(255,255,255,0.08); }

.error-msg {
  color: #fca5a5;
  font-size: 13px;
  text-align: center;
  min-height: 18px;
  font-weight: 500;
  border-radius: 8px;
  padding: 0;
  transition: padding 0.2s;
}
.error-msg:not(:empty) {
  padding: 8px 12px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
}


/* Password show/hide toggle */
.pass-wrap {
  position: relative;
  width: 100%;
  display: block;
}
.pass-wrap input {
  padding-right: 46px !important;
  width: 100% !important;
  display: block;
}
.pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #ffffff !important;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  padding: 0;
  font-size: 0; /* removes any inherited spacing */
  z-index: 10;
}
.pass-toggle:hover {
  color: #ffffff !important;
  background: rgba(255,255,255,0.1);
}
.pass-toggle:active { transform: translateY(-50%) scale(0.92); }
.pass-toggle .icon {
  width: 18px;
  height: 18px;
  pointer-events: none;
  stroke: #ffffff;
  color: #ffffff;
}
.pass-toggle:focus { outline: none; color: #ffffff !important; }
.pass-toggle:focus-visible { outline: 2px solid rgba(165,180,252,0.4); outline-offset: 1px; }



/* ===== Qaydalar və şərtlər (Terms) modalı ===== */

/* "Qaydalar və şərtləri" klikləmə linki — checkbox mətni içində */
.terms-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  color: #a5b4fc;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color 0.2s;
}
.terms-link:hover { color: #f472b6; }
.terms-link:focus-visible { outline: 2px solid rgba(165,180,252,0.5); outline-offset: 2px; border-radius: 4px; }

/* Overlay */
.terms-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.terms-modal.open { display: flex; animation: termsFade 0.2s ease; }
@keyframes termsFade { from { opacity: 0; } to { opacity: 1; } }

.terms-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 9, 20, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Dialog */
.terms-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #131a2e;
  border: 1px solid rgba(165,180,252,0.18);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  overflow: hidden;
  animation: termsPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes termsPop { from { transform: translateY(16px) scale(0.97); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

/* Header */
.terms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(236,72,153,0.12));
}
.terms-head h2 {
  font-family: 'Montserrat', 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -0.3px;
}
.terms-close {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #cbd5e1;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.18s;
}
.terms-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Body (scrollable) */
.terms-body {
  padding: 20px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.65;
}
.terms-body h3 {
  color: #f1f5f9;
  font-size: 15px;
  font-weight: 800;
  margin: 18px 0 6px;
}
.terms-body h3:first-of-type { margin-top: 8px; }
.terms-body p { margin: 0 0 8px; }
.terms-body ul { margin: 0 0 8px; padding-left: 20px; }
.terms-body li { margin-bottom: 5px; }
.terms-updated { color: #94a3b8; font-size: 12.5px; font-style: italic; }
.terms-contact { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.08); font-weight: 600; color: #e2e8f0; }
.terms-contact a { color: #a5b4fc; text-decoration: none; }
.terms-contact a:hover { color: #f472b6; }

/* Scrollbar */
.terms-body::-webkit-scrollbar { width: 8px; }
.terms-body::-webkit-scrollbar-thumb { background: rgba(165,180,252,0.3); border-radius: 8px; }
.terms-body::-webkit-scrollbar-track { background: transparent; }

/* Footer */
.terms-foot {
  padding: 14px 22px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(10,15,31,0.4);
}
.terms-hint {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  margin-bottom: 10px;
  transition: opacity 0.2s;
}
.terms-hint.hidden { display: none; }
.terms-actions { display: flex; gap: 10px; }
.terms-actions .btn-ghost-auth { flex: 0 0 auto; margin: 0; }
.terms-actions .btn-primary { flex: 1; margin: 0; }
.terms-actions .btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

@media (max-width: 480px) {
  .terms-dialog { max-height: 92vh; }
  .terms-head h2 { font-size: 16px; }
  .terms-body { font-size: 13.5px; }
}
