/*
 * Luumtech2 Admin Theme - Login Page
 * Pixel-perfect copy of client theme login design
 * Full dark/light mode support via data-theme attribute
 * 
 * @author Luumtech
 * @version 3.0.0
 */

/* ==========================================
   SHOW-DARK / SHOW-LIGHT VISIBILITY PATTERN
   (Same as client theme)
   ========================================== */
.show-dark,
.show-light {
  display: none !important;
}

html[data-theme="dark"] .show-dark {
  display: inline-flex !important;
}

html[data-theme="light"] .show-light {
  display: inline-flex !important;
}

/* Theme Toggle Icon Visibility */
.theme-toggle-icon.show-dark,
.theme-toggle-icon.show-light {
  display: none;
}

html[data-theme="dark"] .theme-toggle-icon.show-dark {
  display: inline-flex;
}

html[data-theme="light"] .theme-toggle-icon.show-light {
  display: inline-flex;
}

/* Login brand logo visibility */
.login-brand.show-dark,
.login-brand.show-light {
  display: none !important;
}

html[data-theme="dark"] .login-brand.show-dark {
  display: inline-block !important;
}

html[data-theme="light"] .login-brand.show-light {
  display: inline-block !important;
}

/* ==========================================
   LOGIN HEADER BAR — Client theme navbar
   (Exact copy of client's floating pill navbar)
   ========================================== */
.login-header-bar {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 1200px;
  width: calc(100% - 48px);
  z-index: 1000;
  background: rgba(17, 17, 19, 0.35);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 310px;
  box-shadow: none;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
}

html[data-theme="light"] .login-header-bar {
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Login Logo */
.login-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.login-logo a,
.login-brand {
  display: block;
  color: var(--lg-text-primary) !important;
  text-decoration: none !important;
}

.login-logo img,
.login-brand img {
  height: 24px;
  width: auto;
}

.login-brand-text {
  color: var(--lg-text-primary);
  font-weight: 600;
  font-size: 18px;
  text-decoration: none !important;
}

html[data-theme="dark"] .login-logo .show-light {
  display: none !important;
}
html[data-theme="dark"] .login-logo .show-dark {
  display: inline-block !important;
}
html[data-theme="light"] .login-logo .show-dark {
  display: none !important;
}
html[data-theme="light"] .login-logo .show-light {
  display: inline-block !important;
}

/* Login Nav Links */
.login-nav {
  display: flex;
  align-items: center;
  gap: 0;
}

.login-nav a {
  color: var(--lg-text-secondary) !important;
  padding: 8px 14px;
  font-size: var(--lg-font-size-sm);
  font-weight: 400;
  border-radius: 310px;
  line-height: 1.4;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none !important;
}

.login-nav a:hover {
  color: var(--lg-text-primary) !important;
  background: var(--lg-glass-bg-light);
}

.login-nav a.active {
  color: #ffffff !important;
  background: var(--lg-accent) !important;
}

html[data-theme="light"] .login-nav a.active {
  color: #ffffff !important;
  background: var(--lg-accent) !important;
}

/* Nav Icons */
.nav-icon {
  flex-shrink: 0;
  vertical-align: middle;
}

.login-nav a .nav-icon {
  margin-right: 2px;
}

/* ==========================================
   THEME TOGGLE — 44×44 circle (client match)
   ========================================== */
.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 12px;
  width: 44px;
  height: 44px;
  background: var(--lg-glass-bg);
  border: 1px solid var(--lg-border);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 8px;
}

.theme-toggle:hover {
  background: var(--lg-glass-bg-light);
  border-color: var(--lg-accent);
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lg-text-secondary);
  transition: all 0.15s ease;
}

.theme-toggle:hover .theme-toggle-icon {
  color: var(--lg-accent);
}

html[data-theme="light"] .theme-toggle {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(148, 163, 184, 0.34);
  color: #6b7280;
}

html[data-theme="light"] .theme-toggle:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

/* ==========================================
   ANIMATED BACKGROUND — Exact client theme
   ========================================== */
.login-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  background: var(--lg-bg-primary);
}

/* Keep admin login dark background identical to client theme dark primary */
html[data-theme="dark"] body.authentication,
html[data-theme="dark"] .login-bg {
  background: #0a0a0c !important;
}

.gradient-mesh {
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.12) 0%, transparent 45%),
    radial-gradient(ellipse at 60% 80%, rgba(34, 211, 238, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 10% 70%, rgba(var(--lg-accent-rgb), 0.1) 0%, transparent 40%);
  animation: gradientShift 20s ease infinite;
}

