/* Critical Mobile Fixes for Navbar and Popup */

/* Fix for all mobile screens */
@media (max-width: 768px) {
  /* Hide Top Header Bar Contact Info and Social Media Icons on Mobile */
  .bg-gradient-to-r.from-gray-800 {
    display: none !important;
  }

  /* Navbar Critical Fixes */
  nav {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1) !important;
    min-height: 70px !important;
    width: 100% !important;
  }

  /* Adjust announcement banner and navigation positioning */
  .announcement-banner {
    position: relative !important;
    top: 0 !important;
  }

  /* Adjust navigation positioning since top header is hidden */
  nav {
    top: 0 !important;
  }

  /* Adjust hero section padding since top header is hidden */
  #home {
    padding-top: 50px !important;
  }

  .hero-section {
    padding-top: 1rem !important;
  }

  /* Navbar Container Fix */
  nav .max-w-7xl {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Navbar Flex Container Fix */
  nav .flex.items-center.justify-between {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-height: 70px !important;
    padding: 0.5rem 0 !important;
  }

  /* Logo Section Fix */
  nav .flex.items-center.flex-shrink-0 {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    max-width: calc(100% - 60px) !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Logo Container Fix */
  nav .w-10.h-10 {
    width: 2.25rem !important;
    height: 2.25rem !important;
    margin-right: 0.5rem !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Logo Image Fix */
  nav .w-10.h-10 img {
    width: 1.25rem !important;
    height: 1.25rem !important;
    object-fit: contain !important;
  }

  /* Logo Text Fix */
  nav .text-lg,
  nav .text-xl {
    font-size: 1rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Mobile Menu Toggle Fix */
  .mobile-menu-toggle {
    padding: 8px !important;
    border-radius: 8px !important;
    min-height: 44px !important;
    min-width: 44px !important;
    background: rgba(102, 126, 234, 0.05) !important;
    border: 1px solid rgba(102, 126, 234, 0.1) !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 101 !important;
    position: relative !important;
  }

  .mobile-menu-toggle svg {
    width: 1.5rem !important;
    height: 1.5rem !important;
    color: #374151 !important;
  }

  /* Join Us Button Mobile Optimization */
  button[onclick="scrollToContact()"] {
    min-height: 48px !important;
    padding: 12px 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    border: none !important;
    outline: none !important;
  }

  button[onclick="scrollToContact()"]:active {
    transform: scale(0.98) !important;
  }

  button[onclick="scrollToContact()"]:focus {
    outline: 2px solid rgba(102, 126, 234, 0.5) !important;
    outline-offset: 2px !important;
  }

  /* Login Button Mobile Optimization */
  a[href="/asz/login2.php"] {
    min-height: 48px !important;
    padding: 12px 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    outline: none !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  a[href="/asz/login2.php"]:active {
    transform: scale(0.98) !important;
  }

  a[href="/asz/login2.php"]:focus {
    outline: 2px solid rgba(102, 126, 234, 0.5) !important;
    outline-offset: 2px !important;
  }

  /* Mobile Dropdown Styles */
  .mobile-dropdown {
    position: relative !important;
  }

  .mobile-dropdown-toggle {
    width: 100% !important;
    text-align: left !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .mobile-dropdown-arrow {
    transition: transform 0.2s ease !important;
  }

  .mobile-dropdown.active .mobile-dropdown-arrow {
    transform: rotate(180deg) !important;
  }

  .mobile-dropdown-content {
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    max-height: 0 !important;
    opacity: 0 !important;
  }

  .mobile-dropdown.active .mobile-dropdown-content {
    max-height: 300px !important;
    opacity: 1 !important;
  }

  .mobile-dropdown-content.show {
    display: block !important;
    max-height: 300px !important;
    opacity: 1 !important;
  }

  /* Action Buttons Container */
  .mobile-menu .space-y-3 > button,
  .mobile-menu .space-y-3 > a {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Ensure buttons are always visible on mobile */
  .mobile-menu {
    max-height: 80vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Fixed Action Buttons at Bottom of Mobile Menu */
  .mobile-menu .space-y-3 {
    position: sticky !important;
    bottom: 0 !important;
    background: white !important;
    padding: 16px !important;
    margin: 0 -16px -24px -16px !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
  }

  /* Login Link Enhancement */
  a[href="/asz/login2.php"] {
    position: relative !important;
    overflow: hidden !important;
  }

  a[href="/asz/login2.php"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
  }

  a[href="/asz/login2.php"]:hover::before {
    left: 100%;
  }

  /* Popup Overlay Fix */
  .popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 10000 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }

  /* Popup Content Fix */
  .popup-content {
    position: relative !important;
    z-index: 10001 !important;
    background: white !important;
    border-radius: 20px !important;
    max-width: 90vw !important;
    max-height: 90vh !important;
    width: 500px !important;
    margin: auto !important;
    overflow: hidden !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3) !important;
  }

  /* Popup Close Button Critical Fix */
  .popup-close {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    width: 40px !important;
    height: 40px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 2px solid rgba(102, 126, 234, 0.2) !important;
    border-radius: 50% !important;
    color: #374151 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 10002 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.3s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    -webkit-user-select: none !important;
  }

  .popup-close:hover,
  .popup-close:active,
  .popup-close:focus {
    background: rgba(255, 255, 255, 1) !important;
    transform: scale(1.1) !important;
    border-color: rgba(102, 126, 234, 0.4) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2) !important;
  }
}

/* Extra fixes for small screens (480px and below) */
@media (max-width: 480px) {
  /* Ensure action buttons remain visible */
  .mobile-menu .space-y-3 {
    padding: 12px !important;
    margin: 0 -12px -20px -12px !important;
  }

  .mobile-menu .space-y-3 > button,
  .mobile-menu .space-y-3 > a {
    min-height: 44px !important;
    font-size: 15px !important;
    padding: 12px 20px !important;
  }


  /* Navbar Small Screen Fix */
  nav {
    min-height: 65px !important;
  }

  nav .flex.items-center.justify-between {
    min-height: 65px !important;
    padding: 0.25rem 0 !important;
  }

  nav .max-w-7xl {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* Logo Small Screen Fix */
  nav .w-10.h-10 {
    width: 2rem !important;
    height: 2rem !important;
    margin-right: 0.375rem !important;
  }

  nav .w-10.h-10 img {
    width: 1.125rem !important;
    height: 1.125rem !important;
  }

  nav .text-lg,
  nav .text-xl {
    font-size: 0.95rem !important;
  }

  /* Mobile Menu Toggle Small Screen Fix */
  .mobile-menu-toggle {
    padding: 6px !important;
    min-height: 40px !important;
    min-width: 40px !important;
  }

  .mobile-menu-toggle svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
  }

  /* Popup Small Screen Fix */
  .popup-content {
    width: 95vw !important;
    max-width: 420px !important;
    max-height: 85vh !important;
    border-radius: 16px !important;
  }

  .popup-close {
    width: 38px !important;
    height: 38px !important;
    font-size: 20px !important;
    top: 8px !important;
    right: 8px !important;
  }
}

/* Extra fixes for very small screens (360px and below) */
@media (max-width: 360px) {
  /* Action buttons very small screen */
  .mobile-menu .space-y-3 {
    padding: 10px !important;
    margin: 0 -10px -16px -10px !important;
  }

  .mobile-menu .space-y-3 > button,
  .mobile-menu .space-y-3 > a {
    min-height: 42px !important;
    font-size: 14px !important;
    padding: 10px 16px !important;
  }


  /* Navbar Very Small Screen Fix */
  nav {
    min-height: 60px !important;
  }

  nav .flex.items-center.justify-between {
    min-height: 60px !important;
  }

  nav .max-w-7xl {
    padding-left: 0.375rem !important;
    padding-right: 0.375rem !important;
  }

  /* Logo Very Small Screen Fix */
  nav .w-10.h-10 {
    width: 1.75rem !important;
    height: 1.75rem !important;
    margin-right: 0.25rem !important;
  }

  nav .w-10.h-10 img {
    width: 1rem !important;
    height: 1rem !important;
  }

  nav .text-lg,
  nav .text-xl {
    font-size: 0.875rem !important;
  }

  /* Mobile Menu Toggle Very Small Screen Fix */
  .mobile-menu-toggle {
    padding: 4px !important;
    min-height: 36px !important;
    min-width: 36px !important;
  }

  .mobile-menu-toggle svg {
    width: 1.125rem !important;
    height: 1.125rem !important;
  }

  /* Popup Very Small Screen Fix */
  .popup-content {
    width: 98vw !important;
    max-height: 92vh !important;
    border-radius: 12px !important;
  }

  .popup-close {
    width: 36px !important;
    height: 36px !important;
    font-size: 18px !important;
    top: 6px !important;
    right: 6px !important;
  }
}

/* Touch device specific fixes */
@media (hover: none) and (pointer: coarse) {
  .popup-close {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  .mobile-menu-toggle {
    min-height: 44px !important;
    min-width: 44px !important;
  }
}
