/* ==========================================================================
   Glassmorphic Navbar
   ========================================================================== */
.navbar-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  padding: var(--space-3); /* Internal spacing - padding for container */
  display: flex;
  justify-content: center;
  pointer-events: none;
}

/* Hide navbar when qualification funnel is open */
body.qualification-funnel-open .navbar-wrapper {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Mobile portrait: position navbar at bottom */
@media (max-width: 767px) and (orientation: portrait) {
  .navbar-wrapper {
    top: auto;
    bottom: 0;
    padding: var(--space-3); /* Internal spacing - padding for container */
  }

  /* Add bottom padding to footer to ensure it can scroll up far enough to clear the navbar */
  footer {
    padding-bottom: calc(80px + 2rem);
  }

  /* Remove bottom padding from main content since footer already provides clearance */
  main {
    padding-bottom: 0;
  }

  /* Remove top padding since navbar is at bottom */
  html {
    scroll-padding-top: 0;
  }
}

.navbar-glass-container {
  width: 100%;
  max-width: calc(100vw - clamp(1rem, 2vw, 1.5rem));
  background: rgb(255 255 255 / 0.65);
  backdrop-filter: blur(var(--blur-2xl)) saturate(var(--backdrop-saturate));
  border: 1px solid rgb(255 255 255 / 0.35);
  border-radius: var(--radius-2xl);
  box-shadow: 0 8px 32px rgb(0 0 0 / 0.1),
              0 4px 16px rgb(0 0 0 / 0.08),
              0 0 0 1px rgb(255 255 255 / 0.1) inset,
              inset 0 1px 0 rgb(255 255 255 / 0.5);
  padding: clamp(var(--space-2), 0.75vw, var(--space-3)) clamp(var(--space-3), 1vw, var(--space-4));
  pointer-events: auto;
  transition-property: all;
  transition-duration: var(--animation-duration-base);
  transition-timing-function: var(--animation-easing);
  position: relative;
  z-index: 41;
  min-width: 0; /* Allow container to shrink */
  overflow: visible; /* Allow dropdowns to be visible */
}

[data-theme="dark"] .navbar-glass-container {
  background: rgb(var(--color-neutral-900-rgb) / 0.65);
  backdrop-filter: blur(var(--blur-2xl)) saturate(var(--backdrop-saturate));
  border-color: rgb(255 255 255 / 0.12);
  box-shadow: 0 8px 32px rgb(0 0 0 / 0.4),
              0 4px 16px rgb(0 0 0 / 0.3),
              0 0 0 1px rgb(255 255 255 / 0.05) inset,
              inset 0 1px 0 rgb(255 255 255 / 0.1);
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: clamp(0.5rem, 1vw, 1rem);
  position: relative;
  z-index: 42;
  min-width: 0; /* Allow flex items to shrink below their content size */
}

.navbar-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  min-width: 0; /* Allow logo to shrink if needed */
}

.navbar-logo img {
  height: clamp(2rem, 2.5vw, 2.5rem) !important; /* Override Tailwind h-10 */
  width: auto !important;
  max-width: 100%;
  -o-object-fit: contain;
     object-fit: contain;
  transition: height 0.2s ease; /* Smooth size transitions */
}

.navbar-logo:hover {
  transform: scale(1.05);
}

.navbar-logo:active {
  transform: scale(0.95);
}

/* Logo theme switching - Navbar and Footer */
.logo-light {
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
}

.logo-dark {
  display: none;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
}

[data-theme="dark"] .logo-light {
  display: none;
}

[data-theme="dark"] .logo-dark {
  display: block;
}

[data-theme="light"] .logo-light {
  display: block;
}

[data-theme="light"] .logo-dark {
  display: none;
}

.navbar-hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-button);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-2); /* Internal spacing - padding for button */
  transition: all 0.2s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 43;
}

.navbar-hamburger-btn.open {
  background: rgb(0 0 0 / 0.05);
}

[data-theme="dark"] .navbar-hamburger-btn.open {
  background: rgb(255 255 255 / 0.1);
}

.navbar-hamburger-btn:hover {
  background: rgb(0 0 0 / 0.05);
}

[data-theme="dark"] .navbar-hamburger-btn:hover {
  background: rgb(255 255 255 / 0.1);
}

.navbar-hamburger-btn:active {
  transform: scale(0.95);
}

.navbar-hamburger-btn:focus-visible {
  outline: 2px solid rgb(var(--color-primary-rgb) / 0.5);
  outline-offset: 2px;
}

.navbar-hamburger-icon {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 20px;
  height: 16px;
  position: relative;
}

.navbar-hamburger-line {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

[data-theme="dark"] .navbar-hamburger-line {
  background: rgb(var(--color-neutral-100-rgb) / 0.9);
}

[data-theme="light"] .navbar-hamburger-line {
  background: rgb(var(--color-neutral-950-rgb) / 0.9);
}

.navbar-hamburger-btn.open .navbar-hamburger-icon {
  display: none;
}

.navbar-hamburger-btn.open .navbar-hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.navbar-hamburger-btn.open .navbar-hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.navbar-hamburger-btn.open .navbar-hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Ensure close icon is visible when menu is open */
.navbar-hamburger-btn.open .navbar-close-icon {
  display: block !important;
  opacity: 1 !important;
}

/* Close Icon - Shows when menu is open */
.navbar-close-icon {
  width: 1.75rem;
  height: 1.75rem;
  stroke: currentColor;
  stroke-width: 2.5;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: closeIconFadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  display: block;
  flex-shrink: 0;
  color: var(--text-primary);
}

@keyframes closeIconFadeIn {
  from {
    opacity: 0;
    transform: scale(0.8) rotate(-90deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

[data-theme="dark"] .navbar-close-icon {
  color: rgb(var(--color-neutral-100-rgb) / 0.95);
  stroke: rgb(var(--color-neutral-100-rgb) / 0.95);
}

[data-theme="light"] .navbar-close-icon {
  color: rgb(var(--color-neutral-950-rgb) / 0.95);
  stroke: rgb(var(--color-neutral-950-rgb) / 0.95);
}

.navbar-hamburger-btn:hover .navbar-close-icon {
  transform: scale(1.15) rotate(90deg);
  color: rgb(var(--color-error-rgb));
  stroke: rgb(var(--color-error-rgb));
}

[data-theme="dark"] .navbar-hamburger-btn:hover .navbar-close-icon {
  color: rgb(var(--color-error-rgb));
  stroke: rgb(var(--color-error-rgb));
}

.navbar-hamburger-btn:active .navbar-close-icon {
  transform: scale(0.95);
}

.navbar-links {
  display: none !important;
  align-items: center;
  gap: clamp(0.25rem, 0.75vw, 1rem);
  flex: 1 1 auto;
  justify-content: flex-end;
  margin-left: auto;
  min-width: 0; /* Allow links container to shrink */
  overflow: visible; /* Allow dropdowns to be visible */
}

/* Desktop Nav Links - Glass Styling - Theme-aware */
.navbar-links a {
  padding: clamp(0.375rem, 0.5vw, var(--space-2)) clamp(0.5rem, 1vw, var(--space-4)); /* Internal spacing - padding for links */
  border-radius: var(--radius-button);
  color: var(--text-primary);
  text-decoration: none;
  font-size: clamp(0.75rem, 0.875vw, 0.875rem);
  font-weight: 500;
  text-align: center;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              padding 0.2s ease,
              font-size 0.2s ease;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0; /* Allow links to shrink */
  max-width: 100%; /* Prevent links from overflowing */
}

/* Reduce padding for First-Time Homebuyer link to make it narrower */
.navbar-links a[href="/first-time-homebuyer"] {
  padding-left: clamp(0.25rem, 0.5vw, var(--space-2));
  padding-right: clamp(0.25rem, 0.5vw, var(--space-2));
  font-size: clamp(0.7rem, 0.8vw, 0.875rem); /* Slightly smaller font for long text */
}

.navbar-links a:hover {
  background: rgb(var(--color-primary-rgb) / 0.1);
  color: var(--color-primary);
}

.navbar-links a.active {
  background: rgb(var(--color-primary-rgb) / 0.15);
  color: var(--color-primary);
  font-weight: 600;
}

[data-theme="dark"] .navbar-links a:hover {
  background: rgb(var(--color-primary-rgb) / 0.15);
  color: rgb(var(--color-primary-rgb));
}

[data-theme="dark"] .navbar-links a.active {
  background: linear-gradient(135deg, 
    rgb(var(--color-primary-rgb) / 0.35) 0%, 
    rgb(var(--color-primary-rgb) / 0.3) 50%,
    rgb(var(--color-primary-rgb) / 0.35) 100%);
  color: rgb(255 255 255) !important;
  border: 1px solid rgb(var(--color-primary-rgb) / 0.5);
  box-shadow: 
    0 2px 8px rgb(var(--color-primary-rgb) / 0.3),
    0 0 0 2px rgb(var(--color-primary-rgb) / 0.15),
    inset 0 1px 0 rgb(255 255 255 / 0.2);
  backdrop-filter: blur(var(--blur-sm));
}

@media (min-width: 768px) {
  .navbar-links {
    display: flex !important;
  }
}

/* Enhanced responsive breakpoints for better dynamic resizing */
@media (min-width: 768px) and (max-width: 1280px) {
  /* Fluid adjustments for medium desktop sizes */
  .navbar-links {
    gap: clamp(0.25rem, 0.5vw, 0.75rem);
  }

  .navbar-content {
    gap: clamp(0.5rem, 0.75vw, 0.875rem);
  }

  .navbar-links a {
    font-size: clamp(0.7rem, 0.8vw, 0.875rem);
    padding: clamp(0.375rem, 0.5vw, var(--space-2)) clamp(0.5rem, 0.875vw, var(--space-3));
  }

  .navbar-links a[href="/first-time-homebuyer"] {
    padding-left: clamp(0.25rem, 0.375vw, var(--space-1));
    padding-right: clamp(0.25rem, 0.375vw, var(--space-1));
  }

  .desktop-login-btn {
    padding: clamp(0.375rem, 0.5vw, var(--space-2)) clamp(0.5rem, 0.875vw, var(--space-3));
    font-size: clamp(0.7rem, 0.8vw, 0.875rem);
  }

  .desktop-login-btn .login-text,
  .desktop-login-btn .user-name {
    font-size: clamp(0.7rem, 0.8vw, 0.875rem);
  }

  .desktop-login-btn .user-name {
    max-width: clamp(80px, 10vw, 120px);
  }

  .theme-toggle-btn,
  .language-toggle-btn {
    width: clamp(2rem, 2.25vw, 2.5rem);
    height: clamp(2rem, 2.25vw, 2.5rem);
    padding: clamp(0.25rem, 0.375vw, var(--space-2));
  }

  .navbar-glass-container {
    padding: clamp(var(--space-2), 0.75vw, var(--space-3)) clamp(var(--space-3), 1vw, var(--space-4));
  }
}

/* Fix navbar layout at 1024px and narrower - more aggressive scaling */
@media (min-width: 768px) and (max-width: 1024px) {
  .navbar-links a {
    font-size: clamp(0.65rem, 0.75vw, 0.75rem) !important;
    padding: clamp(0.375rem, 0.5vw, var(--space-2)) clamp(0.5rem, 0.75vw, var(--space-3)) !important;
  }

  .navbar-links a[href="/first-time-homebuyer"] {
    padding-left: clamp(0.25rem, 0.375vw, var(--space-1)) !important;
    padding-right: clamp(0.25rem, 0.375vw, var(--space-1)) !important;
  }

  .navbar-links {
    gap: clamp(0.25rem, 0.5vw, var(--space-2)) !important;
  }

  .navbar-content {
    gap: clamp(0.5rem, 0.75vw, var(--space-3)) !important;
  }

  .desktop-login-btn {
    padding: clamp(0.375rem, 0.5vw, var(--space-2)) clamp(0.5rem, 0.75vw, var(--space-3)) !important;
    font-size: clamp(0.65rem, 0.75vw, 0.75rem) !important;
  }

  .desktop-login-btn .login-text {
    font-size: clamp(0.65rem, 0.75vw, 0.75rem) !important;
  }

  .desktop-login-btn .user-name {
    font-size: clamp(0.65rem, 0.75vw, 0.75rem) !important;
    max-width: clamp(70px, 8vw, 100px) !important;
  }

  .desktop-logout-btn {
    padding: clamp(0.375rem, 0.5vw, var(--space-2)) clamp(0.5rem, 0.75vw, var(--space-3)) !important;
    font-size: clamp(0.65rem, 0.75vw, 0.75rem) !important;
  }

  .desktop-logout-btn .logout-text {
    font-size: clamp(0.65rem, 0.75vw, 0.75rem) !important;
  }

  .theme-toggle-btn {
    width: clamp(2rem, 2.25vw, 2.25rem) !important;
    height: clamp(2rem, 2.25vw, 2.25rem) !important;
    padding: clamp(0.25rem, 0.375vw, var(--space-1)) clamp(0.375rem, 0.5vw, var(--space-2)) !important;
  }

  .navbar-glass-container {
    padding: clamp(var(--space-2), 0.75vw, var(--space-3)) clamp(var(--space-3), 0.875vw, var(--space-4)) !important;
  }
}

/* Mobile menu backdrop overlay */
/* Mobile menu styling - Enhanced Glass */
.nav-links.mobile-menu {
  position: fixed;
  top: calc(80px + var(--space-3));
  left: var(--space-3);
  right: var(--space-3);
  max-width: calc(100vw - 1.5rem);
  overflow-y: auto;
  background: rgb(255 255 255 / 0.98);
  backdrop-filter: blur(var(--blur-2xl)) saturate(var(--backdrop-saturate));
  border: 1px solid rgb(255 255 255 / 0.5);
  border-radius: var(--radius-3xl);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.12),
              0 8px 24px rgb(0 0 0 / 0.08),
              0 0 0 1px rgb(255 255 255 / 0.3) inset,
              0 1px 0 rgb(255 255 255 / 0.5) inset;
  padding: var(--space-6);
  padding-bottom: var(--space-3); /* Reduced bottom padding */
  z-index: 30;
  opacity: 0;
  transform: translateY(-20px) scale(0.95) translateZ(0);
  pointer-events: none;
  transition-property: opacity, transform, pointer-events;
  transition-duration: 0.35s, 0.35s, 0s;
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1), cubic-bezier(0.34, 1.56, 0.64, 1), ease;
  transition-delay: 0s, 0s, 0.35s;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: -moz-fit-content;
  height: fit-content;
  max-height: calc(100vh - 100px);
  scrollbar-width: thin;
  scrollbar-color: rgb(0 0 0 / 0.2) transparent;
  /* GPU acceleration hints for iOS Safari */
  will-change: opacity, transform;
  backface-visibility: hidden;
  perspective: 1000px;
}

.nav-links.mobile-menu::-webkit-scrollbar {
  width: 6px;
}

.nav-links.mobile-menu::-webkit-scrollbar-track {
  background: transparent;
}

.nav-links.mobile-menu::-webkit-scrollbar-thumb {
  background: rgb(0 0 0 / 0.2);
  border-radius: 3px;
}

.nav-links.mobile-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1) translateZ(0);
  pointer-events: auto;
  transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
              pointer-events 0s;
}