html[data-theme="light"] .gradient-mesh {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 45%),
    radial-gradient(ellipse at 60% 80%, rgba(34, 211, 238, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 10% 70%, rgba(var(--lg-accent-rgb), 0.05) 0%, transparent 40%);
}

@keyframes gradientShift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(2%, 2%) rotate(1deg); }
  50% { transform: translate(-1%, 3%) rotate(-1deg); }
  75% { transform: translate(1%, -2%) rotate(0.5deg); }
}

/* Floating Orbs */
.floating-orbs {
  position: absolute;
  width: 100%;
  height: 100%;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 25s ease-in-out infinite;
}

html[data-theme="light"] .orb {
  opacity: 0.2;
}

.orb-1 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(var(--lg-accent-rgb), 0.4) 0%, transparent 70%);
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.orb-2 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.35) 0%, transparent 70%);
  top: 60%;
  right: 10%;
  animation-delay: -5s;
}

.orb-3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, transparent 70%);
  bottom: 20%;
  left: 20%;
  animation-delay: -10s;
}

.orb-4 {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, transparent 70%);
  top: 30%;
  right: 25%;
  animation-delay: -7s;
}

.orb-5 {
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.2) 0%, transparent 70%);
  top: 5%;
  right: 40%;
  animation-delay: -12s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0) scale(1); }
  25% { transform: translateY(-20px) translateX(15px) scale(1.02); }
  50% { transform: translateY(15px) translateX(-20px) scale(0.98); }
  75% { transform: translateY(-15px) translateX(-15px) scale(1.01); }
}

/* Grid Overlay */
.grid-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.5;
}

html[data-theme="light"] .grid-overlay {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
}

/* ==========================================
   LOGIN LAYOUT — Client structure
   (login-container > login-wrapper > login-card)
   ========================================== */
body.authentication {
  background: var(--lg-bg-primary) !important;
  font-family: var(--lg-font-family) !important;
  min-height: 100vh;
}

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

.login-wrapper {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Login Card — exact client theme design */
.login-card {
  width: 100%;
  background: var(--lg-bg-secondary);
  border: 1px solid var(--lg-border);
  border-radius: 30px;
  box-shadow: none;
  overflow: hidden;
  transition: all 0.3s ease;
}

html[data-theme="light"] .login-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: none;
}

.login-card-header {
  padding: 32px 32px 0;
  text-align: center;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--lg-text-primary);
  margin: 0 0 4px;
}

.login-subtitle {
  color: var(--lg-text-muted);
  font-size: 0.875rem;
  margin: 0;
  font-weight: 300;
}

.login-card-body {
  padding: 24px 32px 32px;
}

/* ==========================================
   LOGIN FORM — Inputs, Labels, Controls
   ========================================== */
.login-card .form-group {
  margin-bottom: 16px;
}

.login-card .control-label,
.login-card label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--lg-text-secondary);
  margin-bottom: 8px;
  display: block;
}

.login-card .form-control {
  width: 100%;
  height: 44px;
  padding: 10px 14px;
  font-size: 0.875rem;
  border-radius: 8px;
  border: 1px solid var(--lg-border);
  background: var(--lg-bg-tertiary);
  color: var(--lg-text-primary);
  font-family: var(--lg-font-family);
  transition: all 0.2s ease;
  box-shadow: none;
}

html[data-theme="light"] .login-card .form-control {
  background: #f9fafb;
  border-color: #d1d5db;
}

.login-card .form-control:focus {
  border-color: var(--lg-accent);
  box-shadow: 0 0 0 3px rgba(var(--lg-accent-rgb), 0.1);
  background: var(--lg-bg-elevated);
  outline: none;
}

html[data-theme="light"] .login-card .form-control:focus {
  background: #ffffff;
}

.login-card .form-control::placeholder {
  color: var(--lg-text-muted);
}

/* Login button — block style */
.login-card .btn-block {
  width: 100%;
  display: block;
  padding: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  position: relative;
}

.login-card .btn-primary {
  background: var(--lg-accent);
  border: none;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-card .btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 2px 8px rgba(var(--lg-accent-rgb), 0.3);
}

/* Button Loader */
.login-card .btn-loader {
  display: none;
}

.login-card .btn-primary.loading .btn-text {
  visibility: hidden;
}

.login-card .btn-primary.loading .btn-loader {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.spinner {
  width: 20px;
  height: 20px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Password Toggle Eye Icon */
.login-card .password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--lg-text-muted);
  z-index: 10;
  display: flex;
  align-items: center;
}

.login-card .password-toggle:hover {
  color: var(--lg-text-primary);
}

.eye-icon.hide {
  display: none;
}

.eye-icon.show {
  display: block;
}

