/* ==========================================================================
   khaleej.bio — login · signup · discord authorise
   ========================================================================== */

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  min-height: 100vh;
}

/* ---------- form side ---------- */
.auth-main {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 30px clamp(22px, 5vw, 70px) 30px;
}
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.88rem;
  color: var(--text-dim);
  transition: color var(--t) var(--ease), gap var(--t) var(--ease);
}
.auth-back:hover { color: var(--text); gap: 11px; }
.auth-back .ico { width: 16px; height: 16px; }

.auth-body { display: grid; align-content: center; justify-items: stretch; padding: 40px 0; }
.auth-card { width: min(430px, 100%); margin: 0 auto; }
.auth-card > header { margin-bottom: 28px; }
.auth-card h1 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); letter-spacing: -0.04em; }
.auth-card header p { margin-top: 11px; color: var(--text-dim); font-size: 0.95rem; font-weight: 300; }

.auth-form { display: grid; gap: 17px; }
.auth-form .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.form-foot a { font-size: 0.85rem; }

.auth-alt { display: grid; gap: 11px; }
.auth-swap {
  margin-top: 26px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.auth-swap a { color: #7ec8e3; font-weight: 500; }
.auth-swap a:hover { text-decoration: underline; text-underline-offset: 4px; }

.auth-legal { font-size: 0.76rem; color: var(--text-faint); text-align: center; line-height: 1.6; }
#otp { letter-spacing: 0.38em; font-weight: 600; font-variant-numeric: tabular-nums; }
.otp-dev {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.5;
}
.auth-legal a { color: var(--mist-500); text-decoration: underline; text-underline-offset: 3px; }

.auth-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-faint);
  flex-wrap: wrap;
}
.auth-foot nav { display: flex; gap: 16px; }

/* form-level error banner */
.form-error {
  display: none;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(194, 86, 106, 0.42);
  background: rgba(194, 86, 106, 0.1);
  font-size: 0.86rem;
  color: #f0b6c0;
}
.form-error.show { display: flex; animation: shakeIn 0.5s var(--ease); }
.form-error .ico { color: #e08a99; margin-top: 1px; }
@keyframes shakeIn {
  0% { opacity: 0; transform: translateY(-6px); }
  40% { transform: translateX(-5px); }
  60% { transform: translateX(5px); }
  100% { opacity: 1; transform: none; }
}

/* demo credentials hint */
.demo-note {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--line-2);
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--text-dim);
}
.demo-note .ico { color: var(--brand-300); }
.demo-note b { color: var(--text); font-weight: 600; }
.demo-note button {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--brand-200);
  white-space: nowrap;
}
.demo-note button:hover { text-decoration: underline; text-underline-offset: 3px; }

/* username availability pill */
.uname-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.uname-state.checking { background: var(--surface-2); color: var(--text-faint); }
.uname-state.free { background: rgba(63, 157, 122, 0.16); color: #8fd2b8; }
.uname-state.taken { background: rgba(194, 86, 106, 0.16); color: #e08a99; }
.uname-state .ico { width: 12px; height: 12px; }

/* ---------- brand side ---------- */
.auth-side {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: center;
  padding: 60px clamp(28px, 4vw, 64px);
  border-left: 1px solid var(--line);
  background:
    url("../img/waves.svg") no-repeat center bottom / 140% 58%,
    linear-gradient(200deg, #071824, #0a3048 52%, #041018);
}
.auth-side::before {
  content: "";
  position: absolute;
  width: 620px; height: 620px;
  top: -220px; right: -200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 126, 171, 0.35), transparent 66%);
  filter: blur(40px);
  animation: breathe 9s var(--ease-io) infinite;
}
.auth-side::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../img/grid.svg") repeat;
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000, transparent 75%);
  opacity: 0.6;
}
.side-in { position: relative; z-index: 1; display: grid; gap: 34px; max-width: 460px; }

