/* ==========================================================================
   ManagecasesAI — Immersive Glassmorphism Login
   A full-screen animated mesh-gradient background with a floating glass card.
   ========================================================================== */

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

body {
  font-family: "Outfit", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Utility */
.hidden { display: none !important; }

/* ── Scene (Full Viewport) ─────────────────────────────── */
.login-scene {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f0b2e;      /* Fallback */
  overflow: hidden;
}

/* ── Mesh Gradient Base ────────────────────────────────── */
.mesh-gradient {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 80%, #4f46e5 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, #7c3aed 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, #1e1b4b 0%, #0f0b2e 70%);
  z-index: 0;
}

/* ── Animated Orbs ─────────────────────────────────────── */
.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  z-index: 1;
  will-change: transform;
}

.orb-1 {
  width: 450px; height: 450px;
  background: #6366f1;
  top: -10%; left: -5%;
  animation: drift-1 14s ease-in-out infinite alternate;
}

.orb-2 {
  width: 350px; height: 350px;
  background: #a855f7;
  bottom: -5%; right: -10%;
  animation: drift-2 18s ease-in-out infinite alternate;
}

.orb-3 {
  width: 250px; height: 250px;
  background: #818cf8;
  top: 40%; right: 25%;
  animation: drift-3 12s ease-in-out infinite alternate;
}

@keyframes drift-1 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(80px, 60px) scale(1.15); }
}
@keyframes drift-2 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-60px, -40px) scale(1.1); }
}
@keyframes drift-3 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, -70px) scale(0.9); }
}

/* ── Noise Texture Overlay ─────────────────────────────── */
.noise-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  pointer-events: none;
}

/* ── Glass Card ────────────────────────────────────────── */
.glass-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  padding: 4px;                      /* Border-glow effect via padding */
  border-radius: 24px;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.15) 0%,
    rgba(255,255,255,0.05) 100%);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.08);
  animation: card-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.glass-card__inner {
  background: rgba(15, 11, 46, 0.72);
  backdrop-filter: blur(30px) saturate(1.4);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  border-radius: 20px;
  padding: 40px 36px;
}

/* ── Logo ──────────────────────────────────────────────── */
.glass-card__logo {
  text-align: center;
  margin-bottom: 28px;
}

.glass-card__logo img {
  max-width: 200px;
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(99,102,241,0.25));
}

/* ── Header ────────────────────────────────────────────── */
.glass-card__header {
  text-align: center;
  margin-bottom: 32px;
}

.glass-card__header h1 {
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.glass-card__header p {
  font-size: 14px;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
}

/* ── Alert ─────────────────────────────────────────────── */
.glass-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
}

.glass-alert i { font-size: 16px; flex-shrink: 0; color: #f87171; }

/* ── Field ─────────────────────────────────────────────── */
.field {
  margin-bottom: 20px;
}

.field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.field__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field__icon {
  position: absolute;
  left: 14px;
  font-size: 14px;
  color: rgba(255,255,255,0.3);
  pointer-events: none;
  transition: color 0.2s;
}

.field__input {
  width: 100%;
  padding: 13px 14px 13px 42px;
  font-family: "Outfit", sans-serif;
  font-size: 15px;
  color: #ffffff;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  outline: none;
  transition: all 0.25s;
  -webkit-appearance: none;
  appearance: none;
}

.field__input::placeholder {
  color: rgba(255,255,255,0.25);
}

.field__input:focus {
  background: rgba(255,255,255,0.1);
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}

.field__input:focus ~ .field__icon {
  color: #818cf8;
}

.field__toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.field__toggle:hover { color: rgba(255,255,255,0.7); }

/* ── Options Row ───────────────────────────────────────── */
.options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  margin-top: 4px;
}

/* Custom checkbox */
.remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  user-select: none;
}

.remember-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkmark {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  transition: all 0.2s;
  position: relative;
  flex-shrink: 0;
}