/* Password input padding for eye icon */
.login-card div[style*="position: relative"] .form-control {
  padding-right: 44px !important;
}

/* Forgot Password Link */
.login-card .forgot-link {
  font-size: 0.75rem;
  color: var(--lg-text-muted);
  text-decoration: none;
}

.login-card .forgot-link:hover {
  color: var(--lg-accent);
}

/* ==========================================
   SWITCH TOGGLE — Remember Me
   ========================================== */
.switch-toggle {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  margin: 0 !important;
}

.switch-toggle input[type="checkbox"] {
  display: none !important;
}

.switch-track {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--lg-border);
  border-radius: 999px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

html[data-theme="light"] .switch-track {
  background: #e2e8f0;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}

.switch-toggle input[type="checkbox"]:checked ~ .switch-track {
  background: var(--lg-accent);
}

.switch-toggle input[type="checkbox"]:checked ~ .switch-track .switch-thumb {
  transform: translateX(18px);
}

.switch-label {
  font-size: 13px !important;
  color: var(--lg-text-muted) !important;
  font-weight: 400 !important;
}

/* ==========================================
   LOGIN FOOTER
   ========================================== */
.login-footer {
  text-align: center;
  color: var(--lg-text-muted);
  font-size: 0.6875rem;
  padding: 16px 0;
}

.login-footer p {
  color: var(--lg-text-muted);
  font-size: 0.6875rem;
  margin: 0;
}

/* ==========================================
   LANGUAGE DROPDOWN IN HEADER BAR
   ========================================== */
.login-lang-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
}

.login-lang-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--lg-text-secondary);
  font-size: 13px;
  transition: all 0.15s ease;
}

.login-lang-btn:hover {
  background: var(--lg-glass-bg-light);
  color: var(--lg-text-primary);
}

.login-lang-btn .lang-flag {
  font-size: 16px;
  line-height: 1;
}

.login-lang-btn .dropdown-caret {
  width: 10px;
  height: 10px;
  transition: transform 0.2s ease;
}

.login-lang-dropdown.open .login-lang-btn .dropdown-caret {
  transform: rotate(180deg);
}

.login-lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--lg-bg-elevated);
  border: 1px solid var(--lg-border);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  padding: 6px;
  z-index: 1001;
}

html[data-theme="light"] .login-lang-menu {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(148, 163, 184, 0.22);
}

.login-lang-dropdown.open .login-lang-menu {
  display: block;
}

/* Admin auth fallback: keep language menu functional without bootstrap dropdown JS */
.admin-auth-navbar .customers-nav-item-language > .dropdown-menu-lang {
  display: none;
}

.admin-auth-navbar .customers-nav-item-language.open > .dropdown-menu-lang {
  display: block;
}

.login-lang-item {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--lg-text-secondary) !important;
  text-decoration: none !important;
  transition: background 0.12s ease;
  white-space: nowrap;
}

.login-lang-item:hover {
  background: rgba(var(--lg-accent-rgb), 0.08) !important;
  color: var(--lg-accent) !important;
}

.login-lang-item.active {
  background: rgba(var(--lg-accent-rgb), 0.12) !important;
  color: var(--lg-accent) !important;
  font-weight: 500;
}

.login-lang-item .lang-flag {
  font-size: 16px;
  line-height: 1;
}

/* ==========================================
   ALERT MESSAGES
   ========================================== */
body.authentication .alert {
  background: var(--lg-bg-tertiary) !important;
  border: 1px solid var(--lg-border) !important;
  border-radius: 8px !important;
  color: var(--lg-text-primary) !important;
}

body.authentication .alert-danger {
  border-left: 4px solid var(--lg-danger) !important;
}

/* ==========================================
   ANIMATION — Fade in elements
   ========================================== */
.animated {
  animation-duration: 0.6s;
  animation-fill-mode: both;
}

.fadeInUp {
  animation-name: fadeInUp;
}

.fadeIn {
  animation-name: fadeIn;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================
   RECAPTCHA
   ========================================== */
.recaptcha-wrapper {
  margin-bottom: 16px;
}

/* ==========================================
   HIDE COMPANY LOGO (already in header)
   ========================================== */
body.authentication .company-logo {
  display: none !important;
}

/* ==========================================
   RESPONSIVE — Mobile
   ========================================== */
@media (max-width: 768px) {
  .login-header-bar {
    padding: 8px 14px;
  }

  .login-logo img,
  .login-brand img {
    height: 20px;
  }

  .login-nav a {
    padding: 6px 10px;
    font-size: 12px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    padding: 8px;
  }

  .login-card-header {
    padding: 24px 20px 0;
  }

  .login-card-body {
    padding: 20px 20px 24px;
  }
}
