/* =====================================================================
   Cirya SSO — sign-in & account UI
   ===================================================================== */

:root {
  --cyan:        #00bbfe;
  --cyan-deep:   #0ea5e9;
  --ink:         #0a0a0a;
  --ink-2:       #131318;
  --line:        rgba(255, 255, 255, .08);
  --muted:       rgba(255, 255, 255, .55);
  --muted-2:     rgba(255, 255, 255, .35);
  --text:        rgba(255, 255, 255, .92);
  --accent:      #fb923c;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body.sso-body {
  background: #060608;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

/* ===== Aurora background ===== */
.sso-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.sso-aurora span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .55;
  animation: drift 18s ease-in-out infinite;
}
.sso-aurora span:nth-child(1) { top: -20%; left:  -10%; width: 520px; height: 520px; background: radial-gradient(circle, rgba(0,187,254,.6), transparent 60%); animation-delay: -2s;  }
.sso-aurora span:nth-child(2) { bottom: -25%; right: -15%; width: 600px; height: 600px; background: radial-gradient(circle, rgba(88,101,242,.55), transparent 60%); animation-delay: -8s;  }
.sso-aurora span:nth-child(3) { top: 40%; left: 50%; width: 460px; height: 460px; background: radial-gradient(circle, rgba(251,146,60,.35), transparent 60%); animation-delay: -14s; }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(40px, -30px) scale(1.08); }
}

/* ===== Card ===== */
.sso-main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
}

.sso-card {
  background: rgba(15, 15, 18, .72);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 36px 32px 26px;
  box-shadow:
    0 24px 60px -20px rgba(0, 0, 0, .55),
    0 1px 0 rgba(255, 255, 255, .04) inset;
  animation: rise .45s cubic-bezier(.2,.7,.2,1) both;
}

/* HTML hidden attribute must beat our display:flex/grid rules.
   Without this, .sso-loading/.sso-signedin/.sso-sent all stay visible
   from page load because their display:flex outranks [hidden]. */
.sso-card [hidden] { display: none !important; }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sso-card__head {
  text-align: center;
  margin-bottom: 24px;
}
.sso-card__brand {
  display: inline-block;
  margin-bottom: 16px;
}
.sso-card__brand img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  padding: 8px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
}
.sso-card__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 1.75rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.sso-card__title span {
  color: var(--cyan);
  font-style: italic;
}
.sso-card__sub {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}

/* ===== Provider buttons ===== */
.sso-providers {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.sso-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sso-group__label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-2);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
}
.sso-group__hint {
  margin: -2px 0 0;
  font-size: .72rem;
  line-height: 1.5;
  color: var(--muted-2);
}
.sso-group__hint strong {
  color: var(--muted);
  font-weight: 600;
}
.sso-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  text-decoration: none;
}
.sso-btn:hover {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .18);
  transform: translateY(-1px);
}
.sso-btn:focus-visible {
  outline: 2px solid rgba(0, 187, 254, .5);
  outline-offset: 3px;
}
.sso-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.sso-btn--google {
  background: #fff;
  color: #1f2937;
  border-color: #fff;
}
.sso-btn--google:hover {
  background: #f3f4f6;
  border-color: #f3f4f6;
}
.sso-btn--discord {
  background: #5865F2;
  color: #fff;
  border-color: #5865F2;
}
.sso-btn--discord:hover {
  background: #4752C4;
  border-color: #4752C4;
}
.sso-btn--primary {
  background: var(--cyan);
  color: var(--ink);
  border-color: var(--cyan);
}
.sso-btn--primary:hover {
  background: var(--cyan-deep);
  border-color: var(--cyan-deep);
  color: #fff;
}
.sso-btn--ghost {
  background: transparent;
  border-color: var(--line);
}
.sso-btn--ghost:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .15);
}

/* ===== Divider ===== */
.sso-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 6px 0 0;
  color: var(--muted-2);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.sso-divider::before,