/* Smooth downward swipe collapse */
.nav-links.mobile-menu:not(.open) {
  opacity: 0;
  transform: translateY(20px) translateZ(0);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
              pointer-events 0s;
}

[data-theme="dark"] .nav-links.mobile-menu {
  background: rgb(var(--color-neutral-800-rgb) / 0.4);
  backdrop-filter: blur(var(--blur-3xl)) saturate(200%);
  border-color: rgb(var(--color-neutral-400-rgb) / 0.2);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.2),
              0 8px 24px rgb(0 0 0 / 0.15),
              0 0 0 1px rgb(255 255 255 / 0.1) inset,
              0 1px 0 rgb(255 255 255 / 0.15) inset,
              0 0 80px rgb(var(--color-primary-rgb) / 0.08);
}

[data-theme="dark"] .nav-links.mobile-menu::-webkit-scrollbar-thumb {
  background: rgb(255 255 255 / 0.2);
}

/* Mobile portrait: position menu above navbar */
@media (max-width: 767px) and (orientation: portrait) {
  .nav-links.mobile-menu {
    top: auto;
    bottom: calc(80px + 0.75rem);
    transform: translateY(20px) translateZ(0);
  }

  .nav-links.mobile-menu.open {
    transform: translateY(0) translateZ(0);
  }

  .nav-links.mobile-menu:not(.open) {
    opacity: 0;
    transform: translateY(-20px) translateZ(0);
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
                transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
                pointer-events 0s;
  }
}

/* Mobile Menu Sections */
.mobile-nav-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2) var(--space-3); /* External spacing - gap between items (approx 0.625rem) */
  margin-bottom: var(--space-3); /* External spacing - margin between sections */
  border-bottom: 1px solid rgb(0 0 0 / 0.06);
  padding-bottom: var(--space-3); /* Internal spacing - padding inside section */
  position: relative;
}

.mobile-nav-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgb(0 0 0 / 0.1) 20%, 
    rgb(0 0 0 / 0.1) 80%, 
    transparent 100%);
}

[data-theme="dark"] .mobile-nav-section {
  border-bottom-color: rgb(255 255 255 / 0.1);
}

[data-theme="dark"] .mobile-nav-section::after {
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgb(255 255 255 / 0.15) 20%, 
    rgb(255 255 255 / 0.15) 80%, 
    transparent 100%);
}

/* Mobile Menu Links - Redesigned - Theme-aware */
.mobile-menu-link,
.mobile-login-btn,
.theme-toggle-mobile {
  border-radius: var(--radius-button);
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3) var(--space-4); /* External spacing - gap between icon and text (approx 0.875rem) */
  padding: var(--space-3) var(--space-5); /* Internal spacing - padding for link (approx 1.125rem 1.375rem) */
  color: var(--text-primary) !important;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  text-decoration: none;
  background: linear-gradient(135deg, 
    rgb(0 0 0 / 0.02) 0%, 
    rgb(0 0 0 / 0.01) 50%,
    rgb(0 0 0 / 0.02) 100%);
  border: 2px solid rgb(0 0 0 / 0.06);
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 52px;
  box-shadow: 
    0 2px 6px rgb(0 0 0 / 0.04),
    0 1px 3px rgb(0 0 0 / 0.03),
    inset 0 1px 0 rgb(255 255 255 / 0.15),
    inset 0 -1px 0 rgb(0 0 0 / 0.03);
  overflow: hidden;
}

.mobile-menu-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0;
  background: linear-gradient(180deg, 
    rgb(var(--color-primary-rgb) / 0.9) 0%, 
    rgb(var(--color-primary-rgb) / 1) 50%, 
    rgb(var(--color-primary-rgb) / 0.9) 100%);
  border-radius: 0 3px 3px 0;
  transition: height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 8px rgb(var(--color-primary-rgb) / 0.3);
}

.mobile-menu-link::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgb(255 255 255 / 0.1) 0%, 
    rgb(255 255 255 / 0.05) 50%,
    transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

[data-theme="dark"] .mobile-menu-link {
  background: linear-gradient(135deg, 
    rgb(255 255 255 / 0.08) 0%, 
    rgb(255 255 255 / 0.05) 50%,
    rgb(255 255 255 / 0.08) 100%);
  border-color: rgb(255 255 255 / 0.15);
  box-shadow: 
    0 2px 6px rgb(0 0 0 / 0.1),
    0 1px 3px rgb(0 0 0 / 0.08),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(255 255 255 / 0.05);
  backdrop-filter: blur(var(--blur-lg));}

[data-theme="dark"] .mobile-menu-link::before {
  background: linear-gradient(180deg, 
    rgb(var(--color-primary-rgb) / 0.9) 0%, 
    rgb(var(--color-primary-rgb) / 1) 50%, 
    rgb(var(--color-primary-rgb) / 0.9) 100%);
  box-shadow: 0 0 8px rgb(var(--color-primary-rgb) / 0.4);
}

