/* 
 * Navigation Layout Fix for Assyrian Business Directory
 * This CSS addresses specific header/navbar issues
 */

/* ===== HEADER & NAVIGATION FIXES ===== */

/* Create explicit mobile logo element if it doesn't exist */
.navbar .mobile-logo {
  display: none !important;
}

@media (max-width: 991px) {
  /* Add this element to header.php if not present */
  .navbar-collapse .mobile-logo {
    display: flex !important;
    justify-content: center !important;
    margin-bottom: 1rem !important;
  }
}

/* Base header structure */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow);
  background-color: var(--card-bg);
  width: 100%;
  min-height: var(--header-height);
}

/* Force navbar to be a flexbox with proper alignment */
.navbar {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  padding: 0.5rem 0;
  width: 100%;
}

/* Container should be flex with space-between */
.navbar > .container {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100%;
}

/* Logo should be inline with nav */
.navbar-brand {
  display: flex !important;
  align-items: center !important;
  margin-right: 1rem;
  flex-shrink: 0;
}

/* Navigation section */
.navbar-collapse {
  display: flex !important;
  flex-direction: row !important;
  flex-grow: 1;
  align-items: center !important;
}

/* Navigation menu should be horizontal */
.navbar-nav {
  display: flex !important;
  flex-direction: row !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

.navbar-nav .nav-item {
  margin-right: 0.25rem;
}

/* Fix search bar */
.navbar .d-flex[action="search.php"] {
  margin-left: auto !important;
  margin-right: 1rem !important;
  max-width: 200px !important;
  width: auto !important;
  flex: 0 1 auto !important;
}

.navbar .d-flex[action="search.php"] .input-group {
  display: flex !important;
  flex-wrap: nowrap !important;
}

/* User actions area */
.user-actions {
  display: flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  margin-left: 0 !important;
}

/* Login/register buttons */
.login-register-buttons {
  display: flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
}

/* Language selector */
.language-selector {
  margin-left: 0.5rem !important;
  display: flex !important;
  align-items: center !important;
}

/* Theme toggle */
.theme-toggle {
  display: flex !important;
  align-items: center !important;
  position: static !important; /* Changed from relative to static */
  margin-left: 0.5rem !important;
  z-index: 1 !important;
}

/* Mobile menu hamburger button */
.navbar-toggler {
  display: none;
  margin-right: 0.5rem;
}

/* ===== RESPONSIVE BEHAVIOR ===== */

@media (max-width: 991px) {
  /* Show toggler on mobile */
  .navbar-toggler {
    display: block !important;
  }
  
  /* Fix collapsed state */
  .navbar-collapse:not(.show) {
    display: none !important;
  }
  
  /* Theme toggle position fix for mobile */
  .theme-toggle {
    position: absolute !important;
    top: 1rem !important;
    right: 4.5rem !important;
    z-index: 1020 !important;
  }
  
  /* When expanded, make it a column */
  .navbar-collapse.show {
    display: flex !important;
    flex-direction: column !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background-color: var(--card-bg) !important;
    padding: 1rem !important;
    border-radius: 0 0 var(--radius) var(--radius) !important;
    box-shadow: var(--shadow-md) !important;
    z-index: 1000 !important;
    width: 100% !important;
  }
  
  /* Vertical nav in collapsed state */
  .navbar-collapse.show .navbar-nav {
    flex-direction: column !important;
    width: 100% !important;
    margin-bottom: 1rem !important;
  }
  
  .navbar-collapse.show .navbar-nav .nav-item {
    margin-right: 0 !important;
    margin-bottom: 0.5rem !important;
  }
  
  /* Make search full width in collapsed state */
  .navbar-collapse.show .d-flex[action="search.php"] {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0.5rem 0 !important;
  }
  
  /* Center user actions in collapsed state */
  .navbar-collapse.show .user-actions {
    margin: 0.5rem 0 0 !important;
    width: 100% !important;
    justify-content: center !important;
  }
  
  /* Hide logo when viewport is small, but KEEP it visible in mobile nav */
  .navbar > .container > .navbar-brand {
    display: none !important;
  }
  
  /* We're removing the CSS-only approach since it's not working */
  
  /* Force the mobile logo to be visible and properly styled */
  .navbar-collapse.show .mobile-logo {
    display: flex !important;
    justify-content: center !important;
    margin-bottom: 1rem !important;
    width: 100% !important;
  }
  
  .navbar-collapse.show .mobile-logo img {
    height: 42px !important;
  }
}

/* Very small screens additional fixes */
@media (max-width: 576px) {
  /* Make buttons more compact */
  .login-register-buttons .btn {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.75rem !important;
  }
  
  /* Hide text in buttons, show only icons */
  .login-register-buttons .btn .d-none {
    display: none !important;
  }
  
  /* Smaller toggle button */
  .theme-toggle .btn {
    width: 32px !important;
    height: 32px !important;
  }
  
  /* Smaller language selector */
  .language-selector .btn {
    width: 32px !important;
    height: 32px !important;
  }
}

/* RTL Support */
html[dir="rtl"] .navbar-nav .nav-item {
  margin-left: 0.25rem !important;
  margin-right: 0 !important;
}

html[dir="rtl"] .navbar .d-flex[action="search.php"] {
  margin-right: auto !important;
  margin-left: 1rem !important;
}

html[dir="rtl"] .language-selector,
html[dir="rtl"] .theme-toggle {
  margin-right: 0.5rem !important;
  margin-left: 0 !important;
}

/* Fix for mobile navbar transparency and logo visibility */
@media (max-width: 991px) {
  /* Make navbar background solid */
  .site-header {
    background-color: var(--card-bg) !important;
  }
  
  /* Keep navbar-brand visible on mobile */
  .navbar > .container > .navbar-brand {
    display: flex !important; /* Override the display: none */
    margin-right: auto;
  }
  
  /* Position the toggle button correctly */
  .navbar-toggler {
    margin-left: 0.5rem;
    margin-right: 0;
  }
  
  /* Hide the mobile-logo that appears in the expanded menu */
  .navbar-collapse .mobile-logo {
    display: none !important;
  }
  
  /* Ensure theme toggle is visible and positioned correctly */
  .theme-toggle {
    position: static !important;
    margin-left: 0.5rem !important;
  }
}

/* Very small screens (under 380px) */
@media (max-width: 380px) {
  /* Ensure navbar-brand never disappears on small screens */
  .navbar-brand {
    display: flex !important;
    max-width: 60%;
  }
  
  /* Make the logo image responsive */
  .navbar-brand img {
    height: 32px;
    width: auto;
  }
  
  /* Position the toggle button correctly */
  .navbar-toggler {
    margin-left: auto;
  }
}

/* 
 * Complete Navigation Fix for Assyrian Business Directory
 * Fixes ALL mobile navigation issues properly
 */

/* ===== HEADER & NAVIGATION FIXES ===== */

/* Base header structure */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow);
  background-color: var(--card-bg) !important; /* Force background color */
  width: 100%;
  min-height: var(--header-height);
}

