/* Fix for property form select dropdowns */

/* Ensure select elements are visible */
.fi-fo-select select[name="type"],
.fi-fo-select select[wire\:model*="type"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Fix for Choices.js dropdown */
.fi-fo-select .choices {
    position: relative !important;
    z-index: 999 !important;
}

.fi-fo-select .choices__list--dropdown {
    position: absolute !important;
    z-index: 1000 !important;
    visibility: hidden !important;
    opacity: 0 !important;
    display: none !important;
    transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out !important;
}

.fi-fo-select .choices__list--dropdown.is-active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force hide dropdown when not active */
.fi-fo-select .choices__list--dropdown:not(.is-active) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Ensure dropdown closes properly */
.fi-fo-select .choices.is-open .choices__list--dropdown {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.fi-fo-select .choices:not(.is-open) .choices__list--dropdown {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Ensure dropdown items are clickable */
.fi-fo-select .choices__item--selectable {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.fi-fo-select .choices__item--selectable:hover {
    background-color: #f3f4f6 !important;
}

/* Fix for modal context */
.fi-modal .fi-fo-select select,
.fi-modal .fi-fo-select .choices {
    z-index: 9999 !important;
}

.fi-modal .fi-fo-select .choices__list--dropdown {
    z-index: 10000 !important;
}

/* Ensure proper styling for Arabic text */
.fi-fo-select select option {
    direction: rtl;
    text-align: right;
}

.fi-fo-select .choices__item {
    direction: rtl;
    text-align: right;
}

/* Fix for property type select specifically */
select[name="type"] {
    background-color: white !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
    color: #111827 !important;
    appearance: auto !important;
    -webkit-appearance: menulist !important;
    -moz-appearance: menulist !important;
    background-image: none !important;
}

select[name="type"]:focus {
    outline: 2px solid transparent !important;
    outline-offset: 2px !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Force native select behavior */
.fi-fo-select select[name="type"] {
    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 8 4 4 4-4'/%3e%3c/svg%3e") !important;
    background-position: right 0.5rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1.5em 1.5em !important;
    padding-right: 2.5rem !important;
}

/* Dark mode support */
.dark .fi-fo-select select[name="type"] {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
    color: #f9fafb !important;
}

.dark .fi-fo-select select[name="type"]:focus {
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1) !important;
}

/* Ensure dropdown is always visible */
.choices__list--dropdown {
    max-height: 200px !important;
    overflow-y: auto !important;
}

/* Fix for form sections */
.fi-fo-section .fi-fo-select select {
    width: 100% !important;
}

/* Animation fix */
.choices__list--dropdown.is-active {
    animation: none !important;
    transition: none !important;
}

/* Force hide Choices.js for native selects */
.fi-fo-select select[name="type"] + .choices {
    display: none !important;
}

.fi-fo-select select[name="type"][data-choice] {
    display: block !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Hide any lingering dropdown elements */
.choices__list--dropdown:not(.is-active),
.choices__list--dropdown.is-active:not(:hover):not(:focus-within) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Responsive fixes */
@media (max-width: 640px) {
    .fi-fo-select .choices__list--dropdown {
        position: fixed !important;
        left: 1rem !important;
        right: 1rem !important;
        max-width: calc(100vw - 2rem) !important;
    }

    select[name="type"] {
        font-size: 1rem !important;
        padding: 0.75rem !important;
    }
}