.side-in { justify-items: center; gap: 26px; }
.side-card {
  width: min(360px, 100%);
  border-radius: var(--r-xl);
  border: 1px solid var(--line-2);
  background: rgba(8, 26, 40, 0.86);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 40px 80px -36px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.side-card-banner { position: relative; height: 104px; }
.side-card-banner img { width: 100%; height: 100%; object-fit: cover; }
.side-card-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 28%, rgba(8, 26, 40, 0.96));
}
.side-card-body { position: relative; margin-top: -36px; padding: 0 22px 22px; }
.side-card .avatar { width: 74px; height: 74px; border: 3px solid #0c2436; }
.side-card .avatar img { width: 100%; height: 100%; object-fit: cover; }
.side-card-name { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 1.22rem; font-weight: 600; letter-spacing: -0.03em; }
.side-card-name .ico { width: 17px; height: 17px; color: #5eb0d4; }
.side-card-handle { font-size: 0.85rem; color: var(--text-faint); }
.side-card-bio { margin: 11px 0 15px; font-size: 0.875rem; color: var(--text-dim); line-height: 1.55; font-weight: 300; }
.side-card-socials { display: flex; gap: 8px; }
.side-card-socials span {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
}

.side-dots { display: flex; gap: 7px; }
.side-dots i {
  width: 20px; height: 3px;
  border-radius: 9px;
  background: var(--surface-3);
  transition: background-color 0.4s var(--ease), width 0.4s var(--ease);
  cursor: pointer;
}
.side-dots i.on { width: 32px; background: var(--brand-300); }

.side-mark {
  position: absolute;
  right: 8px; bottom: 8px;
  width: 220px; height: auto;
  object-fit: contain;
  opacity: 0.22;
  pointer-events: none;
  filter: drop-shadow(0 12px 24px rgba(31, 126, 171, 0.35));
}
.side-tag { justify-self: start; }

/* ---------- Discord authorise ---------- */
.oauth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 22px;
}
.oauth-card {
  width: min(430px, 100%);
  padding: 32px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-2);
  background: rgba(8, 26, 40, 0.94);
  backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 60px 120px -50px rgba(0, 0, 0, 1);
  text-align: center;
}
.oauth-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 24px;
}
.oauth-logos img {
  width: 72px; height: 72px;
  object-fit: contain;
  border-radius: 16px;
}
.oauth-logos .dsc {
  width: 62px; height: 62px;
  border-radius: 19px;
}
.oauth-logos .dsc {
  display: grid;
  place-items: center;
  background: #fff;
  color: #000;
  box-shadow: 0 18px 38px -18px rgba(255, 255, 255, 0.4);
}
.oauth-logos .dsc .ico { width: 34px; height: 34px; }
.oauth-logos .dash {
  display: flex;
  gap: 5px;
}
.oauth-logos .dash i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--mist-600);
  animation: dash 1.4s var(--ease-io) infinite;
}
.oauth-logos .dash i:nth-child(2) { animation-delay: 0.16s; }
.oauth-logos .dash i:nth-child(3) { animation-delay: 0.32s; }
@keyframes dash { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

.oauth-card h1 { font-size: 1.42rem; letter-spacing: -0.035em; }
.oauth-card > p { margin-top: 10px; font-size: 0.92rem; color: var(--text-dim); font-weight: 300; }
.oauth-card .you {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
}
.oauth-card .you .avatar { width: 40px; height: 40px; }
.oauth-card .you div { min-width: 0; }
.oauth-card .you b { display: block; font-size: 0.95rem; }
.oauth-card .you div span { display: block; font-size: 0.8rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oauth-card .you .chip { margin-left: auto; }
.oauth-card .auth-form { text-align: left; }

.scopes { display: grid; gap: 11px; text-align: left; margin-bottom: 26px; }
.scopes li { display: flex; gap: 11px; font-size: 0.875rem; color: var(--text-dim); align-items: flex-start; }
.scopes .ico { width: 17px; height: 17px; color: #6fc9a6; margin-top: 2px; }
.oauth-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 11px; }
.oauth-note { margin-top: 20px; font-size: 0.74rem; color: var(--text-faint); line-height: 1.6; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 520px) {
  .auth-form .row-2 { grid-template-columns: 1fr; }
  .oauth-card { padding: 24px; }
  .oauth-actions { grid-template-columns: 1fr; }
}