/* Force navbar to be a flexbox with proper alignment */
.navbar {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  padding: 0.5rem 0;
  width: 100%;
}

/* Container should be flex with space-between */
.navbar > .container {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100%;
}

/* Logo should be inline with nav */
.navbar-brand {
  display: flex !important;
  align-items: center !important;
  margin-right: 1rem;
  flex-shrink: 0;
}

/* Navigation section */
.navbar-collapse {
  display: flex !important;
  flex-direction: row !important;
  flex-grow: 1;
  align-items: center !important;
}

/* Navigation menu should be horizontal */
.navbar-nav {
  display: flex !important;
  flex-direction: row !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

.navbar-nav .nav-item {
  margin-right: 0.25rem;
}

/* Fix search bar */
.navbar .d-flex[action="search.php"] {
  margin-left: auto !important;
  margin-right: 1rem !important;
  max-width: 200px !important;
  width: auto !important;
  flex: 0 1 auto !important;
}

.navbar .d-flex[action="search.php"] .input-group {
  display: flex !important;
  flex-wrap: nowrap !important;
}

/* User actions area */
.user-actions {
  display: flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  margin-left: 0 !important;
}

/* Login/register buttons */
.login-register-buttons {
  display: flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
}

/* Language selector */
.language-selector {
  margin-left: 0.5rem !important;
  display: flex !important;
  align-items: center !important;
}

/* Theme toggle */
.theme-toggle {
  display: flex !important;
  align-items: center !important;
  position: static !important;
  margin-left: 0.5rem !important;
  z-index: 1 !important;
}

/* Mobile menu hamburger button */
.navbar-toggler {
  display: none;
  margin-right: 0.5rem;
}

/* ===== RESPONSIVE BEHAVIOR ===== */

@media (max-width: 991px) {
  /* Show toggler on mobile */
  .navbar-toggler {
    display: block !important;
  }
  
  /* Fix collapsed state */
  .navbar-collapse:not(.show) {
    display: none !important;
  }
  
  /* COMPLETELY REMOVE the duplicate mobile logo */
  .mobile-logo, 
  .navbar-collapse .mobile-logo,
  .navbar-collapse.show .mobile-logo {
    display: none !important;
  }
  
  /* When expanded, make it a column with SOLID BACKGROUND */
  .navbar-collapse.show {
    display: flex !important;
    flex-direction: column !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background-color: var(--card-bg) !important;
    padding: 1rem !important;
    border-radius: 0 0 var(--radius) var(--radius) !important;
    box-shadow: var(--shadow-md) !important;
    z-index: 1000 !important;
    width: 100% !important;
  }
  
  /* Vertical nav in collapsed state */
  .navbar-collapse.show .navbar-nav {
    flex-direction: column !important;
    width: 100% !important;
    margin-bottom: 1rem !important;
  }
  
  .navbar-collapse.show .navbar-nav .nav-item {
    margin-right: 0 !important;
    margin-bottom: 0.5rem !important;
  }
  
  /* Make search full width in collapsed state */
  .navbar-collapse.show .d-flex[action="search.php"] {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0.5rem 0 !important;
  }
  
  /* Center user actions in collapsed state */
  .navbar-collapse.show .user-actions {
    margin: 0.5rem 0 0 !important;
    width: 100% !important;
    justify-content: center !important;
  }
}

/* Very small screens additional fixes */
@media (max-width: 576px) {
  /* Make buttons more compact */
  .login-register-buttons .btn {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.75rem !important;
  }
  
  /* Hide text in buttons, show only icons */
  .login-register-buttons .btn .d-none {
    display: none !important;
  }
  
  /* Smaller toggle button */
  .theme-toggle .btn {
    width: 32px !important;
    height: 32px !important;
  }
  
  /* Smaller language selector */
  .language-selector .btn {
    width: 32px !important;
    height: 32px !important;
  }
}

/* RTL Support */
html[dir="rtl"] .navbar-nav .nav-item {
  margin-left: 0.25rem !important;
  margin-right: 0 !important;
}

html[dir="rtl"] .navbar .d-flex[action="search.php"] {
  margin-right: auto !important;
  margin-left: 1rem !important;
}

html[dir="rtl"] .language-selector,
html[dir="rtl"] .theme-toggle {
  margin-right: 0.5rem !important;
  margin-left: 0 !important;
}

/* Dark theme - ensure navbar has correct background */
[data-bs-theme="dark"] .site-header {
  background-color: var(--card-bg) !important;
}

[data-bs-theme="dark"] .navbar-collapse.show {
  background-color: var(--card-bg) !important;
}

/* Ensure visibility in both themes */
[data-bs-theme="light"] .site-header,
[data-bs-theme="dark"] .site-header {
  box-shadow: var(--shadow) !important;
}

/* Force opacity on backgrounds for both themes */
[data-bs-theme="light"] .site-header,
[data-bs-theme="light"] .navbar-collapse.show,
[data-bs-theme="dark"] .site-header,
[data-bs-theme="dark"] .navbar-collapse.show {
  opacity: 1 !important;
}

/* 
 * FORCEFUL OVERRIDE FOR MOBILE NAV TRANSPARENCY ISSUE
 * Add this to the end of your style.css file
 */

/* FORCE SOLID BACKGROUNDS */
.navbar-collapse.show {
  background-color: #FFFFFF !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
}

[data-bs-theme="dark"] .navbar-collapse.show {
  background-color: #000000 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
}

/* FOR EXTRA CERTAINTY - ADD !important TO EVERYTHING */
.navbar-collapse.show * {
  opacity: 1 !important;
}

/* REMOVE ALL TRANSPARENCY */
.navbar-collapse.show,
.site-header {
  background-blend-mode: normal !important;
  mix-blend-mode: normal !important;
}

/* REMOVE ANY BACKDROP BLUR EFFECTS */
.navbar-collapse.show::before,
.navbar-collapse.show::after {
  display: none !important;
  content: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: transparent !important;
  opacity: 0 !important;
}

/* ABSOLUTELY POSITION THE COLLAPSED NAVBAR */
.navbar-collapse.show {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
  width: 100% !important;
  padding: 1rem !important;
  border-radius: 0 0 var(--radius) var(--radius) !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3) !important;
}