.nav-links.mobile-menu.open .mobile-menu-link {
  animation: mobileMenuLinkFadeIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Smooth fade out for menu items on collapse */
.nav-links.mobile-menu:not(.open) .mobile-menu-link {
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

.nav-links.mobile-menu.open .mobile-menu-link:nth-child(1) {
  animation-delay: 0.06s;
}

.nav-links.mobile-menu.open .mobile-menu-link:nth-child(2) {
  animation-delay: 0.12s;
}

.nav-links.mobile-menu.open .mobile-menu-link:nth-child(3) {
  animation-delay: 0.18s;
}

.nav-links.mobile-menu.open .mobile-menu-link:nth-child(4) {
  animation-delay: 0.24s;
}

.nav-links.mobile-menu.open .mobile-menu-link:nth-child(5) {
  animation-delay: 0.3s;
}

.nav-links.mobile-menu.open .mobile-menu-link:nth-child(6) {
  animation-delay: 0.36s;
}

.nav-links.mobile-menu.open .mobile-menu-link:nth-child(7) {
  animation-delay: 0.42s;
}

.nav-links.mobile-menu.open .mobile-menu-link:nth-child(8) {
  animation-delay: 0.48s;
}


.mobile-menu-link:hover {
  background: linear-gradient(135deg, 
    rgb(0 0 0 / 0.05) 0%, 
    rgb(0 0 0 / 0.03) 50%,
    rgb(0 0 0 / 0.05) 100%);
  border-color: rgb(0 0 0 / 0.1);
  transform: translateX(4px) translateY(-2px) scale(1.01);
  box-shadow: 
    0 4px 12px rgb(0 0 0 / 0.08),
    0 2px 6px rgb(0 0 0 / 0.05),
    0 0 0 3px rgb(var(--color-primary-rgb) / 0.08),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(0 0 0 / 0.03);
  padding-left: var(--space-6); /* Internal spacing - padding for active/hover state */
}

.mobile-menu-link:hover::before {
  height: 75%;
  box-shadow: 0 0 12px rgb(var(--color-primary-rgb) / 0.4);
}

.mobile-menu-link:hover::after {
  opacity: 1;
}

[data-theme="dark"] .mobile-menu-link:hover {
  background: linear-gradient(135deg, 
    rgb(255 255 255 / 0.15) 0%, 
    rgb(255 255 255 / 0.1) 50%,
    rgb(255 255 255 / 0.15) 100%);
  border-color: rgb(255 255 255 / 0.2);
  box-shadow: 
    0 4px 12px rgb(0 0 0 / 0.15),
    0 2px 6px rgb(0 0 0 / 0.1),
    0 0 0 3px rgb(var(--color-primary-rgb) / 0.15),
    inset 0 1px 0 rgb(255 255 255 / 0.25),
    inset 0 -1px 0 rgb(255 255 255 / 0.1);
  backdrop-filter: blur(var(--blur-xl));}

[data-theme="dark"] .mobile-menu-link:hover::before {
  box-shadow: 0 0 12px rgb(var(--color-primary-rgb) / 0.5);
}

.mobile-menu-link:active {
  transform: translateX(2px) translateY(-1px) scale(0.99);
  box-shadow: 
    0 2px 6px rgb(0 0 0 / 0.06),
    0 1px 3px rgb(0 0 0 / 0.04),
    0 0 0 2px rgb(var(--color-primary-rgb) / 0.12),
    inset 0 1px 0 rgb(255 255 255 / 0.15);
}

[data-theme="dark"] .mobile-menu-link:active {
  box-shadow: 
    0 2px 6px rgb(0 0 0 / 0.15),
    0 1px 3px rgb(0 0 0 / 0.1),
    0 0 0 2px rgb(var(--color-primary-rgb) / 0.2),
    inset 0 1px 0 rgb(255 255 255 / 0.2);
}

.mobile-menu-link.active {
  background: linear-gradient(135deg, 
    rgb(var(--color-primary-rgb) / 0.15) 0%, 
    rgb(var(--color-primary-rgb) / 0.1) 50%,
    rgb(var(--color-primary-rgb) / 0.12) 100%);
  border-color: rgb(var(--color-primary-rgb) / 0.3);
  color: rgb(var(--color-primary-rgb) / 1);
  font-weight: 600;
  padding-left: 1.5rem;
  box-shadow: 
    0 4px 12px rgb(var(--color-primary-rgb) / 0.15),
    0 2px 6px rgb(var(--color-primary-rgb) / 0.1),
    0 0 0 3px rgb(var(--color-primary-rgb) / 0.1),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(0 0 0 / 0.05);
}

.mobile-menu-link.active::before {
  height: 85%;
  box-shadow: 0 0 12px rgb(var(--color-primary-rgb) / 0.5);
}

.mobile-menu-link.active::after {
  opacity: 1;
}

[data-theme="dark"] .mobile-menu-link.active {
  background: linear-gradient(135deg, 
    rgb(var(--color-primary-rgb) / 0.4) 0%, 
    rgb(var(--color-primary-rgb) / 0.35) 50%,
    rgb(var(--color-primary-rgb) / 0.4) 100%);
  border-color: rgb(var(--color-primary-rgb) / 0.6);
  color: rgb(255 255 255) !important;
  box-shadow: 
    0 4px 12px rgb(var(--color-primary-rgb) / 0.25),
    0 2px 6px rgb(var(--color-primary-rgb) / 0.15),
    0 0 0 3px rgb(var(--color-primary-rgb) / 0.25),
    inset 0 1px 0 rgb(255 255 255 / 0.3),
    inset 0 -1px 0 rgb(var(--color-primary-rgb) / 0.15);
  backdrop-filter: blur(var(--blur-xl));
}

[data-theme="dark"] .mobile-menu-link.active::before {
  box-shadow: 0 0 12px rgb(var(--color-primary-rgb) / 0.6);
}

.mobile-menu-link:focus-visible,
.mobile-login-btn:focus-visible,
.theme-toggle-mobile:focus-visible {
  border-radius: var(--radius-button);
}

.mobile-menu-link:focus-visible {
  outline: 3px solid rgb(var(--color-primary-rgb) / 0.4);
  outline-offset: 3px;
}

/* Mobile Menu Icons */
.mobile-menu-icon {
  width: 1.375rem;
  height: 1.375rem;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0.8;
}

.mobile-menu-link:hover .mobile-menu-icon {
  transform: scale(1.15) translateX(2px);
  opacity: 1;
}

.mobile-menu-link.active .mobile-menu-icon {
  stroke: currentColor;
  opacity: 1;
  transform: scale(1.1);
}

.mobile-menu-link:active .mobile-menu-icon {
  transform: scale(1.05);
}

/* Mobile Dashboard Links */
.mobile-dashboard-link {
  background: rgb(var(--color-primary-rgb) / 0.05);
  border: 1px solid rgb(var(--color-primary-rgb) / 0.1);
}

[data-theme="dark"] .mobile-dashboard-link {
  background: rgb(var(--color-primary-rgb) / 0.15);
  border-color: rgb(var(--color-primary-rgb) / 0.25);
  backdrop-filter: blur(var(--blur-lg));}

.mobile-dashboard-link:hover {
  background: rgb(var(--color-primary-rgb) / 0.1);
  border-color: rgb(var(--color-primary-rgb) / 0.2);
}

[data-theme="dark"] .mobile-dashboard-link:hover {
  background: rgb(var(--color-primary-rgb) / 0.2);
  border-color: rgb(var(--color-primary-rgb) / 0.35);
  backdrop-filter: blur(var(--blur-xl));}

/* Mobile Menu Actions Container */
.mobile-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem; /* Minimal gap for very tight spacing between buttons */
  padding-top: 0; /* Removed top padding to minimize gap above theme toggle */
  margin-top: 0; /* No external margin */
}

/* Initial hidden state for action items */
.mobile-menu-actions > * {
  opacity: 0;
  transform: translateY(10px);
}

/* Fade in animation for action items when menu opens */
.nav-links.mobile-menu.open .mobile-menu-actions > * {
  animation: mobileActionItemFadeIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Staggered delays for action items */
.nav-links.mobile-menu.open .mobile-menu-actions > *:nth-child(1) {
  animation-delay: 0.4s;
}

.nav-links.mobile-menu.open .mobile-menu-actions > *:nth-child(2) {
  animation-delay: 0.45s;
}

.nav-links.mobile-menu.open .mobile-menu-actions > *:nth-child(3) {
  animation-delay: 0.5s;
}

/* Fade out animation for action items on collapse - reverse order */
.nav-links.mobile-menu:not(.open) .mobile-menu-actions > * {
  animation: mobileActionItemFadeOut 0.2s ease-out forwards;
}

.nav-links.mobile-menu:not(.open) .mobile-menu-actions > *:nth-child(1) {
  animation-delay: 0.1s;
}

.nav-links.mobile-menu:not(.open) .mobile-menu-actions > *:nth-child(2) {
  animation-delay: 0.05s;
}

.nav-links.mobile-menu:not(.open) .mobile-menu-actions > *:nth-child(3) {
  animation-delay: 0s;
}

/* Mobile Account Container */
.mobile-account-container {
  display: flex;
  flex-direction: column;
  gap: 0.375rem; /* Reduced gap to minimize spacing */
  position: relative;
  /* Only reserve space when form is visible */
  min-height: auto;
  margin-bottom: 0; /* Reset - spacing handled by logout button margin */
}

/* Expand container only when sign-in form is opening/visible */
.mobile-account-container:has(.mobile-signin-form-container.opening) {
  min-height: 450px; /* Adjusted to prevent overlap while minimizing gap */
}

/* Hide button wrapper when form is visible */
.mobile-login-btn-wrapper.hidden {
  display: none; /* Completely remove from layout when hidden */
}

/* Mobile Login Button - Redesigned */
.mobile-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3); /* External spacing - gap between icon and text */
  padding: var(--space-3) var(--space-6); /* Internal spacing - padding for button (approx 1.125rem 1.5rem) */
  background: linear-gradient(135deg, 
    rgb(var(--color-secondary-rgb) / 0.25) 0%, 
    rgb(var(--color-secondary-rgb) / 0.2) 50%,
    rgb(var(--color-secondary-rgb) / 0.22) 100%);
  border: 2px solid rgb(var(--color-secondary-rgb) / 0.3);
  color: rgb(0 0 0);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 4px 12px rgb(var(--color-secondary-rgb) / 0.15),
    0 2px 6px rgb(var(--color-secondary-rgb) / 0.1),
    0 0 0 0 rgb(var(--color-secondary-rgb) / 0),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(0 0 0 / 0.05);
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  min-height: 56px;
  position: relative;
  overflow: hidden;
}

.mobile-login-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgb(255 255 255 / 0.25) 0%, 
    rgb(255 255 255 / 0.1) 50%,
    transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-login-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 255 255 / 0.3) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
  pointer-events: none;
}

.mobile-login-btn:hover {
  background: linear-gradient(135deg, 
    rgb(var(--color-secondary-rgb) / 0.32) 0%, 
    rgb(var(--color-secondary-rgb) / 0.28) 50%,
    rgb(var(--color-secondary-rgb) / 0.3) 100%);
  border-color: rgb(var(--color-secondary-rgb) / 0.45);
  color: rgb(0 0 0);
  box-shadow: 
    0 8px 24px rgb(var(--color-secondary-rgb) / 0.25),
    0 4px 12px rgb(var(--color-secondary-rgb) / 0.15),
    0 0 0 4px rgb(var(--color-secondary-rgb) / 0.1),
    inset 0 1px 0 rgb(255 255 255 / 0.3),
    inset 0 -1px 0 rgb(0 0 0 / 0.05);
  transform: translateY(-3px) scale(1.02);
}

.mobile-login-btn:hover::before {
  opacity: 1;
}

.mobile-login-btn:active {
  transform: translateY(-1px) scale(0.99);
  box-shadow: 
    0 2px 8px rgb(var(--color-secondary-rgb) / 0.2),
    0 1px 4px rgb(var(--color-secondary-rgb) / 0.15),
    0 0 0 2px rgb(var(--color-secondary-rgb) / 0.15),
    inset 0 1px 0 rgb(255 255 255 / 0.2);
}

.mobile-login-btn:active::after {
  width: 300px;
  height: 300px;
  opacity: 1;
}

.mobile-login-btn:focus-visible {
  outline: 3px solid rgb(var(--color-secondary-rgb) / 0.4);
  outline-offset: 3px;
}

[data-theme="dark"] .mobile-login-btn {
  background: linear-gradient(135deg, 
    rgb(var(--color-secondary-rgb) / 0.25) 0%, 
    rgb(var(--color-secondary-rgb) / 0.2) 50%,
    rgb(var(--color-secondary-rgb) / 0.25) 100%);
  border-color: rgb(var(--color-secondary-rgb) / 0.4);
  color: rgb(255 255 255) !important;
  box-shadow: 
    0 4px 12px rgb(var(--color-secondary-rgb) / 0.15),
    0 2px 6px rgb(var(--color-secondary-rgb) / 0.1),
    0 0 0 0 rgb(var(--color-secondary-rgb) / 0),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(var(--color-secondary-rgb) / 0.1);
  backdrop-filter: blur(var(--blur-xl));
}

[data-theme="dark"] .mobile-login-btn .login-icon,
[data-theme="dark"] .mobile-login-btn .login-text {
  color: rgb(255 255 255) !important;
}

[data-theme="dark"] .mobile-login-btn:hover {
  background: linear-gradient(135deg, 
    rgb(var(--color-secondary-rgb) / 0.3) 0%, 
    rgb(var(--color-secondary-rgb) / 0.25) 50%,
    rgb(var(--color-secondary-rgb) / 0.3) 100%);
  border-color: rgb(var(--color-secondary-rgb) / 0.5);
  color: rgb(255 255 255) !important;
  box-shadow: 
    0 8px 24px rgb(var(--color-secondary-rgb) / 0.2),
    0 4px 12px rgb(var(--color-secondary-rgb) / 0.15),
    0 0 0 4px rgb(var(--color-secondary-rgb) / 0.2),
    inset 0 1px 0 rgb(255 255 255 / 0.25),
    inset 0 -1px 0 rgb(var(--color-secondary-rgb) / 0.15);
  backdrop-filter: blur(var(--blur-xl));
}

[data-theme="dark"] .mobile-login-btn:hover .login-icon,
[data-theme="dark"] .mobile-login-btn:hover .login-text {
  color: rgb(255 255 255) !important;
}

/* KISS Mortgage - Mobile Login Button - Use gold color (#c79f4f) instead of orange */
[data-app="kiss-mortgage"] .mobile-login-btn {
  background: linear-gradient(135deg, 
    rgb(199 159 79 / 0.25) 0%, 
    rgb(199 159 79 / 0.2) 50%,
    rgb(199 159 79 / 0.22) 100%);
  border-color: rgb(199 159 79 / 0.3);
  color: rgb(0 0 0);
  box-shadow: 
    0 4px 12px rgb(199 159 79 / 0.15),
    0 2px 6px rgb(199 159 79 / 0.1),
    0 0 0 0 rgb(199 159 79 / 0),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(0 0 0 / 0.05);
}

[data-app="kiss-mortgage"] .mobile-login-btn:hover {
  background: linear-gradient(135deg, 
    rgb(199 159 79 / 0.32) 0%, 
    rgb(199 159 79 / 0.28) 50%,
    rgb(199 159 79 / 0.3) 100%);
  border-color: rgb(199 159 79 / 0.45);
  color: rgb(0 0 0);
  box-shadow: 
    0 8px 24px rgb(199 159 79 / 0.25),
    0 4px 12px rgb(199 159 79 / 0.15),
    0 0 0 4px rgb(199 159 79 / 0.1),
    inset 0 1px 0 rgb(255 255 255 / 0.3),
    inset 0 -1px 0 rgb(0 0 0 / 0.05);
  transform: translateY(-3px) scale(1.02);
}

[data-app="kiss-mortgage"] .mobile-login-btn:active {
  box-shadow: 
    0 2px 8px rgb(199 159 79 / 0.2),
    0 1px 4px rgb(199 159 79 / 0.15),
    0 0 0 2px rgb(199 159 79 / 0.15),
    inset 0 1px 0 rgb(255 255 255 / 0.2);
}

[data-app="kiss-mortgage"] .mobile-login-btn:focus-visible {
  outline: 3px solid rgb(199 159 79 / 0.4);
  outline-offset: 3px;
}