.remember-label input:checked ~ .checkmark {
  background: #6366f1;
  border-color: #6366f1;
}

.remember-label input:checked ~ .checkmark::after {
  content: '';
  position: absolute;
  left: 5px; top: 2px;
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.forgot-link {
  font-size: 13px;
  color: #818cf8;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

/* ── Sign-In Button ────────────────────────────────────── */
.btn-sign-in {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  font-family: "Outfit", sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(99,102,241,0.35);
  position: relative;
  overflow: hidden;
}

.btn-sign-in::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-sign-in:hover::before { opacity: 1; }

.btn-sign-in:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99,102,241,0.45);
}

.btn-sign-in:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.btn-sign-in:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-arrow {
  font-size: 14px;
  transition: transform 0.3s;
}

.btn-sign-in:hover .btn-arrow {
  transform: translateX(3px);
}

/* ── Theme Toggle (Floating) ──────────────────────────── */
.theme-toggle-float {
  position: absolute;
  top: 24px; right: 24px;
  z-index: 20;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.25s;
}

.theme-toggle-float:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  transform: scale(1.05);
}

/* ── Spinner ───────────────────────────────────────────── */
.fa-spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Light Theme Override ──────────────────────────────── */
[data-theme="light"] .login-scene {
  background: #f0f0f8;
}

[data-theme="light"] .mesh-gradient {
  background:
    radial-gradient(ellipse at 20% 80%, rgba(99,102,241,0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(168,85,247,0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, #e8e6f8 0%, #f0f0f8 70%);
}

[data-theme="light"] .mesh-orb { opacity: 0.25; }

[data-theme="light"] .glass-card {
  background: linear-gradient(135deg,
    rgba(255,255,255,0.6) 0%,
    rgba(255,255,255,0.3) 100%);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.5);
}

[data-theme="light"] .glass-card__inner {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

[data-theme="light"] .glass-card__header h1 { color: #1e1b4b; }
[data-theme="light"] .glass-card__header p { color: #6b7280; }

[data-theme="light"] .field__label { color: #374151; }
[data-theme="light"] .field__icon { color: #9ca3af; }

[data-theme="light"] .field__input {
  background: rgba(0, 0, 0, 0.03);
  border-color: #d1d5db;
  color: #111827;
}
[data-theme="light"] .field__input::placeholder { color: #9ca3af; }
[data-theme="light"] .field__input:focus {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
[data-theme="light"] .field__input:focus ~ .field__icon { color: #6366f1; }

[data-theme="light"] .field__toggle { color: #9ca3af; }
[data-theme="light"] .field__toggle:hover { color: #4b5563; }

[data-theme="light"] .remember-label { color: #6b7280; }
[data-theme="light"] .checkmark {
  border-color: #d1d5db;
  background: rgba(0,0,0,0.03);
}
[data-theme="light"] .remember-label input:checked ~ .checkmark {
  background: #6366f1;
  border-color: #6366f1;
}

[data-theme="light"] .forgot-link { color: #6366f1; }
[data-theme="light"] .forgot-link:hover { color: #4f46e5; }

[data-theme="light"] .glass-alert {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #b91c1c;
}
[data-theme="light"] .glass-alert i { color: #dc2626; }

[data-theme="light"] .theme-toggle-float {
  border-color: rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.7);
  color: #374151;
}
[data-theme="light"] .theme-toggle-float:hover {
  background: rgba(255,255,255,0.9);
  color: #111827;
}

[data-theme="light"] .noise-overlay { opacity: 0.02; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 480px) {
  .glass-card {
    max-width: 100%;
    margin: 0 16px;
    border-radius: 20px;
  }

  .glass-card__inner {
    padding: 32px 24px;
    border-radius: 16px;
  }

  .glass-card__logo img {
    max-width: 160px;
  }

  .glass-card__header h1 { font-size: 22px; }

  .theme-toggle-float {
    top: 16px; right: 16px;
    width: 38px; height: 38px;
    font-size: 14px;
  }
}