/* Login Page Theme — Calops Design Language */

/* ── Reset base page styles for login ── */
body.calops-login-page {
  --bg-primary: #07090f;
  --bg-secondary: #111724;
  --bg-tertiary: #0d121d;
  --bg-card: #131a26;
  --border: rgba(255, 255, 255, 0.09);
  --text-primary: #ecf3ff;
  --text-secondary: #9fb0c8;
  --shadow: 0 22px 44px rgba(0, 0, 0, 0.35);
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 20%, rgba(74, 158, 255, 0.10), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(155, 89, 182, 0.06), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(34, 197, 94, 0.05), transparent 35%),
    #07090f;
}

body.calops-login-page.theme-light {
  --bg-primary: #eef4ff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f3f7ff;
  --bg-card: #ffffff;
  --border: rgba(15, 23, 42, 0.10);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
  background:
    radial-gradient(circle at 20% 20%, rgba(74, 158, 255, 0.08), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(155, 89, 182, 0.04), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(34, 197, 94, 0.04), transparent 35%),
    #eef4ff;
}

/* Subtle grid overlay */
body.calops-login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.4;
  z-index: 0;
}

body.calops-login-page.theme-light::before {
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.02) 1px, transparent 1px);
}

/* ── Layout ── */
.login-page {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

/* ── Ambient glow ── */
.login-ambient-glow {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(74, 158, 255, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body.calops-login-page.theme-light .login-ambient-glow {
  background: radial-gradient(circle, rgba(74, 158, 255, 0.06) 0%, transparent 70%);
}

/* ── Card ── */
.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: linear-gradient(
    165deg,
    rgba(19, 26, 38, 0.92),
    rgba(13, 18, 29, 0.96)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}

body.calops-login-page.theme-light .login-card {
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.95),
    rgba(243, 247, 255, 0.98)
  );
  border: 1px solid rgba(15, 23, 42, 0.10);
  box-shadow:
    0 24px 48px rgba(15, 23, 42, 0.10),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

/* ── Card header — branding ── */
.login-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
}

.login-header-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  flex-shrink: 0;
}

body.calops-login-page.theme-light .login-header-logo {
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08) inset;
}

.login-header-text {
  min-width: 0;
}

.login-header-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.login-header-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Card body — forms ── */
.login-body {
  padding: 24px 28px;
}

.login-body h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.login-body .muted {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0 0 20px;
}

.login-body label {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.login-body input[type="text"],
.login-body input[type="password"],
.login-body input[type="email"] {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.calops-login-page.theme-light .login-body input[type="text"],
body.calops-login-page.theme-light .login-body input[type="password"],
body.calops-login-page.theme-light .login-body input[type="email"] {
  background: rgba(15, 23, 42, 0.03);
}

.login-body input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.12);
}

.login-body input::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
}

/* ── Buttons ── */
.login-body button[type="submit"],
.login-body .login-primary-btn {
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  margin-top: 4px;
}

.login-body button[type="submit"]:hover,
.login-body .login-primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px var(--accent-glow);
  background: var(--accent-blue-dark);
}

.login-body button[type="submit"]:active,
.login-body .login-primary-btn:active {
  transform: translateY(0);
}

.login-body button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.login-body button.secondary {
  width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

body.calops-login-page.theme-light .login-body button.secondary {
  background: rgba(15, 23, 42, 0.03);
}

.login-body button.secondary:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

body.calops-login-page.theme-light .login-body button.secondary:hover {
  border-color: rgba(15, 23, 42, 0.18);
  background: rgba(15, 23, 42, 0.06);
}

.login-body button.ghost {
  background: transparent;
  color: var(--accent-blue);
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.login-body button.ghost:hover {
  background: rgba(74, 158, 255, 0.08);
  transform: none;
  box-shadow: none;
}

/* ── Divider ── */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
}

.login-divider hr {
  flex: 1;
  border: none;
  border-top: 1px solid var(--border);
}

.login-divider span {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Error & success messages ── */
.login-body .error {
  color: #ff6b6b;
  font-size: 0.85rem;
  min-height: 0;
  margin: 8px 0 0;
}

.login-body .error:empty {
  display: none;
}

.login-body .success {
  color: #4aff7a;
  font-size: 0.85rem;
}

/* ── Two-factor form ── */
.login-body #two-factor-form h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.login-body #two-factor-form .muted {
  margin-bottom: 16px;
}

.login-body .two-factor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.login-body .two-factor-secondary-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* ── Email code form ── */
.login-body #email-code-form h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary);
}

/* ── Forgot password link ── */
.login-forgot-link {
  margin-top: 18px;
  text-align: center;
}

.login-forgot-link a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.login-forgot-link a:hover {
  color: var(--accent-blue);
}

/* ── Card footer — platform branding ── */
.login-footer {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  opacity: 0.6;
}

.login-footer-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.login-footer .arp-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25em;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  font-size: 0.55rem;
}
.login-footer .arp-brand-apex { color: #ffffff; }
.login-footer .arp-brand-rp {
  font-size: 0.42rem;
  background: linear-gradient(to right, #A7A7A7, #E6E6E6, #A7A7A7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Forgot password modal ── */
.login-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 24px;
}

.login-modal-overlay[hidden] {
  display: none !important;
}

.login-modal {
  width: min(420px, 100%);
  background: linear-gradient(
    165deg,
    rgba(19, 26, 38, 0.96),
    rgba(13, 18, 29, 0.98)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

body.calops-login-page.theme-light .login-modal {
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.98),
    rgba(243, 247, 255, 0.99)
  );
  border: 1px solid rgba(15, 23, 42, 0.10);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.12);
}

.login-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.login-modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.login-modal-header button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

.login-modal-header button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  transform: none;
  box-shadow: none;
}

body.calops-login-page.theme-light .login-modal-header button:hover {
  background: rgba(15, 23, 42, 0.06);
}

.login-modal-body {
  padding: 24px;
}

.login-modal-body .muted {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0 0 18px;
}

.login-modal-body label {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.login-modal-body input[type="email"] {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.calops-login-page.theme-light .login-modal-body input[type="email"] {
  background: rgba(15, 23, 42, 0.03);
}

.login-modal-body input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.12);
}

.login-modal-body .error {
  color: #ff6b6b;
  font-size: 0.85rem;
  min-height: 0;
  margin: 0 0 10px;
}

.login-modal-body .error:empty {
  display: none;
}

.login-modal-body .success {
  color: #4aff7a;
  font-size: 0.85rem;
  margin: 0 0 10px;
}

.login-modal-body button[type="submit"] {
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-modal-body button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px var(--accent-glow);
  background: var(--accent-blue-dark);
}

.login-modal-body button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .login-page {
    padding: 16px;
    align-items: flex-start;
    padding-top: 10vh;
  }

  .login-card {
    border-radius: 16px;
  }

  .login-header {
    padding: 20px 20px 16px;
  }

  .login-body {
    padding: 20px;
  }

  .login-footer {
    padding: 14px 20px;
  }

  .login-header-logo {
    width: 36px;
    height: 36px;
  }

  .login-header-name {
    font-size: 1.05rem;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .login-body button,
  .login-modal-body button {
    transition: none;
  }

  .login-body input,
  .login-modal-body input {
    transition: none;
  }
}