[data-app="kiss-mortgage"][data-theme="dark"] .mobile-login-btn {
  background: linear-gradient(135deg, 
    rgb(199 159 79 / 0.25) 0%, 
    rgb(199 159 79 / 0.2) 50%,
    rgb(199 159 79 / 0.25) 100%);
  border-color: rgb(199 159 79 / 0.4);
  color: rgb(255 255 255) !important;
  box-shadow: 
    0 4px 12px rgb(199 159 79 / 0.15),
    0 2px 6px rgb(199 159 79 / 0.1),
    0 0 0 0 rgb(199 159 79 / 0),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(199 159 79 / 0.1);
  backdrop-filter: blur(var(--blur-xl));
}

[data-app="kiss-mortgage"][data-theme="dark"] .mobile-login-btn .login-icon,
[data-app="kiss-mortgage"][data-theme="dark"] .mobile-login-btn .login-text {
  color: rgb(255 255 255) !important;
}

[data-app="kiss-mortgage"][data-theme="dark"] .mobile-login-btn:hover {
  background: linear-gradient(135deg, 
    rgb(199 159 79 / 0.3) 0%, 
    rgb(199 159 79 / 0.25) 50%,
    rgb(199 159 79 / 0.3) 100%);
  border-color: rgb(199 159 79 / 0.5);
  color: rgb(255 255 255) !important;
  box-shadow: 
    0 8px 24px rgb(199 159 79 / 0.2),
    0 4px 12px rgb(199 159 79 / 0.15),
    0 0 0 4px rgb(199 159 79 / 0.2),
    inset 0 1px 0 rgb(255 255 255 / 0.25),
    inset 0 -1px 0 rgb(199 159 79 / 0.15);
  backdrop-filter: blur(var(--blur-xl));
}

[data-app="kiss-mortgage"][data-theme="dark"] .mobile-login-btn:hover .login-icon,
[data-app="kiss-mortgage"][data-theme="dark"] .mobile-login-btn:hover .login-text {
  color: rgb(255 255 255) !important;
}

.mobile-login-btn .login-icon {
  width: 1.375rem;
  height: 1.375rem;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.mobile-login-btn:hover .login-icon {
  transform: scale(1.15) rotate(5deg);
}

.mobile-login-btn .user-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile Sign-In Form Container */
.mobile-signin-form-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: var(--space-5); /* Internal spacing - padding for form container (1.25rem) */
  background: linear-gradient(135deg, 
    rgb(255 255 255 / 0.95) 0%, 
    rgb(255 255 255 / 0.9) 100%);
  border: 2px solid rgb(var(--color-secondary-rgb) / 0.2);
  border-radius: 1.25rem;
  box-shadow: 
    0 4px 12px rgb(var(--color-secondary-rgb) / 0.1),
    0 2px 6px rgb(0 0 0 / 0.05),
    inset 0 1px 0 rgb(255 255 255 / 0.5);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 0;
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  border-width: 0;
  visibility: hidden;
  min-height: 0;
  z-index: 10;
}

.mobile-signin-form-container.opening {
  max-height: 600px;
  opacity: 1;
  transform: translateY(0) scale(1);
  padding: var(--space-4); /* Reduced padding for form container */
  border-width: 2px;
  margin: 0;
  animation: mobileSignInSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  visibility: visible;
  min-height: 420px; /* Adjusted to ensure content fits without overlap */
  z-index: 10;
}

.mobile-signin-form-container.closing {
  max-height: 0;
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  animation: mobileSignInSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes mobileSignInSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    max-height: 600px;
  }
}

@keyframes mobileSignInSlideOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
    max-height: 600px;
  }
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    max-height: 0;
  }
}

[data-theme="dark"] .mobile-signin-form-container {
  background: linear-gradient(135deg, 
    rgb(var(--color-neutral-800-rgb) / 0.5) 0%, 
    rgb(var(--color-neutral-800-rgb) / 0.4) 100%);
  border-color: rgb(var(--color-secondary-rgb) / 0.3);
  box-shadow: 
    0 4px 12px rgb(var(--color-secondary-rgb) / 0.1),
    0 2px 6px rgb(0 0 0 / 0.15),
    inset 0 1px 0 rgb(255 255 255 / 0.15);
  backdrop-filter: blur(var(--blur-2xl)) saturate(var(--backdrop-saturate));}

.mobile-signin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5); /* External spacing - margin below header (1.25rem) */
}

.mobile-signin-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: rgb(var(--color-secondary-rgb) / 1);
  margin: 0;
  letter-spacing: -0.02em;
}

[data-theme="dark"] .mobile-signin-title {
  color: rgb(var(--color-secondary-rgb) / 1);
}

.mobile-signin-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: rgb(0 0 0 / 0.15);
  border: 1px solid rgb(0 0 0 / 0.25);
  color: rgb(0 0 0 / 0.85);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  z-index: 10;
}

.mobile-signin-close:hover {
  background: rgb(0 0 0 / 0.2);
  border-color: rgb(0 0 0 / 0.3);
  color: rgb(0 0 0 / 1);
  transform: scale(1.05);
}

.mobile-signin-close:active {
  transform: scale(0.95);
  background: rgb(0 0 0 / 0.2);
}

.mobile-signin-close svg {
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  stroke-width: 2.5;
  stroke: currentColor;
  fill: none;
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}

.mobile-signin-close svg path {
  stroke: inherit;
  stroke-width: inherit;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

[data-theme="dark"] .mobile-signin-close {
  background: rgb(255 255 255 / 0.12);
  border-color: rgb(255 255 255 / 0.2);
  color: rgb(255 255 255 / 0.85);
  backdrop-filter: blur(var(--blur-lg));}

[data-theme="dark"] .mobile-signin-close:hover {
  background: rgb(255 255 255 / 0.18);
  border-color: rgb(255 255 255 / 0.3);
  color: rgb(255 255 255 / 1);
}

.mobile-signin-success {
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  background: rgb(34 197 94 / 0.1);
  border: 1px solid rgb(34 197 94 / 0.3);
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

[data-theme="dark"] .mobile-signin-success {
  background: rgb(34 197 94 / 0.15);
  border-color: rgb(34 197 94 / 0.4);
}

.mobile-signin-error {
  padding: var(--space-3) var(--space-4); /* Internal spacing - padding for error message (approx 0.875rem 1rem) */
  margin-bottom: var(--space-4); /* External spacing - margin below error message */
  background: rgb(var(--color-error-rgb) / 0.1);
  border: 1px solid rgb(var(--color-error-rgb) / 0.3);
  border-radius: 0.75rem;
  color: rgb(var(--color-error-rgb) / 1);
  font-size: 0.875rem;
  font-weight: 500;
  animation: mobileSignInErrorShake 0.4s ease;
}

@keyframes mobileSignInErrorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

[data-theme="dark"] .mobile-signin-error {
  background: rgb(var(--color-error-rgb) / 0.2);
  border-color: rgb(var(--color-error-rgb) / 0.35);
  color: rgb(var(--color-error-rgb) / 1);
  backdrop-filter: blur(var(--blur-lg));}

.mobile-signin-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.mobile-signin-form-container.opening .mobile-signin-form {
  animation: mobileSignInFormFadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

.mobile-signin-form-container.closing .mobile-signin-form {
  animation: mobileSignInFormFadeOut 0.2s ease both;
}

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

@keyframes mobileSignInFormFadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-5px);
  }
}

.mobile-signin-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-signin-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.mobile-signin-input {
  width: 100%;
  padding: var(--space-3) var(--space-4); /* Internal spacing - padding for input (approx 0.875rem 1rem) */
  border-radius: var(--radius-input);
  border: 2px solid rgb(var(--color-secondary-rgb) / 0.2);
  background: rgb(255 255 255 / 0.8);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  -moz-appearance: none;
       appearance: none;
}

.mobile-signin-input:focus {
  outline: none;
  border-color: rgb(var(--color-secondary-rgb) / 0.5);
  background: rgb(255 255 255 / 1);
  box-shadow: 0 0 0 3px rgb(var(--color-secondary-rgb) / 0.1);
}

.mobile-signin-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

[data-theme="dark"] .mobile-signin-input {
  background: rgb(var(--color-neutral-800-rgb) / 0.5);
  border-color: rgb(var(--color-secondary-rgb) / 0.3);
  color: var(--text-primary);
  backdrop-filter: blur(var(--blur-lg));}

[data-theme="dark"] .mobile-signin-input:focus {
  border-color: rgb(var(--color-secondary-rgb) / 0.5);
  background: rgb(var(--color-neutral-800-rgb) / 0.6);
  box-shadow: 0 0 0 3px rgb(var(--color-secondary-rgb) / 0.2);
  backdrop-filter: blur(var(--blur-xl));}

/* Dark mode placeholder text for mobile signin input - white color */
[data-theme="dark"] .mobile-signin-input::-moz-placeholder {
  color: var(--text-primary);
  opacity: 0.6;
}
[data-theme="dark"] .mobile-signin-input::placeholder {
  color: var(--text-primary);
  opacity: 0.6;
}

[data-theme="dark"] .mobile-signin-input::-webkit-input-placeholder {
  color: var(--text-primary);
  opacity: 0.6;
}

[data-theme="dark"] .mobile-signin-input::-moz-placeholder {
  color: var(--text-primary);
  opacity: 0.6;
}

.mobile-signin-submit {
  width: 100%;
  padding: var(--space-4); /* Internal spacing - padding for submit button */
  border-radius: var(--radius-button);
  background: linear-gradient(135deg, 
    rgb(var(--color-secondary-rgb) / 0.9) 0%, 
    rgb(var(--color-secondary-rgb) / 0.85) 100%);
  border: 2px solid rgb(var(--color-secondary-rgb) / 0.3);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 4px 12px rgb(var(--color-secondary-rgb) / 0.3),
    0 2px 6px rgb(0 0 0 / 0.1);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-signin-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, 
    rgb(var(--color-secondary-rgb) / 1) 0%, 
    rgb(var(--color-secondary-rgb) / 0.95) 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 6px 16px rgb(var(--color-secondary-rgb) / 0.4),
    0 3px 8px rgb(0 0 0 / 0.15);
}

.mobile-signin-submit:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.mobile-signin-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

[data-theme="dark"] .mobile-signin-submit {
  background: linear-gradient(135deg, 
    rgb(var(--color-secondary-rgb) / 0.85) 0%, 
    rgb(var(--color-secondary-rgb) / 0.8) 100%);
  border-color: rgb(var(--color-secondary-rgb) / 0.4);
  box-shadow: 
    0 4px 12px rgb(var(--color-secondary-rgb) / 0.25),
    0 2px 6px rgb(0 0 0 / 0.15),
    inset 0 1px 0 rgb(255 255 255 / 0.15);
  backdrop-filter: blur(var(--blur-xl));}

[data-theme="dark"] .mobile-signin-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, 
    rgb(var(--color-secondary-rgb) / 0.95) 0%, 
    rgb(var(--color-secondary-rgb) / 0.9) 100%);
  box-shadow: 
    0 6px 16px rgb(var(--color-secondary-rgb) / 0.3),
    0 3px 8px rgb(0 0 0 / 0.2),
    inset 0 1px 0 rgb(255 255 255 / 0.2);
  backdrop-filter: blur(var(--blur-xl));}

.mobile-signin-switch {
  width: 100%;
  padding: var(--space-3); /* Internal spacing - padding for switch button */
  background: transparent;
  border: none;
  color: rgb(var(--color-secondary-rgb) / 0.8);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-signin-switch:hover {
  color: rgb(var(--color-secondary-rgb) / 1);
}

[data-theme="dark"] .mobile-signin-switch {
  color: rgb(var(--color-secondary-rgb) / 0.8);
}

[data-theme="dark"] .mobile-signin-switch:hover {
  color: rgb(var(--color-secondary-rgb) / 1);
}

/* Mobile Logout Button - Redesigned */
.mobile-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3); /* External spacing - gap between icon and text */
  padding: var(--space-3) var(--space-6); /* Internal spacing - padding for button (approx 1.125rem 1.5rem) */
  border-radius: var(--radius-button);
  background: linear-gradient(135deg, 
    rgb(var(--color-error-rgb) / 0.12) 0%, 
    rgb(var(--color-error-rgb) / 0.08) 50%,
    rgb(var(--color-error-rgb) / 0.1) 100%);
  border: 2px solid rgb(var(--color-error-rgb) / 0.25);
  color: rgb(var(--color-error-rgb) / 1);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 4px 12px rgb(var(--color-error-rgb) / 0.15),
    0 2px 6px rgb(var(--color-error-rgb) / 0.1),
    0 0 0 0 rgb(var(--color-error-rgb) / 0),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(0 0 0 / 0.05);
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  min-height: 56px;
  position: relative;
  overflow: hidden;
  margin-bottom: 0; /* Removed bottom margin to minimize gap */
}

