/* ═══ IntelliDB Enterprise — Login & Splash Screen ═══ */

/* ─── Login Screen ─── */
.login-screen {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-base, #0B1929);
  font-family: var(--font-ui, 'DM Sans', sans-serif);
  overflow: hidden;
}

/* Animated background orbs */
.login-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.15;
  animation: orbFloat 20s ease-in-out infinite;
}
.login-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #D39E57 0%, transparent 70%);
  top: -10%; left: -5%;
  animation-duration: 18s;
}
.login-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #153244 0%, transparent 70%);
  bottom: -15%; right: -5%;
  animation-duration: 22s; animation-delay: -5s;
}
.login-orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #1a6b8a 0%, transparent 70%);
  top: 50%; left: 60%;
  animation-duration: 25s; animation-delay: -10s;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(10px, 30px) scale(1.02); }
}

/* Card */
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  padding: 40px 36px 32px;
  background: rgba(15, 32, 50, 0.7);
  backdrop-filter: blur(40px) saturate(150%);
  -webkit-backdrop-filter: blur(40px) saturate(150%);
  border: 1px solid rgba(211, 158, 87, 0.12);
  border-radius: 20px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.03) inset;
  animation: loginCardIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Logo */
.login-logo {
  display: flex; justify-content: center;
  margin-bottom: 24px;
}
.login-logo-img {
  width: 80px; height: 80px; object-fit: contain;
  filter: drop-shadow(0 4px 20px rgba(211, 158, 87, 0.25));
  animation: logoSpin 1s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes logoSpin {
  from { opacity: 0; transform: scale(0.5) rotate(-10deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Typography */
.login-title {
  text-align: center; font-size: 24px; font-weight: 700;
  color: #f0f6fc; letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.login-subtitle {
  text-align: center; font-size: 13px;
  color: #6e8fa8; margin-bottom: 28px;
}

/* Form */
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-label {
  font-size: 12px; font-weight: 500; color: #b0c4d8;
  letter-spacing: 0.02em;
}
.login-input-wrap {
  position: relative; display: flex; align-items: center;
}
.login-input-icon {
  position: absolute; left: 12px;
  color: #4a6a80; pointer-events: none;
  transition: color 0.2s;
}
.login-input {
  width: 100%; padding: 11px 12px 11px 40px;
  background: rgba(11, 25, 41, 0.6);
  border: 1px solid rgba(110, 143, 168, 0.15);
  border-radius: 10px; color: #f0f6fc;
  font-size: 14px; font-family: inherit;
  outline: none; transition: all 0.2s;
}
.login-input::placeholder { color: #4a6a80; }
.login-input:focus {
  border-color: rgba(211, 158, 87, 0.4);
  box-shadow: 0 0 0 3px rgba(211, 158, 87, 0.08);
}
.login-input:focus ~ .login-input-icon,
.login-input:focus + .login-input-icon { color: #D39E57; }
.login-input-wrap:focus-within .login-input-icon { color: #D39E57; }

.login-eye-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #4a6a80;
  cursor: pointer; padding: 4px; border-radius: 4px;
  transition: color 0.2s;
}
.login-eye-btn:hover { color: #b0c4d8; }

/* Error */
.login-error {
  font-size: 12px; color: #f87171; text-align: center;
  min-height: 16px; transition: opacity 0.2s;
}

/* Button */
.login-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, #D39E57 0%, #c4893e 100%);
  border: none; border-radius: 10px;
  color: #0B1929; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: all 0.2s; margin-top: 4px;
  min-height: 44px; position: relative;
}
.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(211, 158, 87, 0.3);
}
.login-btn:active {
  transform: translateY(0) scale(0.98);
}
.login-btn:disabled {
  opacity: 0.6; cursor: not-allowed; transform: none;
  box-shadow: none;
}
.login-spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(11, 25, 41, 0.3);
  border-top-color: #0B1929;
  border-radius: 50%;
  animation: loginSpin 0.6s linear infinite;
}
@keyframes loginSpin { to { transform: rotate(360deg); } }

/* Footer */
.login-footer {
  margin-top: 20px; text-align: center;
  padding-top: 16px; border-top: 1px solid rgba(110, 143, 168, 0.08);
}
.login-footer-text {
  font-size: 11px; color: #4a6a80;
  font-family: var(--font-mono, 'DM Mono', monospace);
}

.login-version {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: #3a5a70; letter-spacing: 0.04em;
}

/* ─── Splash / Loading Screen ─── */
.splash-screen {
  position: fixed; inset: 0; z-index: 10001;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-base, #0B1929);
  font-family: var(--font-ui, 'DM Sans', sans-serif);
}
.splash-content {
  display: flex; flex-direction: column; align-items: center;
  gap: 20px;
  animation: splashIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes splashIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.splash-logo {
  width: 100px; height: 100px; object-fit: contain;
  filter: drop-shadow(0 4px 30px rgba(211, 158, 87, 0.3));
  animation: splashLogoPulse 2s ease-in-out infinite;
}
@keyframes splashLogoPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 4px 30px rgba(211, 158, 87, 0.3)); }
  50% { transform: scale(1.04); filter: drop-shadow(0 4px 40px rgba(211, 158, 87, 0.5)); }
}
.splash-title {
  font-size: 22px; font-weight: 700; color: #f0f6fc;
  letter-spacing: -0.01em;
}
.splash-progress {
  width: 200px; height: 3px;
  background: rgba(110, 143, 168, 0.15);
  border-radius: 3px; overflow: hidden;
}
.splash-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #D39E57, #e8b86d);
  border-radius: 3px;
  transition: width 0.3s ease-out;
}
.splash-status {
  font-size: 12px; color: #6e8fa8;
  letter-spacing: 0.02em;
  animation: statusPulse 1.5s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Splash exit animation */
.splash-exit {
  animation: splashOut 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes splashOut {
  to { opacity: 0; transform: scale(1.05); }
}

/* Login exit */
.login-exit {
  animation: loginOut 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes loginOut {
  to { opacity: 0; transform: scale(0.96); }
}

/* App enter */
.app-enter {
  animation: appIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.1s;
}
@keyframes appIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Light theme adjustments ─── */
[data-theme="light"] .login-screen { background: #f4f6f8; }
[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(21, 50, 68, 0.08);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .login-title { color: #153244; }
[data-theme="light"] .login-subtitle { color: #6e8fa8; }
[data-theme="light"] .login-label { color: #3a5a70; }
[data-theme="light"] .login-input {
  background: rgba(244, 246, 248, 0.8);
  border-color: rgba(21, 50, 68, 0.1);
  color: #153244;
}
[data-theme="light"] .splash-screen { background: #f4f6f8; }
[data-theme="light"] .splash-title { color: #153244; }

/* Shake on error */
@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-6px); }
  30%, 70% { transform: translateX(6px); }
}

/* Responsive */
@media (max-width: 480px) {
  .login-card { margin: 16px; padding: 28px 20px 24px; border-radius: 16px; }
  .login-logo-img { width: 64px; height: 64px; }
  .login-title { font-size: 20px; }
}

/* ─── v0.3.16 — login-page theme toggle + forgot-password modal ─── */
.login-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.login-theme-toggle:hover { background: rgba(255,255,255,0.12); transform: scale(1.05); border-color: var(--accent); color: var(--accent); }
[data-theme="light"] .login-theme-toggle { background: rgba(21,50,68,0.06); border-color: rgba(21,50,68,0.12); }
[data-theme="light"] .login-theme-toggle:hover { background: rgba(211,158,87,0.15); border-color: var(--accent); }
[data-theme="light"] .login-theme-icon-dark { display: none !important; }
[data-theme="light"] .login-theme-icon-light { display: block !important; }

.login-forgot {
  background: none;
  border: 0;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  margin-top: 12px;
  padding: 6px 8px;
  width: 100%;
  text-align: center;
  transition: color 120ms ease;
}
.login-forgot:hover { color: var(--accent); text-decoration: underline; }

/* Forgot-password modal — needs its own CSS because it lives outside
   the SPA shell where the global modal-overlay styles aren't loaded
   yet (helpers.js / app.js haven't booted at this point). */
.login-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 24, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: loginModalFade 180ms ease both;
}
@keyframes loginModalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
[data-theme="light"] .login-modal-overlay { background: rgba(244, 246, 248, 0.78); }

.login-modal-card {
  background: rgba(15, 25, 38, 0.92);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  animation: loginModalUp 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes loginModalUp {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
[data-theme="light"] .login-modal-card {
  background: #ffffff;
  border-color: rgba(21,50,68,0.1);
  box-shadow: 0 24px 64px rgba(0,0,0,0.12);
}

.login-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.login-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
}
[data-theme="light"] .login-modal-title { color: #153244; }
.login-modal-close {
  background: none;
  border: 0;
  color: var(--text-3);
  font-size: 24px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}
.login-modal-close:hover { color: var(--accent); }
.login-modal-text {
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.55;
}
[data-theme="light"] .login-modal-text { color: #6e8fa8; }

/* ─── 2026 depth polish ───────────────────────────────────────────────
   The light theme previously rendered a flat #f4f6f8 wash with the brand
   orbs nearly invisible, so the login read as plain. Give it a soft branded
   mesh + a frosted-glass card with real elevation so it matches the premium
   feel of the dark theme. Dark theme already has depth (orbs on #0B1929) —
   we only add a faint top vignette there for a touch more dimension. */
[data-theme="light"] .login-screen {
  background:
    radial-gradient(1100px 620px at 14% 8%,  rgba(211, 158, 87, 0.14), transparent 58%),
    radial-gradient(950px 700px at 88% 96%,  rgba(21, 50, 68, 0.10),   transparent 55%),
    radial-gradient(700px 500px at 62% 46%,  rgba(26, 107, 138, 0.06), transparent 60%),
    #eef2f7;
}
[data-theme="light"] .login-orb { opacity: 0.12; filter: blur(90px); }
[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(34px) saturate(150%);
  -webkit-backdrop-filter: blur(34px) saturate(150%);
  border: 1px solid rgba(21, 50, 68, 0.09);
  box-shadow:
    0 28px 70px rgba(21, 50, 68, 0.16),
    0 4px 14px rgba(21, 50, 68, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Dark theme — faint overhead vignette adds depth without touching the orbs. */
.login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 50% -10%, rgba(211, 158, 87, 0.05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
[data-theme="light"] .login-screen::before {
  background: radial-gradient(120% 80% at 50% -10%, rgba(255, 255, 255, 0.5), transparent 55%);
}

/* Respect reduced-motion — stop the orb drift for users who opt out. */
@media (prefers-reduced-motion: reduce) {
  .login-orb,
  .login-logo-img,
  .splash-logo { animation: none !important; }
}
