/* ============================================
   NAVIGATION RESPONSIVE OPTIMIZATIONS
   ============================================ */

.navbar {
  padding: 0.75rem 1rem;
  min-height: 60px;
  position: relative;
  background-color: var(--navbar-bg, #0a0e27);
  border-bottom: 1px solid var(--navbar-border, transparent);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Light mode navbar adjustments */
[data-theme="light"] .navbar {
  background-color: var(--navbar-bg) !important;
}

[data-theme="light"] .navbar .nav-link {
  color: var(--text-primary, #1e293b) !important;
}

[data-theme="light"] .navbar .nav-link:hover {
  color: var(--accent-primary) !important;
}

[data-theme="light"] .navbar-brand {
  color: var(--text-primary, #1e293b) !important;
}

/* ============================================
   iOS Safe Area Support for Navigation
   ============================================ */
@supports (padding-top: env(safe-area-inset-top)) {
  .webview-mode .navbar {
    /* Extend navbar background into safe area */
    padding-top: calc(env(safe-area-inset-top, 0px) + 0.75rem);
    /* Ensure proper left/right padding on devices with rounded corners */
    padding-left: calc(env(safe-area-inset-left, 0px) + 1rem);
    padding-right: calc(env(safe-area-inset-right, 0px) + 1rem);
  }
  
  /* Sticky navbar should account for safe area */
  .webview-mode .navbar.sticky-top,
  .webview-mode .navbar[style*="sticky"] {
    top: 0;
  }
}

/* ============================================
   Webview Back Button
   ============================================ */
.webview-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  margin-right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  z-index: 10000;
}

/* Fixed back button in webview mode (top left, small, sticky) */
/* Positioned below the notch using safe-area-inset-top */
/* z-index lower than chatbot widget so chatbot is always on top */
.webview-back-btn-fixed {
  position: fixed !important;
  top: calc(env(safe-area-inset-top, 0px) + 0.5rem) !important;
  left: calc(env(safe-area-inset-left, 0px) + 0.5rem) !important;
  margin: 0 !important;
  z-index: 9999 !important;
  background: rgba(10, 14, 39, 0.95) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  font-size: 0.7rem !important;
}

/* Mobile adjustments for fixed back button - iPhone with notch */
@media (max-width: 575px) {
  .webview-back-btn-fixed {
    /* Position below notch: safe-area-inset-top (44-47px on iPhone) + small margin */
    top: calc(env(safe-area-inset-top, 0px) + 0.4rem) !important;
    left: calc(env(safe-area-inset-left, 0px) + 0.4rem) !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    font-size: 0.65rem !important;
  }
  
  /* Ensure button is visible on devices with notch */
  @supports (padding-top: env(safe-area-inset-top)) {
    .webview-back-btn-fixed {
      top: calc(env(safe-area-inset-top, 0px) + 0.4rem) !important;
    }
  }
}

/* Tablet adjustments - iPad with notch */
@media (min-width: 576px) and (max-width: 1024px) {
  .webview-back-btn-fixed {
    /* On iPad Pro with notch, safe-area-inset-top is typically 20-24px */
    top: calc(env(safe-area-inset-top, 0px) + 0.5rem) !important;
    left: calc(env(safe-area-inset-left, 0px) + 0.5rem) !important;
  }
  
  @supports (padding-top: env(safe-area-inset-top)) {
    .webview-back-btn-fixed {
      top: calc(env(safe-area-inset-top, 0px) + 0.5rem) !important;
    }
  }
}

/* Hide navbar completely in webview mode */
.webview-mode .navbar {
  display: none !important;
}

.webview-back-btn:hover,
.webview-back-btn:focus {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  outline: none;
}

.webview-back-btn:active {
  background: rgba(0, 212, 170, 0.3);
  transform: scale(0.95);
}

.webview-back-btn i {
  line-height: 1;
}

/* Mobile adjustments for back button */
@media (max-width: 575px) {
  .webview-back-btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    font-size: 0.65rem;
    margin-right: 0.2rem;
    margin-left: -0.35rem; /* Réduire encore plus la marge left */
  }
  
  /* Réduire le padding du container en mode webview sur mobile */
  .webview-mode .navbar .container {
    padding-left: 0.25rem !important;
  }
}

/* Sticky navbar for mobile and tablet */
@media (max-width: 1279px) {
  .navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

/* Hide elements on mobile/tablet */
.hide-mobile-tablet {
  display: block;
}

@media (max-width: 1279px) {
  .hide-mobile-tablet {
    display: none !important;
  }
}

.navbar-brand {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.navbar-logo {
  height: 38px;
  width: auto;
  transform: scale(1.8);
  transform-origin: left center;
  margin-right: 12px!important; /* Compense l'augmentation pour ne pas prendre plus de place */
}

.navbar-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  touch-action: manipulation;
}

.nav-link.btn-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
}

.nav-link.btn-link:hover {
  color: rgba(255, 255, 255, 1);
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ff6b6b;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* ============================================
   MOBILE (< 576px)
   ============================================ */
@media (max-width: 575px) {
  .navbar {
    padding: 0.5rem 0.5rem;
    min-height: 48px;
  }
  
  .navbar-brand {
    font-size: 0.75rem;
    gap: 0.25rem;
    max-width: 60%;
    flex-shrink: 1;
  }
  
  .navbar-logo {
    height: 24px;
    transform: scale(1.2);
    margin-right: 6px !important;
  }
  
  .navbar-nav {
    flex-wrap: nowrap;
    gap: 0.25rem;
    justify-content: flex-end;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }
  
  .navbar-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  
  .nav-link {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    min-height: 36px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .notification-badge {
    width: 14px;
    height: 14px;
    font-size: 0.6rem;
    top: -1px;
    right: -1px;
  }
}

/* ============================================
   VERY SMALL SCREENS (< 460px)
   ============================================ */
@media (max-width: 460px) {
  .navbar-brand {
    display: none !important;
  }
}

/* ============================================
   TABLET PORTRAIT (576px - 767px)
   ============================================ */
@media (min-width: 576px) and (max-width: 767px) {
  .navbar {
    padding: 0.5rem 0.75rem;
    min-height: 52px;
  }
  
  .navbar-nav {
    flex-wrap: nowrap;
    gap: 0.5rem;
    justify-content: flex-end;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-link {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    min-height: 40px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ============================================
   TABLET LANDSCAPE (768px - 1023px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1279px) {
  .navbar {
    padding: 0.5rem 1rem;
    min-height: 52px;
  }
  
  .navbar-nav {
    flex-wrap: nowrap;
    gap: 0.75rem;
    justify-content: flex-end;
  }
  
  .nav-link {
    padding: 0.45rem 0.875rem;
    font-size: 0.875rem;
    min-height: 40px;
    white-space: nowrap;
  }
}

/* ============================================
   DESKTOP (>= 1024px)
   ============================================ */
@media (min-width: 1280px) {
  .navbar {
    padding: 1rem 1.5rem;
    min-height: 70px;
  }
  
  .navbar-brand {
    font-size: 1.5rem;
  }
  
  .navbar-logo {
    height: 36px;
  }
  
  .navbar-nav {
    gap: 1rem;
  }
  
  .nav-link {
    padding: 0.5rem 1.25rem;
    font-size: 0.95rem;
    min-height: 44px;
  }
}

/* ============================================
   NAVBAR TOGGLE (Mobile Menu)
   ============================================ */

/* If using Bootstrap collapse for mobile menu */
.navbar-toggler {
  border: none;
  padding: 0.5rem;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar-toggler:focus {
  box-shadow: none;
  outline: 2px solid rgba(0, 212, 170, 0.5);
  outline-offset: 2px;
}

.navbar-collapse {
  margin-top: 1rem;
}

@media (min-width: 992px) {
  .navbar-collapse {
    margin-top: 0;
  }
}

/* ============================================
   LANGUAGE SWITCHER RESPONSIVE
   ============================================ */

.language-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 575px) {
  .language-switcher {
    gap: 0.25rem;
  }
  
  .language-switcher .dropdown-toggle {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    min-height: 40px;
  }
}

/* ============================================
   FOOTER RESPONSIVE
   ============================================ */

.footer {
  padding: 2rem 1rem;
  text-align: center;
}

@media (max-width: 575px) {
  .footer {
    padding: 1.5rem 0.75rem;
    font-size: 0.85rem;
  }
}

@media (min-width: 768px) {
  .footer {
    padding: 2.5rem 1.5rem;
  }
}

@media (min-width: 1280px) {
  .footer {
    padding: 3rem 2rem;
  }
}