.mobile-logout-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgb(255 255 255 / 0.2) 0%, 
    rgb(255 255 255 / 0.08) 50%,
    transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-logout-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 255 255 / 0.25) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
  pointer-events: none;
}

.mobile-logout-btn:hover {
  background: linear-gradient(135deg, 
    rgb(var(--color-error-rgb) / 0.2) 0%, 
    rgb(var(--color-error-rgb) / 0.16) 50%,
    rgb(var(--color-error-rgb) / 0.18) 100%);
  border-color: rgb(var(--color-error-rgb) / 0.4);
  box-shadow: 
    0 8px 24px rgb(var(--color-error-rgb) / 0.25),
    0 4px 12px rgb(var(--color-error-rgb) / 0.15),
    0 0 0 4px rgb(var(--color-error-rgb) / 0.1),
    inset 0 1px 0 rgb(255 255 255 / 0.3),
    inset 0 -1px 0 rgb(0 0 0 / 0.05);
  transform: translateY(-3px) scale(1.02);
}

.mobile-logout-btn:hover::before {
  opacity: 1;
}

.mobile-logout-btn:active {
  transform: translateY(-1px) scale(0.99);
  box-shadow: 
    0 2px 8px rgb(var(--color-error-rgb) / 0.2),
    0 1px 4px rgb(var(--color-error-rgb) / 0.15),
    0 0 0 2px rgb(var(--color-error-rgb) / 0.15),
    inset 0 1px 0 rgb(255 255 255 / 0.2);
}

.mobile-logout-btn:active::after {
  width: 300px;
  height: 300px;
  opacity: 1;
}

.mobile-logout-btn:focus-visible {
  outline: 3px solid rgb(var(--color-error-rgb) / 0.4);
  outline-offset: 3px;
  border-radius: var(--radius-button);
}

[data-theme="dark"] .mobile-logout-btn {
  background: linear-gradient(135deg, 
    rgb(var(--color-error-rgb) / 0.22) 0%, 
    rgb(var(--color-error-rgb) / 0.18) 50%,
    rgb(var(--color-error-rgb) / 0.22) 100%);
  border-color: rgb(var(--color-error-rgb) / 0.35);
  color: rgb(var(--color-error-rgb) / 1);
  box-shadow: 
    0 4px 12px rgb(var(--color-error-rgb) / 0.15),
    0 2px 6px rgb(var(--color-error-rgb) / 0.1),
    0 0 0 0 rgb(var(--color-error-rgb) / 0),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(var(--color-error-rgb) / 0.1);
  backdrop-filter: blur(var(--blur-xl));}

[data-theme="dark"] .mobile-logout-btn:hover {
  background: linear-gradient(135deg, 
    rgb(var(--color-error-rgb) / 0.28) 0%, 
    rgb(var(--color-error-rgb) / 0.24) 50%,
    rgb(var(--color-error-rgb) / 0.28) 100%);
  border-color: rgb(var(--color-error-rgb) / 0.5);
  box-shadow: 
    0 8px 24px rgb(var(--color-error-rgb) / 0.2),
    0 4px 12px rgb(var(--color-error-rgb) / 0.15),
    0 0 0 4px rgb(var(--color-error-rgb) / 0.2),
    inset 0 1px 0 rgb(255 255 255 / 0.25),
    inset 0 -1px 0 rgb(var(--color-error-rgb) / 0.15);
  backdrop-filter: blur(var(--blur-xl));}

.mobile-logout-btn .logout-icon {
  width: 1.375rem;
  height: 1.375rem;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.mobile-logout-btn:hover .logout-icon {
  transform: scale(1.15) translateX(2px);
}

/* Theme Toggle Mobile - Redesigned */
.theme-toggle-mobile,
.theme-toggle-btn.theme-toggle-mobile {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  padding: var(--space-3) var(--space-6); /* Internal spacing - padding for toggle button (approx 1.125rem 1.5rem) */
  border-radius: var(--radius-button);
  background: linear-gradient(135deg, 
    rgb(0 0 0 / 0.05) 0%, 
    rgb(0 0 0 / 0.03) 50%,
    rgb(0 0 0 / 0.04) 100%);
  border: 2px solid rgb(0 0 0 / 0.1);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 2px 8px rgb(0 0 0 / 0.08),
    0 1px 4px rgb(0 0 0 / 0.05),
    0 0 0 0 rgb(var(--color-primary-rgb) / 0),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(0 0 0 / 0.05);
  -webkit-tap-highlight-color: transparent;
  min-height: 56px;
  height: auto;
  position: relative;
  overflow: hidden;
  flex-shrink: 1;
}

.theme-toggle-mobile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgb(255 255 255 / 0.15) 0%, 
    rgb(255 255 255 / 0.05) 50%,
    transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.theme-toggle-mobile::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, 
    rgb(var(--color-primary-rgb) / 0.2) 0%, 
    rgb(var(--color-primary-rgb) / 0.1) 30%,
    transparent 70%);
  transform: translate(-50%, -50%);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
              height 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
              opacity 0.5s ease;
  opacity: 0;
  pointer-events: none;
}

.theme-toggle-mobile:hover {
  background: linear-gradient(135deg, 
    rgb(0 0 0 / 0.08) 0%, 
    rgb(0 0 0 / 0.05) 50%,
    rgb(0 0 0 / 0.06) 100%);
  border-color: rgb(0 0 0 / 0.15);
  box-shadow: 
    0 4px 16px rgb(0 0 0 / 0.12),
    0 2px 8px rgb(0 0 0 / 0.08),
    0 0 0 4px rgb(var(--color-primary-rgb) / 0.08),
    inset 0 1px 0 rgb(255 255 255 / 0.3),
    inset 0 -1px 0 rgb(0 0 0 / 0.05);
  transform: translateY(-3px) scale(1.02);
}

.theme-toggle-mobile:hover::before {
  opacity: 1;
}

.theme-toggle-mobile:hover::after {
  width: 200px;
  height: 200px;
  opacity: 1;
}

.theme-toggle-mobile:active {
  transform: translateY(-1px) scale(0.99);
  box-shadow: 
    0 1px 6px rgb(0 0 0 / 0.1),
    0 1px 3px rgb(0 0 0 / 0.08),
    0 0 0 2px rgb(var(--color-primary-rgb) / 0.12),
    inset 0 1px 0 rgb(255 255 255 / 0.2);
}

.theme-toggle-mobile:active::after {
  width: 350px;
  height: 350px;
  opacity: 0.8;
}

.theme-toggle-mobile:focus-visible,
.theme-toggle-btn.theme-toggle-mobile:focus-visible {
  outline: 3px solid rgb(var(--color-primary-rgb) / 0.4);
  outline-offset: 3px;
  border-radius: var(--radius-button);
}

[data-theme="dark"] .theme-toggle-mobile {
  background: linear-gradient(135deg, 
    rgb(255 255 255 / 0.1) 0%, 
    rgb(255 255 255 / 0.06) 50%,
    rgb(255 255 255 / 0.08) 100%);
  border-color: rgb(255 255 255 / 0.18);
  box-shadow: 
    0 2px 8px rgb(0 0 0 / 0.15),
    0 1px 4px rgb(0 0 0 / 0.1),
    0 0 0 0 rgb(var(--color-primary-rgb) / 0),
    inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(255 255 255 / 0.05);
  backdrop-filter: blur(var(--blur-xl));}

[data-theme="dark"] .theme-toggle-mobile:hover {
  background: linear-gradient(135deg, 
    rgb(255 255 255 / 0.15) 0%, 
    rgb(255 255 255 / 0.1) 50%,
    rgb(255 255 255 / 0.12) 100%);
  border-color: rgb(255 255 255 / 0.25);
  box-shadow: 
    0 4px 16px rgb(0 0 0 / 0.2),
    0 2px 8px rgb(0 0 0 / 0.15),
    0 0 0 4px rgb(var(--color-primary-rgb) / 0.15),
    inset 0 1px 0 rgb(255 255 255 / 0.25),
    inset 0 -1px 0 rgb(255 255 255 / 0.1);
  backdrop-filter: blur(var(--blur-xl));}

[data-theme="dark"] .theme-toggle-mobile::after {
  background: radial-gradient(circle, 
    rgb(var(--color-primary-rgb) / 0.25) 0%, 
    rgb(var(--color-primary-rgb) / 0.12) 30%,
    transparent 70%);
}

.theme-toggle-mobile .theme-toggle-icon {
  width: 1.625rem;
  height: 1.625rem;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.theme-toggle-mobile:hover .theme-toggle-icon {
  transform: scale(1.2) rotate(15deg);
}

.theme-toggle-mobile:active .theme-toggle-icon {
  transform: scale(1.1) rotate(30deg);
}

/* Theme icon visibility - ensure only one icon shows at a time */
.theme-icon-light,
.theme-icon-dark {
  display: block;
}

/* Hide dark icon by default (light mode) */
.theme-icon-dark {
  display: none;
}

/* Show dark icon in dark mode, hide light icon */
[data-theme="dark"] .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-icon-dark {
  display: block;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .mobile-menu-link {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
  
  .mobile-menu-link:hover {
    transform: none;
  }
  
  .mobile-menu-link:active {
    transform: scale(0.98);
  }
}

/* Desktop Theme Toggle Button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(2rem, 2.5vw, 2.5rem);
  height: clamp(2rem, 2.5vw, 2.5rem);
  padding: clamp(0.25rem, 0.5vw, var(--space-2)); /* Internal spacing - padding for theme toggle button */
  border-radius: var(--radius-button);
  background: linear-gradient(135deg, rgb(var(--color-primary-rgb) / 0.15) 0%, rgb(var(--color-primary-rgb) / 0.1) 100%);
  border: 1px solid rgb(var(--color-primary-rgb) / 0.3);
  color: rgb(var(--color-primary-rgb) / 1);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgb(var(--color-primary-rgb) / 0.15), 0 1px 4px rgb(0 0 0 / 0.1);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  min-width: -moz-fit-content;
  min-width: fit-content; /* Ensure button maintains minimum size */
}

.theme-toggle-btn:hover {
  background: linear-gradient(135deg, rgb(var(--color-primary-rgb) / 0.25) 0%, rgb(var(--color-primary-rgb) / 0.2) 100%);
  border-color: rgb(var(--color-primary-rgb) / 0.5);
  color: rgb(var(--color-primary-rgb) / 1);
  box-shadow: 0 4px 12px rgb(var(--color-primary-rgb) / 0.25), 0 2px 6px rgb(0 0 0 / 0.15);
  transform: translateY(-1px);
}

.theme-toggle-btn:active {
  transform: translateY(0) scale(0.98);
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid rgb(var(--color-primary-rgb) / 0.5);
  outline-offset: 2px;
}

[data-theme="dark"] .theme-toggle-btn {
  background: linear-gradient(135deg, rgb(var(--color-primary-rgb) / 0.15) 0%, rgb(var(--color-primary-rgb) / 0.1) 100%);
  border-color: rgb(var(--color-primary-rgb) / 0.3);
  color: rgb(var(--color-primary-rgb) / 1);
  box-shadow: 0 2px 8px rgb(var(--color-primary-rgb) / 0.2), 0 1px 4px rgb(0 0 0 / 0.2);
}

[data-theme="dark"] .theme-toggle-btn:hover {
  background: linear-gradient(135deg, rgb(var(--color-primary-rgb) / 0.25) 0%, rgb(var(--color-primary-rgb) / 0.2) 100%);
  border-color: rgb(var(--color-primary-rgb) / 0.5);
  box-shadow: 0 4px 12px rgb(var(--color-primary-rgb) / 0.3), 0 2px 6px rgb(0 0 0 / 0.3);
}

.theme-toggle-btn .theme-toggle-icon {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle-btn:hover .theme-toggle-icon {
  transform: scale(1.1) rotate(15deg);
}

.theme-toggle-btn:active .theme-toggle-icon {
  transform: scale(0.95);
}

.navbar-content > .theme-toggle-btn {
  margin-left: var(--space-2); /* External spacing - margin between toggle and other items */
}

/* Language Toggle Button */
.language-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(2rem, 2.5vw, 2.5rem);
  height: clamp(2rem, 2.5vw, 2.5rem);
  padding: clamp(0.25rem, 0.5vw, var(--space-2));
  border-radius: var(--radius-button);
  background: linear-gradient(135deg, rgb(var(--color-primary-rgb) / 0.15) 0%, rgb(var(--color-primary-rgb) / 0.1) 100%);
  border: 1px solid rgb(var(--color-primary-rgb) / 0.3);
  color: rgb(var(--color-primary-rgb) / 1);
  font-weight: var(--font-weight-semibold);
  font-size: clamp(0.75rem, 0.875vw, var(--font-size-sm));
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  min-width: -moz-fit-content;
  min-width: fit-content; /* Ensure button maintains minimum size */
}

.language-toggle-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgb(var(--color-primary-rgb) / 0.25) 0%, rgb(var(--color-primary-rgb) / 0.2) 100%);
  border-color: rgb(var(--color-primary-rgb) / 0.5);
  color: rgb(var(--color-primary-rgb) / 1);
  box-shadow: 0 4px 12px rgb(var(--color-primary-rgb) / 0.25), 0 2px 6px rgb(0 0 0 / 0.15);
  transform: translateY(-1px);
}

