/**
 * Country Picker Integration CSS for Global Theme
 * This file provides specific styling for the country picker when integrated into the global theme navigation
 */

/* Navigation integration container */
.country-picker-navigation {
  margin-left: auto;
  display: flex;
  align-items: center;
  padding: 0 15px;
}

/* Navbar-specific country picker styling */
.navbar .country-picker-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.navbar .country-picker-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  min-width: 70px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.navbar .country-picker-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
  text-decoration: none;
}

.navbar .country-picker-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* Flag styling in navbar */
.navbar .country-picker-btn .country-flag {
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Country code styling in navbar */
.navbar .country-picker-btn .country-code {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Chevron icon in navbar */
.navbar .country-picker-btn .fa-chevron-down {
  font-size: 10px;
  margin-left: auto;
  opacity: 0.8;
  transition: transform 0.3s ease;
}

.navbar .country-picker-btn[aria-expanded="true"] .fa-chevron-down {
  transform: rotate(180deg);
}

/* Sticky navbar integration */
.sticky-navbar .country-picker-navigation {
  padding-right: 20px;
}

/* Modal adjustments for global theme */
.global-menu-navigation .country-picker-wrapper #countryPickerModal .modal-content {
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.global-menu-navigation .country-picker-wrapper #countryPickerModal .modal-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid #dee2e6;
  border-radius: 8px 8px 0 0;
}

.global-menu-navigation .country-picker-wrapper #countryPickerModal .modal-title {
  color: #495057;
  font-weight: 600;
}

/* Countries grid adjustments for global theme */
.global-menu-navigation .countries-grid {
  gap: 12px;
  padding: 10px 0;
}

.global-menu-navigation .country-item {
  border-radius: 8px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.global-menu-navigation .country-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border-color: #007bff;
}

.global-menu-navigation .country-link {
  padding: 15px;
  border-radius: 8px;
}

.global-menu-navigation .country-flag-large {
  width: 36px;
  height: 27px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Mobile responsiveness for global theme */
@media (max-width: 768px) {
  .country-picker-navigation {
    position: absolute;
    top: 10px;
    right: 15px;
    padding: 0;
    z-index: 100;
  }
  
  .navbar .country-picker-btn {
    padding: 6px 10px;
    min-width: 60px;
    font-size: 11px;
  }
  
  .navbar .country-picker-btn .country-flag {
    width: 16px;
    height: 12px;
  }
  
  .navbar .country-picker-btn .country-code {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .country-picker-navigation {
    top: 5px;
    right: 10px;
  }
  
  .navbar .country-picker-btn {
    padding: 5px 8px;
    min-width: 50px;
    font-size: 10px;
  }
  
  .navbar .country-picker-btn .country-flag {
    width: 14px;
    height: 10px;
  }
  
  .navbar .country-picker-btn .country-code {
    font-size: 10px;
  }
  
  .navbar .country-picker-btn .fa-chevron-down {
    font-size: 8px;
  }
}

/* Loading state for global theme */
.navbar .country-picker-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.navbar .country-picker-btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Dark mode / night theme support */
.dark-theme .navbar .country-picker-btn,
.night-mode .navbar .country-picker-btn {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.dark-theme .navbar .country-picker-btn:hover,
.night-mode .navbar .country-picker-btn:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Integration with existing global theme styles */
.global-menu-navigation .country-picker-wrapper {
  margin-left: 20px;
}

/* Ensure proper z-index for modals */
.global-menu-navigation #countryPickerModal {
  z-index: 99999 !important;
}

#countryPickerModal {
  z-index: 99999 !important;
}

#countryPickerModal .modal-dialog {
  z-index: 100000 !important;
}

#countryPickerModal .modal-content {
  z-index: 100001 !important;
  position: relative;
}

#countryPickerModal .modal-header {
  z-index: 100002 !important;
}

#countryPickerModal .modal-body {
  z-index: 100002 !important;
}

#countryPickerModal .modal-footer {
  z-index: 100002 !important;
}

/* SUPER AGGRESSIVE MODAL FIXES */
/* Completely override modal backdrop */
.modal-backdrop {
  display: none !important;
}

/* Create our own backdrop */
#countryPickerModal::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999998;
}

/* Force modal to be completely on top */
.modal {
  z-index: 999999 !important;
}

.modal.show {
  z-index: 999999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#countryPickerModal {
  z-index: 9999999 !important;
  background: transparent !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: auto !important;
}

#countryPickerModal.show {
  z-index: 9999999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: auto !important;
}

/* Override any Bootstrap modal styles */
#countryPickerModal.modal.fade {
  z-index: 9999999 !important;
}

#countryPickerModal.modal.fade.show {
  z-index: 9999999 !important;
}

/* Override any conflicting z-index */
body.modal-open {
  overflow: hidden !important;
}

body.modal-open .modal {
  z-index: 999999 !important;
}

/* Make sure modal content is fully interactive */
#countryPickerModal .modal-dialog {
  z-index: 1000000 !important;
  position: relative !important;
  pointer-events: auto !important;
}

#countryPickerModal .modal-content {
  z-index: 1000001 !important;
  position: relative !important;
  pointer-events: auto !important;
  background: white !important;
  border-radius: 8px !important;
}

/* Force all interactive elements to be clickable */
#countryPickerModal .modal-content * {
  pointer-events: auto !important;
}

#countryPickerModal .country-link {
  pointer-events: auto !important;
  cursor: pointer !important;
  display: block !important;
}

/* Ensure country items are clickable */
.country-item {
  z-index: 100003 !important;
  position: relative;
}

.country-link {
  z-index: 100004 !important;
  position: relative;
}

/* Accessibility improvements */
.navbar .country-picker-btn:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* Animation for smooth integration */
.country-picker-navigation {
  animation: fadeInRight 0.5s ease-out;
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Integration with Bootstrap navbar classes */
.navbar-default .country-picker-navigation .country-picker-btn {
  border-color: rgba(255, 255, 255, 0.3);
}

.navbar-inverse .country-picker-navigation .country-picker-btn {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
}

/* Ensure proper positioning in flex layout */
.global-menu-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.global-menu-navigation > * {
  flex-shrink: 0;
}