.sso-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ===== Email form ===== */
.sso-email {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sso-email input[type="email"] {
  height: 46px;
  padding: 0 14px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-size: .92rem;
  transition: border-color .15s ease, background .15s ease;
}
.sso-email input[type="email"]::placeholder { color: var(--muted-2); }
.sso-email input[type="email"]:focus {
  outline: none;
  border-color: var(--cyan);
  background: rgba(0, 187, 254, .04);
}

/* ===== States ===== */
.sso-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 0;
  color: var(--muted);
  font-size: .9rem;
}
.sso-spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(0, 187, 254, .15);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Signed in */
.sso-signedin {
  text-align: center;
  padding: 8px 0 0;
}
.sso-avatar-wrap {
  position: relative;
  width: 96px; height: 96px;
  margin: 0 auto 16px;
}
.sso-avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--cyan), #5865F2, var(--cyan));
  animation: spin 5s linear infinite;
  opacity: .8;
}
.sso-avatar-ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--ink);
}
.sso-avatar {
  position: relative;
  z-index: 1;
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, .06);
  display: block;
}
.sso-avatar-check {
  position: absolute;
  z-index: 2;
  right: -2px; bottom: -2px;
  width: 30px; height: 30px;
  background: var(--cyan);
  color: var(--ink);
  border-radius: 50%;
  border: 3px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 15px;
}
.sso-signedin__name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.45rem;
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}
.sso-signedin__handle {
  margin: 0 0 18px;
  color: var(--muted-2);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.sso-signedin__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.sso-signedin__actions .sso-btn { width: auto; padding: 0 18px; }
.sso-signedin__return {
  display: inline-block;
  margin-top: 18px;
  color: var(--muted);
  font-size: .82rem;
  text-decoration: none;
}
.sso-signedin__return:hover { color: var(--text); }

/* Sent state */
.sso-sent {
  text-align: center;
  padding: 8px 0 0;
}
.sso-sent__icon {
  font-size: 2.6rem;
  margin-bottom: 8px;
}
.sso-sent h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.4rem;
  margin: 0 0 10px;
}
.sso-sent p {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.55;
  margin: 0 0 22px;
}
.sso-sent strong { color: var(--text); }

/* Error */
.sso-error {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .25);
  border-radius: 10px;
  color: #fca5a5;
  font-size: .82rem;
  line-height: 1.5;
}

/* Card footer */
.sso-card__foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  gap: 8px;
  color: var(--muted-2);
  font-size: .74rem;
}
.sso-card__foot a {
  color: var(--muted);
  text-decoration: none;
}
.sso-card__foot a:hover { color: var(--text); }

.sso-tmc {
  text-align: center;
  margin: 18px 0 0;
  color: var(--muted-2);
  font-size: .72rem;
  letter-spacing: .05em;
}
.sso-tmc a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, .12);
  padding-bottom: 2px;
}
.sso-tmc a:hover { color: var(--text); border-bottom-color: rgba(255,255,255,.3); }

/* ===== Account page additions ===== */
.account-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  position: relative;
  z-index: 1;
}
.account-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 32px;
}
.account-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
}
.account-head h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.85rem;
  margin: 0 0 4px;
}
.account-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.account-card {
  background: rgba(15,15,18,.72);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 18px;
}
.account-card h3 {
  margin: 0 0 14px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
}
.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: .9rem;
}
.account-row:first-of-type { border-top: 0; padding-top: 0; }
.account-row label { color: var(--muted); }
.account-input {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  width: 100%;
}
.account-input:focus { outline: none; border-color: var(--cyan); }

/* Responsive */
@media (max-width: 480px) {
  .sso-card { padding: 28px 22px 22px; border-radius: 18px; }
  .sso-card__title { font-size: 1.5rem; }
  .sso-signedin__actions { flex-direction: column; }
  .sso-signedin__actions .sso-btn { width: 100%; }
}
