/**
 * Favorite Entity Select2 Component Styles
 * 
 * Shared styles for both prestataire and adherent favorite select2 components
 * - Provides consistent styling for star icons and dropdown elements
 * - Provides visual feedback for interactions
 * - Maintains consistent styling with Bootstrap theme
 */

/* Container for favorite options */
.favorite-option, .favorite-selection {
  display: flex;
  align-items: center;
  width: 100%;
  font-size: 1.1em;
  line-height: 1.3;
  max-width: calc(100% - 20px); /* Prevent overflow with the dropdown arrow */
  overflow: hidden;
}

/* Text container */
.option-text, .selection-text {
  margin-left: 5px;
  flex: 1;
  font-size: 1.1em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Star icon base styling */
.favorite-entity-star {
  display: inline-block;
  margin-right: 10px;
  cursor: pointer;
  transition: color 0.2s ease-in-out, transform 0.1s ease-in-out;
  font-size: 20px; /* Increased from 16px to match larger text */
  flex-shrink: 0;
  position: relative;
  z-index: 10; /* Higher z-index to ensure it's clickable */
  pointer-events: auto; /* Ensure it receives click events */
}

/* Star icon color for favorites */
.favorite-star {
  color: #ffc107; /* Bootstrap yellow */
}

/* Star icon color for non-favorites */
.non-favorite-star {
  color: #adb5bd; /* Bootstrap gray */
}

/* Fix for select2 container on mobile */
.select2-container--default .select2-selection--single {
  display: flex;
  align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-right: 20px; /* Make room for the dropdown arrow */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 20px);
}

/* Star icon hover effect */
.favorite-entity-star:hover {
  transform: scale(1.2);
}

/* Select2 container styling */
.select2-container--default .select2-selection--single {
  height: auto !important;
  min-height: 42px;
  padding: 8px;
  border: 1px solid #000 !important; /* Black border */
  border-radius: 4px;
  display: flex;
  align-items: center;
}

/* Remove default arrow */
.select2-container--default .select2-selection--single .select2-selection__arrow {
  display: none !important;
}

/* Custom arrow using FontAwesome */
.select2-container--default .select2-selection--single::after {
  content: "\f078"; /* FontAwesome down arrow */
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Dropdown styling */
.select2-container--default .select2-results__option {
  padding: 8px;
  font-size: 1.2em;
  line-height: 1.4;
}

/* Highlighted option */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #007bff; /* Bootstrap primary blue */
}

/* Selected option */
.select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #e9ecef; /* Bootstrap light gray */
  color: #000;
}

/* Clear button (x) positioning */
.select2-container--default .select2-selection--single .select2-selection__clear {
  margin-right: 25px; /* Make room for our custom arrow */
  font-size: 1.2em;
  font-weight: bold;
}

/* Dropdown container */
.select2-dropdown {
  border: 1px solid #000; /* Match the black border */
}

/* Ensure proper spacing in the selection */
.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 0;
  display: flex;
  align-items: center;
  width: 100%;
}

/* Ensure the dropdown is wide enough */
.select2-container {
  width: 100% !important;
}

/* Fix for dropdown positioning */
.select2-container--open .select2-dropdown {
  margin-top: 2px;
}
