/* 1. Enhanced Dropdown Container (specific targeting to avoid calendar conflicts) */
.dropdown-menu:not(.datepicker) {
  position: absolute;
  z-index: 1000;
  min-width: 200px;
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
  border: none;
  border-radius: 16px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 8px 24px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0.75rem 0;
  margin-top: 0.5rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dropdown-menu:not(.datepicker).show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* 2. Enhanced Dropdown Items (avoid calendar table cells) */
.dropdown-menu .dropdown-item {
  display: block;
  width: 100%;
  clear: both;
  color: #4a5568;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  margin: 0.25rem 0.5rem;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
  background: linear-gradient(135deg, #a3bffa, #c1b3e6); /* Light gradient for hover */
  color: #1d1d1f;
  transform: none;
  box-shadow: 0 4px 12px rgba(163, 191, 250, 0.3);
  font-weight: 600;
  max-width: fit-content;
  align-items: center;
  justify-content: center;
}

.dropdown-menu .dropdown-item.active,
.dropdown-menu .dropdown-item:active {
  background: linear-gradient(135deg, #a3bffa, #c1b3e6); /* Light gradient for active */
  color: #1d1d1f;
  transform: none;
}

.dropdown-menu .dropdown-item.disabled,
.dropdown-menu .dropdown-item:disabled {
  color: #adb5bd;
  background-color: transparent;
  opacity: 0.5;
  transform: none;
}

/* 3. Dropdown Divider Enhancement (specific targeting) */
.dropdown-menu .dropdown-divider {
  height: 0;
  margin: 0.75rem 1rem;
  overflow: hidden;
  border-top: 1px solid rgba(163, 191, 250, 0.15); /* Light version */
  opacity: 0.6;
}

/* 4. Dropdown Header Enhancement (specific targeting) */
.dropdown-menu .dropdown-header {
  display: block;
  padding: 0.75rem 1.5rem 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #a3bffa; /* Light blue color */
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* 5. Responsive Positioning Classes Enhanced */
.dropdown-menu.dropdown-menu-lg-end {
  right: 0;
  left: auto;
}

@media (max-width: 1199px) {
  .dropdown-menu.dropdown-menu-lg-end {
    right: auto;
    left: 0;
  }
}
@media (max-width: 991px) {
  .dropdown-menu:not(.datepicker) {
    min-width: 180px;
    padding: 0.625rem 0;
  }
  .dropdown-menu .dropdown-item {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
  }
}
@media (max-width: 767px) {
  .dropdown-menu:not(.datepicker) {
    min-width: 160px;
    max-width: calc(100vw - 2rem);
    padding: 0.5rem 0;
    border-radius: 12px;
  }
  .dropdown-menu .dropdown-item {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    margin: 0.125rem 0.25rem;
  }
  .dropdown-menu .dropdown-divider {
    margin: 0.5rem 0.75rem;
  }
  .dropdown-menu .dropdown-header {
    padding: 0.625rem 1rem 0.375rem;
    font-size: 0.75rem;
  }
}
@media (max-width: 575px) {
  .dropdown-menu:not(.datepicker) {
    min-width: 140px;
    max-width: calc(100vw - 1rem);
    font-size: 0.85rem;
    width: auto;
    transform-origin: top center;
  }
  .dropdown-menu .dropdown-item {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
  }
  .dropdown-menu .dropdown-header {
    padding: 0.5rem 0.875rem 0.25rem;
    font-size: 0.7rem;
  }
  .dropdown-menu .dropdown-divider {
    margin: 0.375rem 0.5rem;
  }
}

/* 6. Touch Device Optimizations - only for dropdown items */
@media (hover: none) and (pointer: coarse) {
  .dropdown-menu .dropdown-item {
    min-height: 44px;
    padding: 0.75rem 1.25rem;
    transform: none;
  }
  .dropdown-menu .dropdown-item:hover {
    transform: none;
  }
  .dropdown-menu .dropdown-item:active {
    background: linear-gradient(135deg, #a3bffa, #c1b3e6);
    color: #1d1d1f;
    transform: scale(0.98);
  }
}

/* 8. High Contrast Mode Support - specific to dropdown menus */
@media (prefers-contrast: high) {
  .dropdown-menu:not(.datepicker) {
    border: 2px solid currentColor;
    box-shadow: none;
  }
  .dropdown-menu .dropdown-item:hover,
  .dropdown-menu .dropdown-item:focus {
    outline: 2px solid currentColor;
    outline-offset: -2px;
  }
}

/* 9. Reduced Motion Support - specific to dropdown menus */
@media (prefers-reduced-motion: reduce) {
  .dropdown-menu:not(.datepicker) {
    transition: opacity 0.15s ease;
    transform: none;
  }
  .dropdown-menu .dropdown-item {
    transition: background-color 0.15s ease;
    transform: none;
  }
  .dropdown-menu .dropdown-item:hover,
  .dropdown-menu .dropdown-item:focus {
    transform: none;
  }
}

/* 10. RTL Language Support - specific to dropdown menus */
[dir="rtl"] .dropdown-menu.dropdown-menu-lg-end {
  right: auto;
  left: 0;
}
[dir="rtl"] .dropdown-menu .dropdown-item:hover,
[dir="rtl"] .dropdown-menu .dropdown-item:focus {
  transform: translateX(-4px);
}
[dir="rtl"] .dropdown-menu .dropdown-item.active,
[dir="rtl"] .dropdown-menu .dropdown-item:active {
  transform: translateX(-6px);
}

/* 11. Print Styles - specific to dropdown menus */
@media print {
  .dropdown-menu:not(.datepicker) {
    position: static;
    display: block !important;
    opacity: 1;
    transform: none;
    box-shadow: none;
    border: 1px solid #000;
  }
  .dropdown-menu .dropdown-item {
    color: #000 !important;
    background: transparent !important;
  }
}


/* =========================
   Device-specific Media Queries
========================= */

/* 1. Mobile Devices (portrait smartphones, <= 575px) */
@media (max-width: 575px) {
  .dropdown-menu:not(.datepicker) {
    min-width: 140px;
    max-width: calc(100vw - 1rem);
    font-size: 0.85rem;
    width: auto;
    transform-origin: top center;
  }
  .dropdown-menu .dropdown-item {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
  }
  .dropdown-menu .dropdown-header {
    padding: 0.5rem 0.875rem 0.25rem;
    font-size: 0.7rem;
  }
  .dropdown-menu .dropdown-divider {
    margin: 0.375rem 0.5rem;
  }
}

/* 2. Small Tablets / Large Mobile Devices (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
  .dropdown-menu:not(.datepicker) {
    min-width: 160px;
    max-width: calc(100vw - 2rem);
    padding: 0.5rem 0;
    border-radius: 12px;
  }
  .dropdown-menu .dropdown-item {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    margin: 0.125rem 0.25rem;
  }
  .dropdown-menu .dropdown-header {
    padding: 0.625rem 1rem 0.375rem;
    font-size: 0.75rem;
  }
  .dropdown-menu .dropdown-divider {
    margin: 0.5rem 0.75rem;
  }
}

/* 3. Tablets / Medium Devices (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .dropdown-menu:not(.datepicker) {
    min-width: 180px;
    padding: 0.625rem 0;
  }
  .dropdown-menu .dropdown-item {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
  }
}

/* 4. Laptops / Small Desktops (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
  .dropdown-menu:not(.datepicker) {
    min-width: 200px;
    padding: 0.75rem 0;
  }
  .dropdown-menu .dropdown-item {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
  }
}

/* 5. Large Desktops / Wide Screens (>= 1200px) */
@media (min-width: 1200px) {
  .dropdown-menu:not(.datepicker) {
    min-width: 220px;
    padding: 0.75rem 0;
  }
  .dropdown-menu .dropdown-item {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
}
