/* Select2 Custom Styles for Tickets Page */

/* These selects have options in HTML and are initialized immediately */
#priority_select2:not(.select2-hidden-accessible),
#category_select2:not(.select2-hidden-accessible) {
    opacity: 0 !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
}

#search{
    padding-left: 35px!important;
}
/* Exclude organization selector from these styles */
.select2-container--default:not(.organization-select2):not(#select2-headerOrganizationSelector-container) .select2-selection--single {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    background-color: white;
    position: relative;
}

.select2-container--default:not(.organization-select2):not(#select2-headerOrganizationSelector-container) .select2-selection--single .select2-selection__rendered {
    line-height: 42px;
    color: rgb(55, 65, 81) !important;
    display: block;
    font-size: 0.875rem;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.select2-container--default:not(.organization-select2):not(#select2-headerOrganizationSelector-container) .select2-selection--single .select2-selection__placeholder {
    color: #9ca3af;
    font-weight: 400;
    padding-left: 15px!important;
}

/* Clear button (icône x) - positionné à droite du texte, avant la flèche */
.select2-container--default:not(.organization-select2):not(#select2-headerOrganizationSelector-container) .select2-selection--single .select2-selection__clear {
    color: rgb(156, 163, 175) !important;
    font-size: 1.25rem !important;
    line-height: 1 !important;
    padding-bottom: 0.5rem;
    margin-right: 0 !important;
}

.select2-container--default:not(.organization-select2):not(#select2-headerOrganizationSelector-container) .select2-selection--single .select2-selection__clear:hover {
    color: #6b7280;
}

.select2-container--default:not(.organization-select2):not(#select2-headerOrganizationSelector-container) .select2-selection--single .select2-selection__arrow {
    height: 38px;
    right: 0.75rem;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    position: absolute;
}

.select2-container--default:not(.organization-select2):not(#select2-headerOrganizationSelector-container) .select2-selection--single .select2-selection__arrow b {
    border-color: #9ca3af transparent transparent transparent;
    border-style: solid;
    border-width: 5px 4px 0 4px;
    height: 0;
    width: 0;
    margin-left: -4px;
    margin-top: -2px;
}

/* Note: Hover and focus styles are managed globally in global-fields.css */
/* Dropdown, search field, and results styles are now managed globally in global-fields.css */

/* Note: Z-index is now managed globally in global-fields.css (z-index: 30) */
/* Specific positioning for "Assigné à" select below */

/* Spécifique pour le select "Assigné à" */
#select2-assigned_to_select2-container {
    position: relative;
    z-index: 1;
}

#select2-assigned_to_select2-container.select2-container--open {
    z-index: 30 !important;
}

/* S'assurer que le dropdown est correctement positionné */
#select2-assigned_to_select2-container .select2-dropdown {
    position: absolute !important;
    z-index: 30 !important;
    margin-top: 4px !important;
}

/* Note: General dropdown positioning is managed globally in global-fields.css */
/* Specific positioning rules for "Assigné à" select are kept below */

/* Kanban Sidebar Select2 Styles */
#kanban_category_select,
#kanban_project_select,
#kanban_assigned_select,
#kanban_beneficiaire_select {
    font-size: 0.875rem;
}

/* Kanban Sidebar Select2 Container */
.w-80 .select2-container--default .select2-selection--single {
    height: 38px;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.w-80 .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px;
    font-size: 0.875rem;
}

.w-80 .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px;
}

/* Kanban Sidebar Select2 Dropdown */
.w-80 .select2-dropdown {
    font-size: 0.875rem;
}

/* Dark Mode Support for Kanban Sidebar */
.dark .w-80 .select2-container--default .select2-selection--single {
    background-color: rgb(55, 65, 81);
    border-color: rgb(75, 85, 99);
    color: rgb(229, 231, 235);
}

.dark .w-80 .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: rgb(229, 231, 235);
}

.dark .w-80 .select2-dropdown {
    background-color: rgb(55, 65, 81);
    border-color: rgb(75, 85, 99);
}

.dark .w-80 .select2-results__option {
    color: rgb(229, 231, 235);
}

.dark .w-80 .select2-results__option--highlighted {
    background-color: rgb(75, 85, 99) !important;
    color: rgb(255, 255, 255) !important;
}


/* Filament-style checkbox styling for table checkboxes only */
table input[type="checkbox"]:not(.filter-checkbox) {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 1rem;
    height: 1rem;
    border: 1px solid rgb(209, 213, 219);
    border-radius: 0.25rem;
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease-in-out;
}

table input[type="checkbox"]:not(.filter-checkbox):hover {
    border-color: rgb(156, 163, 175);
}

table input[type="checkbox"]:not(.filter-checkbox):focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.5) !important;
    border-color: rgb(22, 163, 74) !important;
}

table input[type="checkbox"]:not(.filter-checkbox):checked {
    background-color: rgb(22, 163, 74) !important;
    border-color: rgb(22, 163, 74) !important;
}

table input[type="checkbox"]:not(.filter-checkbox):checked::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.375rem;
    height: 0.625rem;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

/* Green vertical line for selected rows (Alpine localSelected only – no :has to avoid bar staying after uncheck) */
tr.row-selected td:first-child {
    position: relative;
}

tr.row-selected td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: rgb(22, 163, 74);
}

/* Dark mode support */
.dark table input[type="checkbox"]:not(.filter-checkbox) {
    border-color: rgb(75, 85, 99);
    background-color: rgb(55, 65, 81);
}

.dark table input[type="checkbox"]:not(.filter-checkbox):hover {
    border-color: rgb(107, 114, 128);
}

.dark table input[type="checkbox"]:not(.filter-checkbox):checked {
    background-color: rgb(22, 163, 74) !important;
    border-color: rgb(22, 163, 74) !important;
}

.dark table input[type="checkbox"]:not(.filter-checkbox):focus {
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.5) !important;
    border-color: rgb(22, 163, 74) !important;
}

.dark tr.row-selected td:first-child {
    position: relative;
}

.dark tr.row-selected td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: rgb(22, 163, 74);
}

/* Force Filament color for search input focus */
/* Note: These styles are now managed globally in global-fields.css with Filament color #16A34A */
/* Keeping this for backward compatibility but global-fields.css takes precedence */
#search:focus {
    border-color: #16A34A !important;
    outline: none !important;
    box-shadow: 0 0 0 1px #16A34A !important;
}

.dark #search:focus {
    border-color: #16A34A !important;
    outline: none !important;
    box-shadow: 0 0 0 1px #16A34A !important;
}

/* Dark mode hover and focus styles are now managed globally in global-fields.css */