/* ADD BORDER FOR VISIBILITY */
.navbar-collapse.show {
  border: 1px solid rgba(0, 0, 0, 0.2) !important;
  border-top: 0 !important;
}

[data-bs-theme="dark"] .navbar-collapse.show {
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-top: 0 !important;
}

/* REPLACE ANY VARIABLES WITH HARD-CODED VALUES */
.site-header {
  background-color: #FFFFFF !important;
}

[data-bs-theme="dark"] .site-header {
  background-color: #000000 !important;
}

/* COMPLETELY REMOVE MOBILE LOGO IN DROPDOWN */
.mobile-logo, 
.navbar-collapse .mobile-logo,
.navbar-collapse.show .mobile-logo {
  display: none !important;
}

/* 
 * Fix for invisible hamburger icon in dark mode
 * Add this to the end of your style.css file or fixed-nav.css
 */

/* Make hamburger icon visible in dark mode */
[data-bs-theme="dark"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Make sure the toggle button is visible */
[data-bs-theme="dark"] .navbar-toggler {
  color: rgba(255, 255, 255, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Add hover effect for better usability */
[data-bs-theme="dark"] .navbar-toggler:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

/* Add active state for better usability */
[data-bs-theme="dark"] .navbar-toggler:focus {
  outline: none !important;
  box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25) !important;
}