/* Mobile Navigation - Left Sliding Panel with Accordion */

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(2px);
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile Navigation Panel */
.mobile-nav-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  max-width: 85vw;
  height: 100vh;
  background: #ffffff;
  z-index: 9999;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mobile-nav-panel.active {
  transform: translateX(0);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

/* Mobile Nav Header */
.mobile-nav-header {
  flex: 0 0 auto;
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.mobile-nav-brand {
  flex: 1;
}

.mobile-nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.mobile-logo-img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.mobile-nav-close {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav-close:hover {
  background: #e2e8f0;
  color: #334155;
}

/* Mobile Nav Content */
.mobile-nav-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

/* Mobile Navigation Menu */
.mobile-nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav-item {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #f1f5f9;
}

.mobile-nav-item:last-child {
  border-bottom: none;
}

/* Navigation Links */
.mobile-nav-link {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  text-decoration: none;
  color: #334155;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
  line-height: 1.4;
}

.mobile-nav-link:hover {
  background: #f8fafc;
  color: #1a73e8;
}

.mobile-nav-link:active {
  background: #e2e8f0;
}

/* Parent Items with Submenus */
.mobile-nav-parent {
  display: flex;
  align-items: center;
  position: relative;
}

.has-submenu > .mobile-nav-parent > .mobile-nav-link {
  flex: 1;
  padding-right: 8px;
}

.submenu-trigger {
  background: none;
  border: none;
  padding: 16px 20px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  min-width: 56px;
  min-height: 56px;
  touch-action: manipulation;

}

.submenu-trigger:hover {
  background: #f1f5f9;
  color: #334155;
}

.submenu-trigger:active {
  background: #e2e8f0;
  transform: scale(0.98);
}

.submenu-trigger:focus {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.chevron-icon {
  transition: transform 0.2s ease;
  pointer-events: none;
  display: block;
}

.has-submenu.expanded .chevron-icon {
  transform: rotate(180deg);
}

/* Submenu Styles */
.mobile-submenu {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #f8fafc;
  max-height: 0;
  overflow: hidden;
  display: none;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Show submenu when expanded - JavaScript handles display and animation */
.has-submenu.expanded .mobile-submenu,
.has-submenu.expanded + .mobile-submenu,
.mobile-nav-item.expanded .mobile-submenu {
  /* Animation properties are controlled via JavaScript for optimal performance */
}

.submenu-item {
  border-bottom: 1px solid #e2e8f0;
}

.submenu-item:last-child {
  border-bottom: none;
}

.submenu-item .mobile-nav-link {
  padding: 14px 20px 14px 40px;
  font-size: 15px;
  font-weight: 400;
  color: #475569;
  background: #f8fafc;
}

.submenu-item .mobile-nav-link:hover {
  background: #e2e8f0;
  color: #1a73e8;
}

/* Nested Submenu Indentation */
.submenu-item[data-depth="1"] .mobile-nav-link {
  padding-left: 40px;
}

.submenu-item[data-depth="2"] .mobile-nav-link {
  padding-left: 60px;
}

.submenu-item[data-depth="3"] .mobile-nav-link {
  padding-left: 80px;
}

/* Mobile Nav Actions */
.mobile-nav-actions {
  padding: 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.mobile-nav-cta {
  width: 100%;
  background: linear-gradient(90deg, #1a73e8 60%, #38bdf8 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.2);
}

.mobile-nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.mobile-nav-cta:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.2);
}

.cta-icon {
  flex-shrink: 0;
}

/* Mobile Nav Footer */
.mobile-nav-footer {
  flex: 0 0 auto;
  padding: 16px 20px;
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.nav-footer-text {
  font-size: 12px;
  color: #64748b;
  font-weight: 400;
}

/* Body scroll lock when menu is open */
body.mobile-nav-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Focus management */
.mobile-nav-panel:focus {
  outline: none;
}

.mobile-nav-link:focus,
.submenu-trigger:focus,
.mobile-nav-close:focus,
.mobile-nav-cta:focus {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

/* Animation for smooth accordion */
@keyframes slideDown {
  from {
    max-height: 0;
    opacity: 0;
  }
  to {
    max-height: 1000px;
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    max-height: 1000px;
    opacity: 1;
  }
  to {
    max-height: 0;
    opacity: 0;
  }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .mobile-nav-panel {
    width: 280px;
    max-width: 90vw;
  }
  
  .mobile-nav-link {
    padding: 14px 16px;
    font-size: 15px;
  }
  
  .submenu-trigger {
    padding: 14px 16px;
  }
  
  .submenu-item .mobile-nav-link {
    padding: 12px 16px 12px 32px;
    font-size: 14px;
  }
  
  .mobile-nav-actions {
    padding: 16px;
  }
  
  .mobile-nav-cta {
    padding: 12px 16px;
    font-size: 15px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .mobile-nav-panel {
    border: 2px solid #000;
  }
  
  .mobile-nav-item {
    border-bottom-color: #000;
  }
  
  .mobile-nav-link:focus,
  .submenu-trigger:focus,
  .mobile-nav-close:focus,
  .mobile-nav-cta:focus {
    outline: 3px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .mobile-nav-overlay,
  .mobile-nav-panel,
  .mobile-submenu,
  .chevron-icon,
  .submenu-trigger,
  .mobile-nav-cta {
    transition: none;
  }
}

/* Print styles */
@media print {
  .mobile-nav-overlay,
  .mobile-nav-panel {
    display: none !important;
  }
}