@import url('../fonts/fonts.css');

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

:root {
  --bg-dark: #060a10;
  --card-bg: rgba(10, 18, 30, 0.8);
  --primary: #00c8f0;
  --primary-dark: #0099bb;
  --primary-light: #40d8ff;
  --primary-glow: rgba(0, 200, 240, 0.25);
  --input-fill: rgba(255, 255, 255, 0.04);
  --input-border: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --text-muted: #8b92a5;
  --text-dim: #52525b;
  --danger: #ef4444;
  --success: #22c55e;
}

html, body { height: 100%; }

body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Background ── */
.bg-overlay {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 70% 20%, rgba(0, 200, 240, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 30% 80%, rgba(0, 100, 180, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(0, 40, 80, 0.1) 0%, transparent 70%);
}

/* ── Main container ── */
.main-container {
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

/* ── Card ── */
.auth-card {
  background: var(--card-bg);
  padding: 48px 40px;
  border-radius: 24px;
  border: 1px solid rgba(0, 200, 240, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

/* ── Logo ── */
.logo-text {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 3px;
  margin-bottom: 6px;
}

.logo-text span {
  color: var(--primary);
}

.desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 32px;
  font-weight: 300;
}

/* ── Alert ── */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

.alert.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.alert.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--success);
}

/* ── Forms ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Input ── */
.input-wrapper {
  position: relative;
  margin-bottom: 18px;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--primary);
  opacity: 0.7;
  pointer-events: none;
  transition: opacity 0.3s;
}

.input-wrapper:focus-within .input-icon {
  opacity: 1;
}

.input-wrapper input {
  width: 100%;
  padding: 15px 16px 15px 48px;
  background: var(--input-fill);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.3s;
}

.input-wrapper input::placeholder {
  color: var(--text-dim);
}

.input-wrapper input:focus {
  border-color: var(--primary);
  background: rgba(0, 200, 240, 0.06);
  box-shadow: 0 0 0 3px rgba(0, 200, 240, 0.08);
}

/* ── Flex row ── */
.flex-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 0.8rem;
}

.link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 400;
  transition: opacity 0.2s;
}

.link:hover { opacity: 0.7; }

/* ── Submit button ── */
.submit-btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #000;
  font-weight: 700;
  font-size: 15px;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.submit-btn:hover {
  filter: brightness(1.15);
  box-shadow: 0 8px 24px var(--primary-glow);
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: translateY(0) scale(0.98);
}

.submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.submit-btn.loading {
  color: transparent;
}

.submit-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Loader (liquid dots) ── */
.loader-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-dark);
  display: flex; justify-content: center; align-items: center;
  transition: opacity 0.4s;
}

.loader-overlay.hidden { opacity: 0; pointer-events: none; }

.liquid-dots {
  display: flex;
  gap: 15px;
}

.liquid-dots span {
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary-dark);
  animation: liquid-bounce 1.4s infinite ease-in-out both;
}

.liquid-dots span:nth-child(1) { animation-delay: -0.32s; }
.liquid-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes liquid-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* ── Footer ── */
.card-footer {
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.card-footer a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.card-footer a:hover { color: var(--primary); }

/* ── Social ── */
.social-section { margin-top: 28px; }

.social-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  color: var(--text-dim);
  font-size: 12px;
}

.social-divider::before,
.social-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--input-border);
}

.social-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: var(--input-fill);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
}

.social-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.social-btn svg { width: 20px; height: 20px; flex-shrink: 0; }

.social-btn.google:hover { border-color: rgba(234, 67, 53, 0.3); }
.social-btn.github:hover { border-color: rgba(255, 255, 255, 0.25); }
.social-btn.microsoft:hover { border-color: rgba(0, 120, 212, 0.3); }
.social-btn.discord:hover { border-color: rgba(88, 101, 242, 0.3); }
.social-btn.apple:hover { border-color: rgba(255, 255, 255, 0.25); }

/* ── Responsive ── */
@media (max-width: 600px) {
  body {
    display: block;
    overflow-y: auto;
    min-height: 100vh;
    padding: 0;
  }
  .main-container {
    padding: 16px;
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    padding-bottom: 60px;
  }
  .auth-card {
    padding: 32px 20px;
    border-radius: 20px;
    width: 100%;
  }
  .logo-text { font-size: 1.5rem; }
  .desc { font-size: 13px !important; }
  .input-wrapper input { font-size: 16px !important; }
  .submit-btn { font-size: 16px !important; }
  .social-btns { flex-direction: column; gap: 8px; }
  .social-btn { width: 100%; justify-content: center; }
}

/* ── App branding (when ?redirect= points to a GolemTech app) ── */
.app-branding {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 4px 0 18px;
  padding: 14px 12px;
  background: rgba(0, 200, 240, 0.04);
  border: 1px solid rgba(0, 200, 240, 0.15);
  border-radius: 12px;
  animation: appBrandingFade 0.5s ease;
}
.app-branding img {
  max-height: 64px;
  max-width: 140px;
  filter: drop-shadow(0 0 12px rgba(0, 200, 240, 0.35));
}
.app-branding p {
  font-size: 13px;
  color: #b8c0d0;
  text-align: center;
  margin: 0;
}
.app-branding p strong {
  color: var(--primary);
  font-weight: 600;
}
@keyframes appBrandingFade {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
