/* =====================================================
   Minimal Mobile Menu - Modern & Clean Design
   ===================================================== */

/* By default, hide new mobile menu elements on desktop */
.menu-overlay,
.sidebar-header,
.menu-list,
.menu-footer {
  display: none;
}

/* Overlay for closing menu */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 999;
}

.menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile Menu Styles (Max-width: 800px) */
@media (max-width: 800px) {
  
  /* Nav Links Container */
  nav .navbar .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    background: #ffffff;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
  }

  nav .navbar .nav-links.active {
    right: 0;
  }

  /* Custom Scrollbar */
  nav .navbar .nav-links::-webkit-scrollbar {
    width: 4px;
  }

  nav .navbar .nav-links::-webkit-scrollbar-track {
    background: #f5f5f5;
  }

  nav .navbar .nav-links::-webkit-scrollbar-thumb {
    background: #d1d1d1;
    border-radius: 4px;
  }

  nav .navbar .nav-links::-webkit-scrollbar-thumb:hover {
    background: #b1b1b1;
  }

  /* ================== Header Section ================== */
  .sidebar-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
    min-height: 80px;
  }

  .logo-wrapper {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 60px);
  }

  .logo-wrapper a {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
  }

  .logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
  }

  .logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .logo-text h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .logo-text span {
    font-size: 11px;
    color: #666;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .close-menu {
    background: #f5f5f5;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    flex-shrink: 0;
    margin-left: 12px;
  }

  .close-menu:hover {
    background: #e8e8e8;
    transform: scale(1.05);
  }

  .close-menu:active {
    transform: scale(0.95);
  }

  /* ================== Menu List ================== */
  .menu-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    flex: 1;
  }

  .menu-item {
    border-bottom: 1px solid #f0f0f0;
  }

  .menu-item:last-child {
    border-bottom: none;
  }

  /* Menu Link */
  .menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
  }

  .menu-link:hover {
    background: #f8f9fa;
    color: #d41414;
  }

  .menu-link:active {
    background: #f0f0f0;
  }

  .menu-text {
    flex: 1;
  }

  /* Chevron Icons */
  .chevron-icon {
    color: #999;
    transition: transform 0.3s ease, color 0.2s ease;
    flex-shrink: 0;
  }

  .menu-item.has-submenu.open > .menu-link .chevron-icon {
    transform: rotate(180deg);
    color: #d41414;
  }

  /* ================== Submenu ================== */
  .submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f8f9fa;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .menu-item.has-submenu.open > .submenu {
    max-height: 1000px;
  }

  .submenu-item {
    border-bottom: 1px solid #e8e8e8;
  }

  .submenu-item:last-child {
    border-bottom: none;
  }

  .submenu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 14px 32px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.2s ease;
    cursor: pointer;
  }

  .submenu-link:hover {
    background: #f0f0f0;
    color: #d41414;
    padding-right: 24px;
  }

  .chevron-icon-small {
    color: #999;
    transition: transform 0.3s ease, color 0.2s ease;
    flex-shrink: 0;
  }

  .submenu-item.has-submenu.open > .submenu-link .chevron-icon-small {
    transform: rotate(90deg);
    color: #d41414;
  }

  /* ================== Level 2 Submenu ================== */
  .submenu-level-2 {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #ffffff;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .submenu-item.has-submenu.open > .submenu-level-2 {
    max-height: 500px;
  }

  .submenu-level-2 li {
    border-bottom: 1px solid #f0f0f0;
  }

  .submenu-level-2 li:last-child {
    border-bottom: none;
  }

  .submenu-level-2 a {
    display: block;
    padding: 12px 20px 12px 48px;
    color: #666;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    position: relative;
  }

  .submenu-level-2 a:before {
    content: "•";
    position: absolute;
    right: 36px;
    color: #d41414;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .submenu-level-2 a:hover {
    background: #f8f9fa;
    color: #d41414;
    padding-right: 52px;
  }

  .submenu-level-2 a:hover:before {
    opacity: 1;
  }

  /* ================== Menu Footer ================== */
  .menu-footer {
    margin-top: auto;
    padding: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
  }

  .social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
  }

  .social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #ffffff;
    border-radius: 12px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  .social-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: #d41414;
  }

  .social-icon:active {
    transform: translateY(-1px);
  }

  .contact-info {
    text-align: center;
  }

  .phone-number {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    direction: ltr;
  }

  .copyright {
    font-size: 12px;
    color: #999;
    margin: 0;
  }

  /* ================== Hide Old Mobile Menu Elements ================== */
  .navbar .nav-links .sidebar-logo,
  .navbar .nav-links .links,
  .navbar .nav-links .navsid-bottom {
    display: none;
  }
  
  /* ================== Show New Mobile Menu Elements ================== */
  .menu-overlay {
    display: block;
  }
  
  .sidebar-header {
    display: flex;
  }
  
  .menu-list {
    display: block;
  }
  
  .menu-footer {
    display: block;
  }
}

/* =====================================================
   Desktop: Ensure old menu is visible & reset styles
   ===================================================== */
@media (min-width: 801px) {
  /* Reset nav-links for desktop - NO fixed positioning */
  nav .navbar .nav-links {
    position: static;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
    max-width: none;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    display: flex;
    flex-direction: row;
    transition: none;
  }
  
  /* Make sure desktop menu is visible */
  .navbar .nav-links .sidebar-logo {
    display: none;
  }
  
  .navbar .nav-links .links {
    display: flex;
    flex-direction: row;
  }
  
  .navbar .nav-links .navsid-bottom {
    display: none;
  }
  
  /* Hide mobile menu elements */
  .menu-overlay,
  .sidebar-header,
  .menu-list,
  .menu-footer {
    display: none;
  }
}

/* =====================================================
   Animations & Smooth Transitions
   ===================================================== */
@keyframes slideInRight {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

/* Apply animation when menu opens */
nav .navbar .nav-links.active {
  animation: slideInRight 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-overlay.active {
  animation: fadeIn 0.3s ease;
}

/* =====================================================
   Accessibility & Focus States
   ===================================================== */
.menu-link:focus,
.submenu-link:focus,
.submenu-level-2 a:focus,
.close-menu:focus {
  outline: 2px solid #d41414;
  outline-offset: 2px;
}

/* =====================================================
   Touch Device Optimizations
   ===================================================== */
@media (hover: none) and (pointer: coarse) {
  .menu-link,
  .submenu-link,
  .submenu-level-2 a {
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .close-menu,
  .social-icon {
    width: 48px;
    height: 48px;
  }
}

