:root {
  --tenant-primary-color: #2563EB;
  --tenant-secondary-color: #F9FAFB;
  --tenant-primary-color-rgb: 37, 99, 235;
}

body.login-page {
  font-family: var(--font-primary, 'Inter', 'Noto Sans', sans-serif);
  margin: 0;
  color: #2D3748;
  padding: 0;
  min-height: 100vh;
}

body.login-page.no-tenant {
  background: linear-gradient(135deg, var(--tenant-primary-color) 0%, var(--tenant-primary-color) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

body.login-page.no-tenant::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.footer-text {
  text-align: center;
}

.video-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 255, 0.3);
  /* Blue tint overlay */
  z-index: 0;
}

.login-container {
  min-height: 100vh;
  display: flex;
  background-color: var(--tenant-secondary-color);
}

body.login-page.no-tenant .login-container {
  min-height: auto;
  background: none;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

body.login-page.no-tenant .login-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

body.login-page.no-tenant .login-title {
  color: #1E40AF;
}

body.login-page.no-tenant .login-subtitle {
  color: #4B5563;
}

body.login-page.no-tenant .form-control {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
}

body.login-page.no-tenant .form-control:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

body.login-page.no-tenant .btn-primary {
  background: #2563EB;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

body.login-page.no-tenant .btn-primary:hover {
  background: #1D4ED8;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

body.login-page.no-tenant .forgot-password {
  color: #2563EB;
}

body.login-page.no-tenant .login-footer {
  border-top: 1px solid #E5E7EB;
}

body.login-page.no-tenant .version-info,
body.login-page.no-tenant .copyright {
  color: #6B7280;
}

body.login-page.no-tenant .website-link {
  color: #2563EB;
}

.login-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 480px;
  padding: 2.5rem;
}

.logo-container {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-container img.logo {
  max-width: 240px;
  height: auto;
  margin-bottom: 1.5rem;
}

.login-title {
  color: var(--tenant-primary-color);
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

.login-subtitle {
  color: #666;
  text-align: center;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  color: var(--tenant-primary-color);
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: block;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: #666;
}

.form-control {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--tenant-primary-color);
  outline: none;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 13px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.remember-me input[type="checkbox"] {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 2px solid #CBD5E0;
  appearance: none;
  cursor: pointer;
  position: relative;
}

.remember-me input[type="checkbox"]:checked {
  background-color: #4299E1;
  border-color: #4299E1;
}

.remember-me input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 10px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.forgot-password {
  color: #4299E1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.forgot-password:hover {
  text-decoration: underline;
}

.btn-primary {
  background-color: var(--tenant-primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: 500;
  width: 100%;
  margin-top: 1rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background-color: white;
  color: var(--tenant-primary-color);
  border: 1px solid var(--tenant-primary-color);
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: 500;
  width: 100%;
  margin-top: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background-color: var(--tenant-primary-color);
  color: white;
}

.btn-icon {
  font-size: 16px;
}

.divider {
  text-align: center;
  margin: 1.5rem 0;
  position: relative;
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 45%;
  height: 1px;
  background-color: #ddd;
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.divider span {
  background-color: white;
  padding: 0 1rem;
  color: #666;
}

.office-login-btn {
  background: #2F2F2F;
  color: white;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.office-login-btn:hover {
  background: #1A73E8;
  transform: translateY(-1px);
}

.office-login-btn .icon {
  height: 18px;
  width: auto;
}

.login-footer {
  margin-top: 2rem;
  text-align: center;
}

.version-info {
  color: #666;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.certification {
  margin: 12px 0;
}

.cyber {
  width: 50px;
  height: auto;
}

.copyright {
  color: #666;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.website-link {
  color: var(--tenant-primary-color);
  text-decoration: none;
}

.website-link:hover {
  text-decoration: underline;
}

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 13px;
}

.alert-danger {
  background-color: #FED7D7;
  color: #C53030;
  border: 1px solid #FEB2B2;
}

.error-message {
  color: #E53E3E;
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .login-container {
    max-width: 100%;
  }
  
  .login-card {
    padding: 20px;
  }
  
  .logo {
    width: 140px;
  }
  
  .login-title {
    font-size: 20px;
  }
  
  .login-subtitle {
    font-size: 13px;
  }
  
  .form-group {
    margin-bottom: 16px;
  }
  
  .btn {
    padding: 9px 18px;
    font-size: 13px;
  }
  
  .office-login-btn {
    padding: 9px 18px;
  }
  
  .office-login-btn .icon {
    height: 16px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .login-card {
    background: rgba(26, 32, 44, 0.95);
  }
  
  .login-title {
    color: #F7FAFC;
  }
  
  .login-subtitle {
    color: #A0AEC0;
  }
  
  .form-group label {
    color: #E2E8F0;
  }
  
  .form-control {
    background: rgba(45, 55, 72, 0.5);
    border-color: #4A5568;
    color: #F7FAFC;
  }
  
  .form-control:focus {
    background: rgba(45, 55, 72, 0.8);
  }
  
  .divider span {
    background: rgba(26, 32, 44, 0.95);
  }
  
  .copyright,
  .version-info {
    color: #A0AEC0;
  }
  
  .website-link {
    color: #63B3ED;
  }
  
  .website-link:hover {
    color: #90CDF4;
  }
}

.brand-side {
  flex: 1.15;
  min-height: 100vh;
  background: var(--tenant-primary-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  position: relative;
  overflow: hidden;
}

.brand-side::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(255, 255, 255, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 75%, rgba(0, 0, 0, 0.12) 0%, transparent 50%),
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0.02) 45%,
      transparent 100%
    );
  pointer-events: none;
}

.brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
  max-width: 520px;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: rgba(0, 0, 0, 0.14);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(12px);
}

.brand-logo {
  position: relative;
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;
}

.brand-logo img {
  max-width: 220px;
  max-height: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.brand-logo img.is-hidden {
  display: none !important;
}

/* Initial letter fallback — only when .is-visible (set from img onerror).
   Use !important so global/utility CSS (e.g. Bootstrap) cannot show the span
   as inline text beside a successfully loaded logo. */
.brand-logo-fallback {
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.brand-logo-fallback:not(.is-visible) {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  pointer-events: none !important;
}

.brand-logo-fallback.is-visible {
  display: flex !important;
  visibility: visible !important;
  position: static !important;
  width: 88px !important;
  height: 88px !important;
  overflow: visible !important;
  clip: auto !important;
  pointer-events: auto !important;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.brand-title {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  line-height: 1.6;
}

.login-side {
  flex: 0.85;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background: var(--tenant-secondary-color);
  min-height: 100vh;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 40px rgba(15, 23, 42, 0.08);
  padding: clamp(1.75rem, 3vw, 2.25rem);
  transition: box-shadow 0.25s ease;
}

.login-card:hover {
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 16px 48px rgba(15, 23, 42, 0.1);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.tracesense-logo {
  margin-bottom: 1.5rem;
}

.tracesense-logo img {
  max-width: 160px;
  height: auto;
}

.login-title {
  color: #1e293b;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: #64748b;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  color: #334155;
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: block;
  font-size: 0.9rem;
}

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 1.1rem;
}

.input-icon--svg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  pointer-events: none;
}

.input-icon--svg svg {
  flex-shrink: 0;
}

.form-control {
  width: 100%;
  padding: 12px 12px 12px 42px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s;
  background: #f8fafc;
}

.form-control:focus {
  border-color: var(--tenant-primary-color);
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--tenant-primary-color-rgb), 0.1);
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #64748b;
  font-size: 0.9rem;
}

.forgot-password {
  color: var(--tenant-primary-color);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-primary {
  background: var(--tenant-primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--tenant-primary-color-rgb), 0.2);
}

.login-footer {
  margin-top: 1.75rem;
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.login-footer-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.version-info {
  color: #64748b;
  font-size: 0.8rem;
  margin-bottom: 0;
}

.version-info p {
  margin: 0;
}

.certification {
  margin: 0;
}

.certification img {
  max-width: 104px;
  height: auto;
  display: block;
}

.login-footer-apps {
  margin: 0.25rem 0 1rem;
}

.login-footer-apps-label {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.appstore-badges {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 14px;
}

.appstore-badges__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  border-radius: 8px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.appstore-badges__link:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.appstore-badges__link:focus-visible {
  outline: 2px solid var(--tenant-primary-color);
  outline-offset: 3px;
}

.appstore-badges .appstore-img {
  height: 40px;
  width: auto;
  max-width: 100%;
  display: block;
}

.appstore-badges .appstore-img--google {
  height: 40px;
}

.login-footer-legal {
  padding-top: 0.25rem;
}

.copyright {
  color: #64748b;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.website-link {
  color: var(--tenant-primary-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
}

.website-link:hover {
  text-decoration: underline;
}

@media (max-width: 1024px) {
  .login-container {
    flex-direction: column;
  }

  .brand-side {
    padding: 2rem;
    min-height: 280px;
  }

  .brand-logo img {
    max-width: 180px;
  }

  .brand-title {
    font-size: 1.75rem;
  }

  .login-side {
    min-height: auto;
    padding: 1.5rem;
  }
}

@media (max-width: 640px) {
  .brand-side {
    min-height: 220px;
  }

  .brand-title {
    font-size: 1.5rem;
  }

  .brand-subtitle {
    font-size: 1rem;
  }

  .login-card {
    padding: 1.5rem;
  }
}