/* ==========================================================================
   APEX WMS Login Page
   Premium enterprise login experience for warehouse and logistics teams.
   ========================================================================== */

:root {
  --color-primary: #2563eb;
  --color-secondary: #0f172a;
  --color-background: #f8fafc;
  --color-card: rgba(255, 255, 255, 0.82);
  --color-card-solid: #ffffff;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-border: rgba(226, 232, 240, 0.9);
  --color-success: #16a34a;
  --color-warning: #f59e0b;
  --shadow-lg: 0 30px 80px rgba(15, 23, 42, 0.18);
  --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.12);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition-base: 300ms ease;
  --backdrop-blur: 22px;
  --hero-gradient: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(37, 99, 235, 0.78));
}

/* ==========================================================================
   Base / Reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.login-page {
  min-height: 100vh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--color-text);
  background:
    radial-gradient(circle at 12% 14%, rgba(37, 99, 235, 0.12), transparent 22%),
    radial-gradient(circle at 88% 12%, rgba(22, 163, 74, 0.09), transparent 18%),
    radial-gradient(circle at 75% 82%, rgba(245, 158, 11, 0.08), transparent 20%),
    linear-gradient(180deg, #f8fafc 0%, #eff6ff 100%);
  overflow-x: hidden;
}

body.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.18) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent 92%);
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 2000;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--color-secondary);
  color: #fff;
  text-decoration: none;
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 16px;
}

/* ==========================================================================
   Layout Shell
   ========================================================================== */

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand-mark,
.auth-logo {
  display: grid;
  place-items: center;
  width: 138px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(15, 23, 42, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 12px 25px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(var(--backdrop-blur));
  overflow: hidden;
}

.brand-mark__img,
.auth-logo__img {
  width: auto;
  height: 34px;
  max-width: 122px;
  object-fit: contain;
}

.brand-name {
  color: var(--color-secondary);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.topbar-actions .btn-light {
  border-color: rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.78);
  color: var(--color-secondary);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(var(--backdrop-blur));
}

.icon-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-layout {
  flex: 1;
  display: flex;
  align-items: stretch;
  padding-top: 0.25rem;
  padding-bottom: 1.5rem;
}

.login-surface {
  flex: 1;
  border: 1px solid rgba(226, 232, 240, 0.75);
  border-radius: 32px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.38);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

/* ==========================================================================
   Hero Panel
   ========================================================================== */

.hero-panel {
  min-height: 100%;
  color: #fff;
  background: var(--hero-gradient);
  isolation: isolate;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.1), rgba(2, 6, 23, 0.72)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.16), transparent 25%);
  z-index: 1;
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  transform: scale(1.01);
  filter: saturate(1.05) contrast(1.05);
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: clamp(1.5rem, 3vw, 3rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  margin-bottom: 1rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-content h1 {
  margin: 0;
  max-width: 15ch;
  font-size: clamp(2rem, 4.1vw, 3.8rem);
  font-weight: 700;
  line-height: 1.05;
  text-wrap: balance;
}

.hero-copy {
  max-width: 40ch;
  margin: 1rem 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  line-height: 1.75;
}

.hero-stats {
  margin-top: 2rem;
  max-width: 760px;
}

.glass-card {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(var(--backdrop-blur));
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.18);
}

.stat-card {
  padding: 1rem;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.24);
}

.stat-label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
  font-weight: 500;
}

.stat-value {
  font-size: clamp(1.6rem, 2.8vw, 2.45rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

/* ==========================================================================
   Auth Panel
   ========================================================================== */

.auth-panel {
  padding: clamp(1rem, 2.5vw, 2.5rem);
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.9));
}

.auth-card {
  width: 100%;
  max-width: 560px;
  padding: clamp(1.5rem, 3vw, 3rem);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
  transform: translateY(0);
}

.appear-up {
  animation: slide-up 700ms cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

.auth-card__header h2 {
  font-size: clamp(1.8rem, 2.4vw, 2.35rem);
  letter-spacing: -0.04em;
}

.auth-subtext {
  color: var(--color-muted);
}

.auth-form .form-label {
  font-weight: 600;
  color: var(--color-secondary);
}

.input-group-text {
  background: #fff;
  border-color: var(--color-border);
  color: var(--color-muted);
  min-width: 52px;
  justify-content: center;
}

.form-control {
  min-height: 58px;
  border-color: var(--color-border);
  color: var(--color-text);
  box-shadow: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.12);
}

.form-hint {
  display: block;
  margin-top: 0.5rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.form-group.is-focused .input-group-text,
.form-group.is-focused .form-control,
.form-group.is-focused .btn {
  border-color: rgba(37, 99, 235, 0.55);
}

.form-group.is-focused .form-control {
  transform: translateY(-1px);
}

.password-toggle {
  min-width: 58px;
  border-color: var(--color-border);
  color: var(--color-muted);
  background: #fff;
}

.password-toggle:hover,
.password-toggle:focus {
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.06);
}