.language-toggle-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.language-toggle-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.language-toggle-btn:focus-visible {
  outline: 2px solid rgb(var(--color-primary-rgb) / 0.5);
  outline-offset: 2px;
}

[data-theme="dark"] .language-toggle-btn {
  background: linear-gradient(135deg, rgb(var(--color-primary-rgb) / 0.15) 0%, rgb(var(--color-primary-rgb) / 0.1) 100%);
  border-color: rgb(var(--color-primary-rgb) / 0.3);
  color: rgb(var(--color-primary-rgb) / 1);
  box-shadow: 0 2px 8px rgb(var(--color-primary-rgb) / 0.2), 0 1px 4px rgb(0 0 0 / 0.2);
}

[data-theme="dark"] .language-toggle-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgb(var(--color-primary-rgb) / 0.25) 0%, rgb(var(--color-primary-rgb) / 0.2) 100%);
  border-color: rgb(var(--color-primary-rgb) / 0.5);
  box-shadow: 0 4px 12px rgb(var(--color-primary-rgb) / 0.3), 0 2px 6px rgb(0 0 0 / 0.3);
}

.language-toggle-text {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.navbar-content > .language-toggle-btn {
  margin-left: var(--space-2);
}

/* Mobile language toggle */
.language-toggle-btn.theme-toggle-mobile,
.mobile-menu-actions .language-toggle-btn {
  width: 100% !important;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-button);
  background: linear-gradient(135deg,
    rgb(0 0 0 / 0.05) 0%,
    rgb(0 0 0 / 0.03) 50%,
    rgb(0 0 0 / 0.04) 100%);
  border: 1px solid rgb(var(--color-primary-rgb) / 0.2);
  margin-bottom: var(--space-2);
}

[data-theme="dark"] .language-toggle-btn.theme-toggle-mobile,
[data-theme="dark"] .mobile-menu-actions .language-toggle-btn {
  background: linear-gradient(135deg,
    rgb(255 255 255 / 0.1) 0%,
    rgb(255 255 255 / 0.06) 50%,
    rgb(255 255 255 / 0.08) 100%);
  border-color: rgb(var(--color-primary-rgb) / 0.3);
}

@media (max-width: 767px) {
  .language-toggle-btn {
    width: 2.25rem !important;
    height: 2.25rem !important;
    padding: var(--space-1) var(--space-2) !important;
  }
}

@media (min-width: 768px) {
  html {
    scroll-padding-top: 5rem;
  }

  .glass-card {
    border-radius: 1.5rem;
  }

  .navbar-wrapper {
    padding: clamp(var(--space-3), 1vw, var(--space-4)) clamp(var(--space-4), 1.5vw, var(--space-6));
  }

  .navbar-glass-container {
    max-width: calc(100vw - clamp(2rem, 4vw, 3rem));
    padding: clamp(var(--space-2), 0.75vw, var(--space-3)) clamp(var(--space-3), 1.25vw, var(--space-5));
  }

  .nav-links.mobile-menu {
    display: none !important;
  }

  footer {
    padding-bottom: var(--space-12); /* Internal spacing - padding at bottom of footer (3rem) */
  }
}

/* Large desktop screens - ensure navbar doesn't get too spread out */
@media (min-width: 1920px) {
  .navbar-glass-container {
    max-width: min(calc(100vw - 4rem), 1920px);
  }

  .navbar-content {
    gap: clamp(1rem, 1.5vw, 1.5rem);
  }

  .navbar-links {
    gap: clamp(0.75rem, 1vw, 1.25rem);
  }

  .navbar-links a {
    font-size: clamp(0.875rem, 1vw, 1rem);
    padding: clamp(var(--space-2), 0.75vw, var(--space-3)) clamp(var(--space-3), 1vw, var(--space-5));
  }
}


/* ==========================================================================
   Chatbot Styles
   ========================================================================== */

/* Chatbot Widget Container */
/* Positioning is handled dynamically by JavaScript to respect navbar and scroll-to-top button */
#chatbotWidget {
  position: fixed;
  z-index: 100;
  /* Default fallback positioning - will be overridden by JavaScript */
  bottom: 2rem;
  right: 2rem;
  /* Smooth transitions for position changes */
  transition: bottom 0.3s var(--animation-easing),
              right 0.3s var(--animation-easing),
              transform 0.2s ease;
  /* Prevent text selection and double-tap zoom on mobile */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

/* Hide chatbot when qualification funnel is open */
body.qualification-funnel-open #chatbotWidget {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 768px) {
  #chatbotWidget {
    /* Default fallback for mobile - positioned above navbar (5.5rem) */
    /* Right position adjusted for center alignment (chat 3.5rem vs scroll 3rem) */
    bottom: 5.5rem;
    right: 1.25rem; /* 1.5rem - 0.25rem for center alignment with scroll button */
  }
}

@media (max-width: 767px) and (orientation: landscape) {
  #chatbotWidget {
    /* Landscape mobile fallback - adjusted for center alignment */
    right: 3.75rem; /* 4rem - 0.25rem for center alignment with scroll button */
  }
}

/* Chatbot Toggle Button */
.chatbot-toggle-btn {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-full);
  /* Default to orange for Team Piero */
  background: linear-gradient(135deg, rgb(255 140 0 / 0.95) 0%, rgb(255 165 0 / 0.95) 100%);
  border: 2px solid rgb(255 255 255 / 0.2);
  box-shadow: 
    0 4px 12px rgb(255 140 0 / 0.4),
    0 2px 4px rgb(0 0 0 / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition-property: all;
  transition-duration: var(--duration-slow);
  transition-timing-function: var(--easing-base);
  color: white;
  position: relative;
  z-index: 100;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s 0.3s,
              background 0.3s ease,
              box-shadow 0.3s ease;
}

/* Kiss Mortgage - Blue */
[data-app="kiss-mortgage"] .chatbot-toggle-btn {
  background: linear-gradient(135deg, rgb(5 102 141 / 0.95) 0%, rgb(2 132 199 / 0.95) 100%);
  box-shadow: 
    0 4px 12px rgb(5 102 141 / 0.4),
    0 2px 4px rgb(0 0 0 / 0.1);
}

.chatbot-toggle-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s,
              background 0.3s ease,
              box-shadow 0.3s ease;
}

.chatbot-toggle-btn:hover {
  transform: scale(1.05);
  /* Default to orange for Team Piero */
  box-shadow: 
    0 6px 16px rgb(255 140 0 / 0.5),
    0 4px 8px rgb(0 0 0 / 0.15);
}

/* Kiss Mortgage - Blue hover shadow */
[data-app="kiss-mortgage"] .chatbot-toggle-btn:hover {
  box-shadow: 
    0 6px 16px rgb(5 102 141 / 0.5),
    0 4px 8px rgb(0 0 0 / 0.15);
}

.chatbot-toggle-btn:active {
  transform: scale(0.95);
}

.chatbot-icon,
.chatbot-close-icon {
  width: 1.5rem;
  height: 1.5rem;
  position: absolute;
}

.chatbot-close-icon {
  display: none;
}

.chatbot-close-icon:not(.hidden) {
  display: block;
}

/* Chatbot Window */
.chatbot-window {
  position: fixed;
  /* bottom and right are set dynamically by JavaScript */
  bottom: 6.5rem;
  right: 1.5rem;
  width: calc(100vw - 3rem);
  max-width: calc(100vw - 3rem);
  height: 32rem;
  max-height: calc(100vh - 10rem);
  background: var(--bg-primary);
  border-radius: 1rem;
  box-shadow: 
    0 10px 40px rgb(0 0 0 / 0.15),
    0 4px 12px rgb(0 0 0 / 0.1);
  border: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 50;
  /* Smooth transitions for position changes and visibility */
  transition: bottom 0.3s var(--animation-easing),
              right 0.3s var(--animation-easing),
              left 0.3s var(--animation-easing),
              width 0.3s var(--animation-easing),
              max-width 0.3s var(--animation-easing),
              height 0.3s var(--animation-easing),
              max-height 0.3s var(--animation-easing),
              opacity 0.3s var(--animation-easing),
              transform 0.3s var(--animation-easing),
              visibility 0s linear;
  opacity: 1;
  transform: translateY(0) scale(1) translateZ(0);
  visibility: visible;
  pointer-events: auto;
  /* Ensure all children animate together */
  transform-origin: bottom right;
  /* Force hardware acceleration */
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Create a new stacking context to ensure children animate with parent */
  isolation: isolate;
  /* Ensure all children are properly clipped and rendered together */
  transform-style: flat;
  /* Force the entire container to be rendered as a single unit */
  transform: translateZ(0);
}

.chatbot-window.hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95) translateZ(0);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s var(--animation-easing),
              transform 0.3s var(--animation-easing),
              visibility 0s linear 0.3s,
              bottom 0.3s var(--animation-easing),
              right 0.3s var(--animation-easing),
              left 0.3s var(--animation-easing),
              width 0.3s var(--animation-easing),
              max-width 0.3s var(--animation-easing),
              height 0.3s var(--animation-easing),
              max-height 0.3s var(--animation-easing);
  /* Keep display: flex to allow transitions, but element is invisible and non-interactive */
  display: flex;
  /* Ensure transform origin is consistent */
  transform-origin: bottom right;
}

/* Children should naturally inherit parent's opacity/visibility */
/* No need to explicitly set - parent's opacity will cascade to all children */

@media (min-width: 769px) {
  .chatbot-window {
    max-width: 28rem;
  }
}

@media (max-width: 768px) {
  .chatbot-window {
    width: calc(100vw - 1.5rem);
    height: calc(100vh - 15rem);
    max-height: calc(100vh - 15rem);
    /* bottom and right are set dynamically by JavaScript */
    bottom: 10rem;
    right: 0.75rem;
    left: 0.75rem;
  }
}

/* Chatbot Header */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  /* Default to orange for Team Piero */
  background: linear-gradient(135deg, rgb(255 140 0 / 0.95) 0%, rgb(255 165 0 / 0.95) 100%);
  color: white !important; /* Always white regardless of theme */
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
  /* Match window border-radius: 1rem (was 1.5rem) */
  border-radius: 1rem 1rem 0 0;
  /* Ensure header is contained within parent */
  position: relative;
  z-index: 1;
  /* Remove any transitions that might conflict with parent animation */
  transition: none;
}

/* Kiss Mortgage - Blue header */
[data-app="kiss-mortgage"] .chatbot-header {
  background: linear-gradient(135deg, rgb(5 102 141 / 0.95) 0%, rgb(2 132 199 / 0.95) 100%);
}

