/* Custom select styling for cross-browser consistency */
.custom-select {
  /* Remove all native styling */
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  
  /* Custom arrow */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.5rem center !important;
  background-size: 1.5em 1.5em !important;
  padding-right: 2.5rem !important;
  
  /* Ensure consistent rendering */
  border-radius: 0.375rem !important;
  outline: none;
  cursor: pointer;
  
  /* Safari-specific fixes */
  -webkit-border-radius: 0.375rem !important;
  -webkit-padding-end: 2.5rem !important;
  -webkit-padding-start: 0.75rem !important;
  /* Remove forced background color to allow proper theming */
}

/* Remove Safari's native dropdown arrow */
.custom-select::-webkit-calendar-picker-indicator {
  display: none !important;
  -webkit-appearance: none !important;
}

/* Additional Safari arrow removal */
.custom-select::-webkit-inner-spin-button,
.custom-select::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  margin: 0;
}

.dark .custom-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
}

/* Focus styles */
.custom-select:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
  border-color: #3b82f6;
}

/* Hover styles */
.custom-select:hover:not(:disabled) {
  border-color: #9ca3af;
}

/* Disabled styles */
.custom-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Safari-specific overrides */
@supports (-webkit-appearance: none) {
  .custom-select {
    /* Force removal of native arrow in Safari */
    background-origin: content-box !important;
    text-indent: 0.01px;
    text-overflow: '';
  }
  
  /* Fix option styling in Safari */
  .custom-select option {
    background-color: white;
    color: black;
  }
  
  .dark .custom-select option {
    background-color: #1f2937;
    color: white;
  }
}

/* Additional Safari fix for newer versions */
@media screen and (-webkit-min-device-pixel-ratio:0) {
  select.custom-select {
    -webkit-appearance: none !important;
    background-position: right 0.5rem center !important;
  }
}

/* Fix for Safari on iOS */
@supports (-webkit-touch-callout: none) {
  .custom-select {
    -webkit-appearance: none !important;
  }
}