/* ==========================================================================
   APEX WMS OTP Verification Page
   Matches the login and recovery design system.
   ========================================================================== */

: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);
  --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.otp-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.otp-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;
}

.otp-layout {
  flex: 1;
  display: flex;
  align-items: stretch;
  padding-top: 0.25rem;
  padding-bottom: 1.5rem;
}

.otp-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: 14ch;
  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;
}

.security-grid {
  margin-top: 2rem;
  max-width: 700px;
}

.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);
}

.security-card {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding: 1rem;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.security-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.24);
}

.security-card i {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 1.2rem;
}

.security-card span {
  display: block;
  font-weight: 600;
}

.security-card p {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
}

/* ==========================================================================
   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);
}

.otp-meta {
  padding-bottom: 1rem;
}

.otp-label {
  font-weight: 600;
  color: var(--color-secondary);
}

.countdown-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.14);
}

.countdown-label {
  color: var(--color-muted);
  font-size: 0.86rem;
}

.countdown-value {
  color: var(--color-primary);
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.countdown-pulse {
  animation: pulse 900ms ease-in-out infinite;
}

.otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.otp-input {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: #fff;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-secondary);
  box-shadow: none;
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base), background var(--transition-base);
}

.otp-input::placeholder {
  color: #cbd5e1;
}

.otp-input:focus {
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}

.otp-input.is-filled {
  background: rgba(37, 99, 235, 0.03);
}

.action-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);
}

.action-btn:hover,
.action-btn:focus {
  transform: translateY(-2px);
  box-shadow: 0 24px 40px rgba(37, 99, 235, 0.34);
  filter: saturate(1.06);
}

.secondary-actions {
  margin-top: 0.25rem;
}

.resend-link {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.resend-link[disabled],
.resend-link:disabled {
  color: #94a3b8;
  pointer-events: none;
  opacity: 0.7;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.back-link:hover,
.back-link:focus {
  color: #1d4ed8;
  text-decoration: underline;
}

.info-box {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(37, 99, 235, 0.09);
  border: 1px solid rgba(37, 99, 235, 0.16);
  color: #1d4ed8;
}

.info-box i {
  font-size: 1.15rem;
  margin-top: 0.1rem;
}

.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.otp-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,
html[data-theme='dark'] .otp-label {
  color: #e2e8f0;
}

html[data-theme='dark'] .brand-subtitle,
html[data-theme='dark'] .auth-subtext,
html[data-theme='dark'] .version-strip,
html[data-theme='dark'] .auth-footer,
html[data-theme='dark'] .text-muted,
html[data-theme='dark'] .countdown-label {
  color: #94a3b8 !important;
}

html[data-theme='dark'] .otp-input {
  background: rgba(2, 6, 23, 0.65);
  color: #e2e8f0;
  border-color: rgba(71, 85, 105, 0.75);
}

html[data-theme='dark'] .otp-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);
}

html[data-theme='dark'] .info-box {
  background: rgba(37, 99, 235, 0.16);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.22);
}

/* ==========================================================================
   Animation Keyframes
   ========================================================================== */

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.82;
    transform: scale(1.03);
  }
}

.hero-panel,
.auth-panel,
.topbar {
  animation: fade-in 700ms ease both;
}

/* ==========================================================================
   Responsive Layout
   ========================================================================== */

@media (min-width: 992px) {
  .otp-surface {
    min-height: calc(100vh - 110px);
  }
}

@media (max-width: 991.98px) {
  .otp-layout {
    padding-top: 0;
  }

  .otp-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;
  }

  .otp-inputs {
    gap: 0.5rem;
  }

  .otp-input {
    min-height: 62px;
    border-radius: 16px;
    font-size: 1.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