.chatbot-header-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.chatbot-header-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background: rgb(255 255 255 / 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-header-avatar svg {
  width: 1.25rem;
  height: 1.25rem;
}

.chatbot-header-text {
  flex: 1;
  min-width: 0;
}

.chatbot-header-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
  color: white !important; /* Always white regardless of theme */
}

.chatbot-header-subtitle {
  font-size: 0.75rem;
  opacity: 0.9;
  margin: var(--space-1) 0 0 0; /* External spacing - margin above timestamp */
  line-height: 1.2;
  color: white !important; /* Always white regardless of theme */
}

.chatbot-minimize-btn {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 0.1);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition-property: background;
  transition-duration: var(--duration-base);
  transition-timing-function: var(--easing-base);
  flex-shrink: 0;
}

.chatbot-minimize-btn:hover {
  background: rgb(255 255 255 / 0.2);
}

.chatbot-minimize-btn svg {
  width: 1rem;
  height: 1rem;
}

/* Chatbot Messages */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-primary);
  /* Ensure messages area is contained within parent */
  position: relative;
  z-index: 1;
  /* Remove any transitions that might conflict with parent animation */
  transition: none;
}

.chatbot-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chatbot-message-user {
  flex-direction: row-reverse;
}

.chatbot-message-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  /* Default to orange for Team Piero */
  background: linear-gradient(135deg, rgb(255 140 0 / 0.1) 0%, rgb(255 165 0 / 0.1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-primary);
}

/* Kiss Mortgage - Blue avatar */
[data-app="kiss-mortgage"] .chatbot-message-avatar {
  background: linear-gradient(135deg, rgb(5 102 141 / 0.1) 0%, rgb(2 132 199 / 0.1) 100%);
}

.chatbot-message-user .chatbot-message-avatar {
  /* Default to orange for Team Piero */
  background: linear-gradient(135deg, rgb(255 140 0 / 0.2) 0%, rgb(255 165 0 / 0.2) 100%);
}

/* Kiss Mortgage - Blue user avatar */
[data-app="kiss-mortgage"] .chatbot-message-user .chatbot-message-avatar {
  background: linear-gradient(135deg, rgb(5 102 141 / 0.2) 0%, rgb(2 132 199 / 0.2) 100%);
}

.chatbot-message-avatar svg {
  width: 1rem;
  height: 1rem;
}

.chatbot-message-content {
  max-width: 75%;
  padding: var(--space-3) var(--space-4); /* Internal spacing - padding for message content */
  border-radius: 1rem;
  background: var(--border-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  line-height: 1.5;
  word-wrap: break-word;
}

/* Markdown formatting for AI assistant messages */
.chatbot-message-content p {
  margin: 0 0 0.75rem 0;
}

.chatbot-message-content p:last-child {
  margin-bottom: 0;
}

.chatbot-message-content h1,
.chatbot-message-content h2,
.chatbot-message-content h3,
.chatbot-message-content h4,
.chatbot-message-content h5,
.chatbot-message-content h6 {
  margin: 1rem 0 0.5rem 0;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.chatbot-message-content h1:first-child,
.chatbot-message-content h2:first-child,
.chatbot-message-content h3:first-child,
.chatbot-message-content h4:first-child,
.chatbot-message-content h5:first-child,
.chatbot-message-content h6:first-child {
  margin-top: 0;
}

.chatbot-message-content h1 {
  font-size: 1.25rem;
}

.chatbot-message-content h2 {
  font-size: 1.125rem;
}

.chatbot-message-content h3 {
  font-size: 1rem;
}

.chatbot-message-content h4,
.chatbot-message-content h5,
.chatbot-message-content h6 {
  font-size: 0.9375rem;
}

.chatbot-message-content ul,
.chatbot-message-content ol {
  margin: 0.5rem 0 0.75rem 0;
  padding-left: 1.5rem;
}

.chatbot-message-content ul:last-child,
.chatbot-message-content ol:last-child {
  margin-bottom: 0;
}

.chatbot-message-content li {
  margin: 0.25rem 0;
  line-height: 1.6;
}

.chatbot-message-content ul {
  list-style-type: disc;
}

.chatbot-message-content ol {
  list-style-type: decimal;
}

.chatbot-message-content ul ul,
.chatbot-message-content ol ol,
.chatbot-message-content ul ol,
.chatbot-message-content ol ul {
  margin: 0.25rem 0;
  padding-left: 1.25rem;
}

.chatbot-message-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

.chatbot-message-content em {
  font-style: italic;
}

.chatbot-message-content code {
  background: var(--bg-secondary);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
  font-family: 'Courier New', Courier, monospace;
  color: var(--text-primary);
}

.chatbot-message-content pre {
  background: var(--bg-secondary);
  padding: 0.75rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.chatbot-message-content pre:last-child {
  margin-bottom: 0;
}

.chatbot-message-content pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.chatbot-message-content a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-underline-offset: 2px;
  transition: opacity 0.2s ease;
}

.chatbot-message-content a:hover {
  opacity: 0.8;
}

.chatbot-message-content blockquote {
  margin: 0.75rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border-primary);
  color: var(--text-secondary);
  font-style: italic;
}

.chatbot-message-content blockquote:last-child {
  margin-bottom: 0;
}

.chatbot-message-content hr {
  margin: 1rem 0;
  border: none;
  border-top: 1px solid var(--border-primary);
}

.chatbot-message-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.8125rem;
}

.chatbot-message-content table:last-child {
  margin-bottom: 0;
}

.chatbot-message-content th,
.chatbot-message-content td {
  padding: 0.5rem;
  border: 1px solid var(--border-primary);
  text-align: left;
}

.chatbot-message-content th {
  font-weight: 600;
  background: var(--bg-secondary);
}

.chatbot-message-user .chatbot-message-content {
  /* Default to orange for Team Piero */
  background: linear-gradient(135deg, rgb(255 140 0 / 0.1) 0%, rgb(255 165 0 / 0.1) 100%);
  border: 1px solid rgb(255 140 0 / 0.2);
}

/* Kiss Mortgage - Blue user message */
[data-app="kiss-mortgage"] .chatbot-message-user .chatbot-message-content {
  background: linear-gradient(135deg, rgb(5 102 141 / 0.1) 0%, rgb(2 132 199 / 0.1) 100%);
  border: 1px solid rgb(5 102 141 / 0.2);
}

.chatbot-message-loading {
  display: flex;
  gap: var(--space-1); /* External spacing - gap between loading dots */
  padding: var(--space-3) var(--space-4); /* Internal spacing - padding for loading message */
}

.chatbot-message-loading span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: bounce 1.4s infinite ease-in-out both;
}

.chatbot-message-loading span:nth-child(1) {
  animation-delay: -0.32s;
}

.chatbot-message-loading span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Chatbot Form */
.chatbot-form {
  padding: 1rem;
  border-top: 1px solid var(--border-primary);
  background: var(--bg-primary);
  /* Ensure form is contained within parent's transform context */
  position: relative;
  z-index: 1;
  /* Remove any transitions that might conflict with parent animation */
  transition: none;
  /* Ensure form inherits parent's transform/opacity smoothly */
  transform: translateZ(0);
  will-change: auto;
}

.chatbot-input-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  /* Ensure wrapper is contained within parent */
  position: relative;
  /* Remove any transitions that might conflict with parent animation */
  transition: none;
  /* Ensure wrapper inherits parent's transform/opacity smoothly */
  transform: translateZ(0);
  will-change: auto;
}

.chatbot-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 1.5rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  resize: none;
  outline: none;
  /* Only transition border/shadow, not opacity/transform which should inherit from parent */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 2.75rem;
  max-height: 6rem;
  /* Let input inherit parent's opacity/transform - don't set explicit values */
  /* Ensure input is part of parent's transform context */
  transform: translateZ(0);
  will-change: auto;
}

.chatbot-input:focus {
  /* Default to orange for Team Piero */
  border-color: rgb(255 140 0 / 0.5);
  box-shadow: 0 0 0 3px rgb(255 140 0 / 0.1);
}

/* Kiss Mortgage - Blue input focus */
[data-app="kiss-mortgage"] .chatbot-input:focus {
  border-color: rgb(5 102 141 / 0.5);
  box-shadow: 0 0 0 3px rgb(5 102 141 / 0.1);
}

.chatbot-input:disabled {
  /* Only reduce opacity if parent is visible, otherwise inherit parent's opacity */
  opacity: 0.6;
  cursor: not-allowed;
  /* Ensure disabled state doesn't interfere with parent animation */
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When parent is hidden, ensure disabled input inherits parent's opacity smoothly */
.chatbot-window.hidden .chatbot-input:disabled {
  opacity: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-send-btn {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  /* Default to orange for Team Piero */
  background: linear-gradient(135deg, rgb(255 140 0 / 0.95) 0%, rgb(255 165 0 / 0.95) 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Only transition interactive states, not transform/opacity which should be controlled by parent */
  transition-property: background, box-shadow, transform;
  transition-duration: var(--duration-base), var(--duration-base), var(--duration-base);
  transition-timing-function: var(--easing-base), var(--easing-base), var(--easing-base);
  flex-shrink: 0;
  /* Ensure button is contained within parent's transform context */
  position: relative;
  /* Prevent independent transforms that might conflict */
  will-change: background, box-shadow;
  /* Let button inherit parent's opacity/transform - don't set explicit values */
  transform: translateZ(0);
}

/* Kiss Mortgage - Blue send button */
[data-app="kiss-mortgage"] .chatbot-send-btn {
  background: linear-gradient(135deg, rgb(5 102 141 / 0.95) 0%, rgb(2 132 199 / 0.95) 100%);
}

.chatbot-send-btn:hover:not(:disabled) {
  /* Use transform with relative scaling - this will work within parent's transform context */
  transform: translateZ(0) scale(1.05);
  /* Default to orange for Team Piero */
  box-shadow: 0 4px 12px rgb(255 140 0 / 0.4);
}

/* Kiss Mortgage - Blue send button hover */
[data-app="kiss-mortgage"] .chatbot-send-btn:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgb(5 102 141 / 0.4);
}

.chatbot-send-btn:active:not(:disabled) {
  /* Use transform with relative scaling - this will work within parent's transform context */
  transform: translateZ(0) scale(0.95);
}

/* Disable hover/active transforms when parent is hidden to prevent animation conflicts */
.chatbot-window.hidden .chatbot-send-btn:hover:not(:disabled),
.chatbot-window.hidden .chatbot-send-btn:active:not(:disabled) {
  transform: translateZ(0);
}

.chatbot-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When parent is hidden, ensure disabled button inherits parent's opacity smoothly */
.chatbot-window.hidden .chatbot-send-btn:disabled {
  opacity: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-send-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Dark Mode Support */
[data-theme="dark"] .chatbot-window {
  background: var(--bg-primary);
  border-color: rgb(255 255 255 / 0.1);
}

[data-theme="dark"] .chatbot-message-content {
  background: rgb(255 255 255 / 0.05);
  border-color: rgb(255 255 255 / 0.1);
}

[data-theme="dark"] .chatbot-message-user .chatbot-message-content {
  /* Default to orange for Team Piero */
  background: linear-gradient(135deg, rgb(255 140 0 / 0.2) 0%, rgb(255 165 0 / 0.2) 100%);
  border-color: rgb(255 140 0 / 0.3);
}

/* Kiss Mortgage - Blue user message in dark mode */
[data-theme="dark"][data-app="kiss-mortgage"] .chatbot-message-user .chatbot-message-content {
  background: linear-gradient(135deg, rgb(5 102 141 / 0.2) 0%, rgb(2 132 199 / 0.2) 100%);
  border-color: rgb(5 102 141 / 0.3);
}

[data-theme="dark"] .chatbot-input {
  background: rgb(255 255 255 / 0.05);
  border-color: rgb(255 255 255 / 0.1);
}

[data-theme="dark"] .chatbot-input:focus {
  /* Default to orange for Team Piero */
  border-color: rgb(255 140 0 / 0.5);
  box-shadow: 0 0 0 3px rgb(255 140 0 / 0.2);
}

/* Kiss Mortgage - Blue input focus in dark mode */
[data-theme="dark"][data-app="kiss-mortgage"] .chatbot-input:focus {
  border-color: rgb(5 102 141 / 0.5);
  box-shadow: 0 0 0 3px rgb(5 102 141 / 0.2);
}

[data-theme="dark"] .chatbot-form {
  border-top-color: rgb(255 255 255 / 0.1);
}


/* ==========================================================================
   Loading Component Styles
   ========================================================================== */
/* Prevent body scroll during initial loading */
body:has([data-loading="true"]) {
  overflow: hidden;
}

/* Smooth fade-in for app content after loading */
@keyframes appFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Loading spinner animation - consolidated (removed duplicate definition) */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Pulse animation for loading elements */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Ensure smooth transitions for loading states */
[data-loading="true"] {
  animation: appFadeIn 0.3s ease-in-out;
}

/* Qualification Funnel Animations */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-4px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(4px);
  }
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

/* Funnel step transitions */
.funnel-step {
  animation: fadeInSlide 0.3s ease-out;
}

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

/* Gentle looping bounce for success icon */
@keyframes gentleBounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.02);
  }
}