.remember-check .form-check-input {
  border-color: var(--color-border);
  width: 1.1rem;
  height: 1.1rem;
}

.remember-check .form-check-input:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.forgot-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.forgot-link:hover,
.forgot-link:focus {
  color: #1d4ed8;
  text-decoration: underline;
}

.login-btn {
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--color-primary), #1d4ed8);
  box-shadow: 0 18px 32px rgba(37, 99, 235, 0.28);
  transition: transform var(--transition-base), box-shadow var(--transition-base), filter var(--transition-base);
}

.login-btn:hover,
.login-btn:focus {
  transform: translateY(-2px);
  box-shadow: 0 24px 40px rgba(37, 99, 235, 0.34);
  filter: saturate(1.06);
}

.version-strip {
  padding-top: 1rem;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  color: var(--color-muted);
}

.auth-footer {
  color: var(--color-muted);
}

/* ==========================================================================
   Dropdown / Language Switcher
   ========================================================================== */

.dropdown-shell {
  position: relative;
}

.dropdown-menu-custom {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 30;
  display: none;
  min-width: 180px;
  padding: 0.5rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(var(--backdrop-blur));
}

.dropdown-shell.is-open .dropdown-menu-custom {
  display: block;
}

.dropdown-option {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  color: var(--color-secondary);
  transition: background var(--transition-base), transform var(--transition-base);
}

.dropdown-option:hover,
.dropdown-option:focus,
.dropdown-option.is-active {
  background: rgba(37, 99, 235, 0.08);
  transform: translateX(2px);
}

/* ==========================================================================
   Dark Mode Theme
   ========================================================================== */

html[data-theme='dark'] body.login-page {
  color: #e2e8f0;
  background:
    radial-gradient(circle at 15% 18%, rgba(37, 99, 235, 0.16), transparent 20%),
    radial-gradient(circle at 80% 15%, rgba(16, 185, 129, 0.12), transparent 18%),
    linear-gradient(180deg, #050816 0%, #0f172a 100%);
}

html[data-theme='dark'] .topbar .btn-light,
html[data-theme='dark'] .auth-card,
html[data-theme='dark'] .dropdown-menu-custom {
  background: rgba(15, 23, 42, 0.86);
  color: #e2e8f0;
  border-color: rgba(71, 85, 105, 0.75);
}

html[data-theme='dark'] .brand-name,
html[data-theme='dark'] .auth-card__header h2,
html[data-theme='dark'] .form-label,
html[data-theme='dark'] .dropdown-option {
  color: #e2e8f0;
}

html[data-theme='dark'] .brand-subtitle,
html[data-theme='dark'] .auth-subtext,
html[data-theme='dark'] .form-hint,
html[data-theme='dark'] .version-strip,
html[data-theme='dark'] .auth-footer,
html[data-theme='dark'] .text-muted {
  color: #94a3b8 !important;
}

html[data-theme='dark'] .form-control,
html[data-theme='dark'] .input-group-text,
html[data-theme='dark'] .password-toggle {
  background: rgba(2, 6, 23, 0.65);
  color: #e2e8f0;
  border-color: rgba(71, 85, 105, 0.75);
}

html[data-theme='dark'] .login-surface {
  background: rgba(2, 6, 23, 0.3);
  border-color: rgba(71, 85, 105, 0.45);
}

html[data-theme='dark'] .auth-panel {
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.92), rgba(15, 23, 42, 0.96));
}

html[data-theme='dark'] .dropdown-menu-custom {
  box-shadow: 0 24px 50px rgba(2, 6, 23, 0.5);
}

/* ==========================================================================
   Animation Keyframes
   ========================================================================== */

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-panel,
.auth-panel,
.topbar {
  animation: fade-in 700ms ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.stat-card[data-animated='true'] .stat-value {
  transition: color var(--transition-base);
}

/* ==========================================================================
   Responsive Layout
   ========================================================================== */

@media (min-width: 992px) {
  .login-surface {
    min-height: calc(100vh - 110px);
  }
}

@media (max-width: 991.98px) {
  .login-layout {
    padding-top: 0;
  }

  .login-surface {
    border-radius: 28px;
  }

  .hero-panel {
    min-height: 540px;
  }

  .auth-panel {
    padding-top: 0;
  }
}

@media (max-width: 767.98px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    align-self: flex-end;
  }

  .hero-panel {
    min-height: 600px;
  }

  .hero-content {
    padding: 1.35rem;
  }

  .auth-card {
    padding: 1.35rem;
  }

  .input-group-lg > .form-control,
  .input-group-lg > .input-group-text,
  .input-group-lg > .btn {
    min-height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