.animate-gentle-bounce {
  animation: gentleBounce 2s ease-in-out infinite;
}

/* Icon reveal animation for qualification success */
@keyframes iconReveal {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
  60% {
    transform: scale(1.2) rotate(10deg);
  }
  80% {
    transform: scale(0.95) rotate(-5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.animate-icon-reveal {
  animation: iconReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             gentleBounce 2s ease-in-out 0.8s infinite;
  opacity: 0;
}

/* Qualification Funnel Header - Glassmorphic Theme */
.funnel-header-glass {
  background: rgb(255 255 255 / 0.75);
  backdrop-filter: blur(var(--blur-2xl)) saturate(var(--backdrop-saturate));
  box-shadow: 0 4px 16px rgb(var(--color-primary-rgb) / 0.08),
              0 2px 8px rgb(0 0 0 / 0.04),
              0 0 0 1px rgb(255 255 255 / 0.3) inset,
              inset 0 1px 0 rgb(255 255 255 / 0.5);
}

[data-theme="dark"] .funnel-header-glass {
  background: rgb(var(--color-neutral-900-rgb) / 0.7);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.4),
              0 2px 8px rgb(0 0 0 / 0.3),
              0 0 0 1px rgb(var(--color-neutral-400-rgb) / 0.15) inset,
              inset 0 1px 0 rgb(255 255 255 / 0.08);
}

/* Progress bar shimmer animation */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.animate-shimmer {
  animation: shimmer 2s infinite;
}

/* ==========================================================================
   Auth Success Animations
   ========================================================================== */
/* Success fade-in animation for auth messages */
@keyframes successFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-success-fade-in {
  animation: successFadeIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Success state for auth buttons */
.auth-success-state {
  background: rgb(34 197 94 / 0.9) !important;
  border-color: rgb(34 197 94) !important;
  color: white !important;
  box-shadow: 0 0 20px rgb(34 197 94 / 0.5) !important;
  pointer-events: none;
}

.auth-success-state svg {
  animation: checkmarkDraw 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes checkmarkDraw {
  0% {
    stroke-dasharray: 0, 100;
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    stroke-dasharray: 100, 0;
    opacity: 1;
  }
}

/* Ensure confetti canvas is visible above all content on all screen sizes */
body > canvas {
  position: fixed !important;
  inset-block-start: 0 !important;
  inset-inline-start: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
  z-index: 99999 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure confetti canvas is visible above qualification funnel modal on desktop */
#qualificationFunnelModal ~ canvas,
body.qualification-funnel-open > canvas {
  position: fixed !important;
  inset-block-start: 0 !important;
  inset-inline-start: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
  z-index: 100000 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}


/* ==========================================================================
   Route Progress Bar Styles
   ========================================================================== */

/* Progress bar container */
#nprogress {
  pointer-events: none;
}

/* Progress bar */
#nprogress .bar {
  background: rgb(var(--color-primary-rgb));
  position: fixed;
  z-index: 99999;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  box-shadow: 0 0 10px rgb(var(--color-primary-rgb) / 0.5),
              0 0 5px rgb(var(--color-secondary-rgb) / 0.3);
}

/* Progress bar glow effect */
#nprogress .peg {
  display: block;
  position: absolute;
  right: 0px;
  width: 100px;
  height: 100%;
  box-shadow: 0 0 10px rgb(var(--color-secondary-rgb)),
              0 0 5px rgb(var(--color-secondary-rgb));
  opacity: 1.0;
  transform: rotate(3deg) translate(0px, -4px);
}

/* Smooth animation */
#nprogress .bar {
  transition: width 0.4s ease;
}

/* ==========================================================================
   Calculator Slider Styles
   ========================================================================== */
.calculator-slider {
  -webkit-appearance: none;
  -moz-appearance: none;
       appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, rgb(var(--color-primary-rgb)) 0%, rgb(var(--color-primary-rgb)) var(--slider-progress, 50%), rgb(var(--color-primary-rgb) / 0.2) var(--slider-progress, 50%), rgb(var(--color-primary-rgb) / 0.2) 100%);
  border-radius: 3px;
  outline: none;
  /* Remove transition on background for immediate visual feedback during dragging */
  transition: none;
  position: relative;
}

/* Webkit (Chrome, Safari, Edge) Slider Thumb - Glassmorphic Design */
.calculator-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, rgb(var(--color-secondary-rgb) / 0.85) 0%, rgb(168 133 62 / 0.9) 100%);
  border: 2px solid rgb(255 255 255 / 0.8);
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 
    0 2px 8px rgb(0 0 0 / 0.15),
    0 0 0 1px rgb(var(--color-secondary-rgb) / 0.3),
    inset 0 1px 3px rgb(255 255 255 / 0.4);
  backdrop-filter: blur(var(--blur-sm)) saturate(150%);
  -webkit-transition-property: all;
  transition-property: all;
  transition-duration: var(--duration-slow);
  transition-timing-function: var(--easing-base);
  position: relative;
  margin-top: -19px; /* Centers the 44px thumb on the 6px track */
}

.calculator-slider::-webkit-slider-thumb:active {
  transform: scale(1.05);
}

.calculator-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 
    0 3px 12px rgb(0 0 0 / 0.2),
    0 0 0 1px rgb(var(--color-secondary-rgb) / 0.4),
    inset 0 1px 3px rgb(255 255 255 / 0.5);
}

/* KISS Mortgage - Calculator slider thumb - Use gold color */
[data-app="kiss-mortgage"] .calculator-slider::-webkit-slider-thumb {
  background: linear-gradient(135deg, rgb(199 159 79 / 0.85) 0%, rgb(180 140 60 / 0.9) 100%);
  box-shadow: 
    0 2px 8px rgb(0 0 0 / 0.15),
    0 0 0 1px rgb(199 159 79 / 0.3),
    inset 0 1px 3px rgb(255 255 255 / 0.4);
}

[data-app="kiss-mortgage"] .calculator-slider::-webkit-slider-thumb:hover {
  box-shadow: 
    0 3px 12px rgb(0 0 0 / 0.2),
    0 0 0 1px rgb(199 159 79 / 0.4),
    inset 0 1px 3px rgb(255 255 255 / 0.5);
}

/* Firefox Slider Thumb - Glassmorphic Design */
.calculator-slider::-moz-range-thumb {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, rgb(var(--color-secondary-rgb) / 0.85) 0%, rgb(168 133 62 / 0.9) 100%);
  border: 2px solid rgb(255 255 255 / 0.8);
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 
    0 2px 8px rgb(0 0 0 / 0.15),
    0 0 0 1px rgb(var(--color-secondary-rgb) / 0.3),
    inset 0 1px 3px rgb(255 255 255 / 0.4);
  -moz-transition-property: all;
  transition-property: all;
  transition-duration: var(--duration-slow);
  transition-timing-function: var(--easing-base);
}

.calculator-slider::-moz-range-thumb:active {
  transform: scale(1.05);
}

.calculator-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 
    0 3px 12px rgb(0 0 0 / 0.2),
    0 0 0 1px rgb(var(--color-secondary-rgb) / 0.4),
    inset 0 1px 3px rgb(255 255 255 / 0.5);
}

/* KISS Mortgage - Firefox calculator slider thumb - Use gold color */
[data-app="kiss-mortgage"] .calculator-slider::-moz-range-thumb {
  background: linear-gradient(135deg, rgb(199 159 79 / 0.85) 0%, rgb(180 140 60 / 0.9) 100%);
  box-shadow: 
    0 2px 8px rgb(0 0 0 / 0.15),
    0 0 0 1px rgb(199 159 79 / 0.3),
    inset 0 1px 3px rgb(255 255 255 / 0.4);
}

[data-app="kiss-mortgage"] .calculator-slider::-moz-range-thumb:hover {
  box-shadow: 
    0 3px 12px rgb(0 0 0 / 0.2),
    0 0 0 1px rgb(199 159 79 / 0.4),
    inset 0 1px 3px rgb(255 255 255 / 0.5);
}

/* Slider Track Styling */
.calculator-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
}

.calculator-slider::-moz-range-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgb(var(--color-primary-rgb) / 0.2);
  border: none;
}

/* Dark Mode Support */
[data-theme="dark"] .calculator-slider {
  background: linear-gradient(to right, rgb(var(--color-primary-rgb)) 0%, rgb(var(--color-primary-rgb)) var(--slider-progress, 50%), rgb(var(--color-primary-rgb) / 0.2) var(--slider-progress, 50%), rgb(var(--color-primary-rgb) / 0.2) 100%);
}

[data-theme="dark"] .calculator-slider::-webkit-slider-thumb {
  background: linear-gradient(135deg, rgb(var(--color-secondary-rgb) / 0.85) 0%, rgb(217 119 6 / 0.9) 100%);
  border-color: rgb(255 255 255 / 0.9);
  box-shadow: 
    0 2px 8px rgb(0 0 0 / 0.3),
    0 0 0 1px rgb(var(--color-secondary-rgb) / 0.4),
    inset 0 1px 3px rgb(255 255 255 / 0.4);
}

/* KISS Mortgage - Dark mode calculator slider thumb - Use gold color */
[data-app="kiss-mortgage"][data-theme="dark"] .calculator-slider::-webkit-slider-thumb {
  background: linear-gradient(135deg, rgb(199 159 79 / 0.85) 0%, rgb(180 140 60 / 0.9) 100%);
  box-shadow: 
    0 2px 8px rgb(0 0 0 / 0.3),
    0 0 0 1px rgb(199 159 79 / 0.4),
    inset 0 1px 3px rgb(255 255 255 / 0.4);
}

[data-theme="dark"] .calculator-slider::-moz-range-thumb {
  background: linear-gradient(135deg, rgb(var(--color-secondary-rgb) / 0.85) 0%, rgb(217 119 6 / 0.9) 100%);
  border-color: rgb(255 255 255 / 0.9);
  box-shadow: 
    0 2px 8px rgb(0 0 0 / 0.3),
    0 0 0 1px rgb(var(--color-secondary-rgb) / 0.4),
    inset 0 1px 3px rgb(255 255 255 / 0.4);
}

/* KISS Mortgage - Dark mode Firefox calculator slider thumb - Use gold color */
[data-app="kiss-mortgage"][data-theme="dark"] .calculator-slider::-moz-range-thumb {
  background: linear-gradient(135deg, rgb(199 159 79 / 0.85) 0%, rgb(180 140 60 / 0.9) 100%);
  box-shadow: 
    0 2px 8px rgb(0 0 0 / 0.3),
    0 0 0 1px rgb(199 159 79 / 0.4),
    inset 0 1px 3px rgb(255 255 255 / 0.4);
}

/* ==========================================================================
   Interest Rate Display - Override global mobile font-size
   ========================================================================== */
/* Override the global 16px mobile font-size rule for the interest rate display */
.interest-rate-display {
  font-size: clamp(1.75rem, 4vw, 2.5rem) !important;
}

@media screen and (max-width: 768px) {
  .interest-rate-display,
  input.interest-rate-display,
  input[type="text"].interest-rate-display {
    font-size: clamp(1.75rem, 4vw, 2.5rem) !important;
  }
  
  [data-theme="dark"] .interest-rate-display,
  [data-theme="dark"] input.interest-rate-display,
  [data-theme="dark"] input[type="text"].interest-rate-display {
    font-size: clamp(1.75rem, 4vw, 2.5rem) !important;
  }
}



/*# sourceMappingURL=0999e5026018f9f9.css.map*/