/* Vessel Database page specific styles (Bootstrap 5) */

/* Hero Section Styling - Match Homepage */
.hero-section {
    background: linear-gradient(135deg, #f8fdff 0%, #e8f8fb 50%, #f0fafb 100%);
    padding: 4rem 0 3rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(32, 201, 151, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(32, 201, 151, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: #6c757d;
    font-weight: 400;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 0 2rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
}

/* Enhanced Filter Panel Styling */
#filterPanel {
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border: 1px solid rgba(32, 201, 151, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    border-radius: 12px !important;
    transition: all 0.3s ease;
}

#filterPanel:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12) !important;
    /* Removed annoying floating effect */
}

#filterPanel .card-body {
    padding: 1.5rem !important;
}

/* Filter Labels */
#filterPanel .form-label {
    color: #495057 !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    margin-bottom: 0.5rem !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Enhanced Select Wrapper */
.select-wrapper {
    position: relative;
    /* Remove transition that might cause jumping */
    transition: none !important;
}

/* Removed annoying floating hover effect on select wrappers */

/* Completely hide original select when Select2 is active */
.select-wrapper .form-select[data-enhanced="true"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    z-index: -1 !important;
}

/* REMOVED: Duplicate rule - already covered above */

/* Ensure Select2 elements can receive clicks */
.select-wrapper .select2-container,
.select-wrapper .select2-container *,
.select2-dropdown,
.select2-dropdown * {
    pointer-events: auto !important;
}

/* Force hide any pseudo-elements from original selects */
.select-wrapper .form-select[data-enhanced="true"]::before,
.select-wrapper .form-select[data-enhanced="true"]::after {
    display: none !important;
    content: none !important;
}

/* Original select styling (for non-enhanced dropdowns) */
.select-wrapper .form-select:not([data-enhanced="true"]) {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding-left: 2.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.select-wrapper .form-select:not([data-enhanced="true"]):focus {
    border-color: var(--vp-teal);
    box-shadow: 0 0 0 0.2rem rgba(32, 201, 151, 0.15);
    background: #ffffff;
}

/* Select icon positioning */
.select-wrapper .select-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 0.875rem;
    z-index: 2;
    transition: color 0.2s ease;
    pointer-events: none;
}

/* Completely hide select icon when Select2 is active */
.select-wrapper:has(.form-select[data-enhanced="true"]) .select-icon {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.select-wrapper:hover .select-icon {
    color: var(--vp-teal);
}

/* Enhanced Filter Highlight */
.select-wrapper.has-filter .form-select {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-color: var(--vp-teal);
    box-shadow: 0 2px 8px rgba(32, 201, 151, 0.15);
}

.select-wrapper.has-filter .select-icon {
    color: var(--vp-teal);
}

/* Mobile Filter Button Enhancement */
.d-md-none .btn-vp-teal {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(32, 201, 151, 0.25);
    transition: all 0.2s ease;
}

.d-md-none .btn-vp-teal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(32, 201, 151, 0.35);
}

/* Enhanced Results Control Bar */
#results-controls {
    display: block !important; /* Always show the control bar */
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%) !important;
    border: 1px solid rgba(32, 201, 151, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    border-radius: 12px !important;
    transition: all 0.3s ease;
}

#results-controls:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12) !important;
}

#results-controls .card-body {
    padding: 1.5rem !important;
}

#results-controls .input-group {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#results-controls .form-control {
    border: 2px solid #e9ecef;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

#results-controls .form-control:focus {
    border-color: var(--vp-teal);
    box-shadow: 0 0 0 0.2rem rgba(32, 201, 151, 0.15);
}

#results-controls .btn-vp-teal {
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

#results-controls .btn-vp-teal:hover {
    transform: scale(1.02);
}

/* Enhanced Vessel Cards */
.vessel-item {
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border: 1px solid rgba(32, 201, 151, 0.1) !important;
    border-radius: 12px !important;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

/* DISABLED: Vessel item hover transform that interferes with Select2 dropdowns */
.vessel-item:hover {
    /* transform: translateY(-4px); */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    border-color: rgba(32, 201, 151, 0.2) !important;
}

.vessel-item .card-body {
    padding: 1.25rem;
}

.vessel-item .card-title {
    font-weight: 700;
    color: #212529;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.vessel-item .card-text {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Enhanced Badges */
.vessel-item .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vessel-item .badge.bg-vp-teal {
    background: linear-gradient(135deg, var(--vp-teal) 0%, #1ba085 100%) !important;
    box-shadow: 0 2px 8px rgba(32, 201, 151, 0.3);
}

.vessel-item .badge.bg-vp-navy {
    background: linear-gradient(135deg, var(--vp-navy) 0%, #1a365d 100%) !important;
    box-shadow: 0 2px 8px rgba(45, 55, 72, 0.3);
}

/* Enhanced Results Count Badge */
.results-count-badge {
    background: linear-gradient(135deg, var(--vp-teal) 0%, #1ba085 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(32, 201, 151, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.results-count-badge::before {
    content: '\f1b2';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.8rem;
}

/* Sort and View Controls Enhancement */
.sort-wrapper select,
.view-toggle .btn {
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sort-wrapper select:focus {
    border-color: var(--vp-teal);
    box-shadow: 0 0 0 0.2rem rgba(32, 201, 151, 0.15);
}

.view-toggle .btn {
    border: 2px solid #e9ecef;
    color: #6c757d;
}

.view-toggle .btn.active {
    background: linear-gradient(135deg, var(--vp-teal) 0%, #1ba085 100%);
    border-color: var(--vp-teal);
    color: white;
    box-shadow: 0 2px 8px rgba(32, 201, 151, 0.3);
}

/* DISABLED: Button hover transform that interferes with Select2 dropdowns */
.view-toggle .btn:hover:not(.active) {
    border-color: var(--vp-teal);
    color: var(--vp-teal);
    /* transform: translateY(-1px); */
}

/* Mobile Responsiveness Enhancements */
@media (max-width: 768px) {
    /* Enhanced mobile filter panel */
    #filterPanel .card-body {
        padding: 1rem !important;
    }
    
    #filterPanel .row.g-2 {
        gap: 1rem !important;
    }
    
    /* Mobile vessel cards */
    .vessel-item {
        margin-bottom: 1rem;
        border-radius: 10px !important;
    }
    
    .vessel-item .card-body {
        padding: 1rem;
    }
    
    .vessel-item .card-title {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    /* Mobile results control bar */
    #results-controls .card-body {
        padding: 1rem !important;
    }
    
    #results-controls .row.g-3 {
        gap: 0.75rem !important;
    }
    
    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
    
    /* Enhanced mobile search input */
    #results-controls .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
    }
    
    /* Mobile badge adjustments */
    .results-count-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* Mobile select dropdowns */
    .select-wrapper .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem 0.875rem 2.5rem;
    }
}

/* Loading States and Micro-interactions */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(32, 201, 151, 0.3);
    border-radius: 50%;
    border-top-color: var(--vp-teal);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Enhanced focus states for accessibility */
.form-control:focus,
.form-select:focus,
.btn:focus {
    outline: 2px solid var(--vp-teal);
    outline-offset: 2px;
}

/* REMOVED: Global transitions that cause jumping with Select2 */

/* Select2 Custom Styling to Match VesselPages Theme */
.select2-container .select2-selection--single {
    background: #ffffff !important;
    border: 2px solid #e9ecef !important;
    border-radius: 8px !important;
    height: calc(1.5em + 0.75rem + 4px) !important;
    padding: 0.375rem 2.5rem 0.375rem 2.5rem !important;
    font-size: 0.875rem !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
    position: relative !important;
    /* Prevent jumping by maintaining consistent dimensions */
    min-height: calc(1.5em + 0.75rem + 4px) !important;
    box-sizing: border-box !important;
    /* Ensure content stays within container boundaries */
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container .select2-selection--single:focus,
.select2-container.select2-container--focus .select2-selection--single,
.select2-container.select2-container--open .select2-selection--single {
    border-color: var(--vp-teal) !important;
    box-shadow: 0 0 0 0.2rem rgba(32, 201, 151, 0.15) !important;
    outline: none !important;
    /* Maintain exact same dimensions to prevent jumping */
    height: calc(1.5em + 0.75rem + 4px) !important;
    padding: 0.375rem 2.5rem 0.375rem 2.5rem !important;
    /* Ensure content stays contained in all states */
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container .select2-selection__rendered {
    color: #495057 !important;
    line-height: 1.5 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    /* Aggressive text containment to prevent overflow */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: calc(100% - 3rem) !important; /* Account for arrow space */
    width: calc(100% - 3rem) !important;
    display: inline-block !important;
    vertical-align: middle !important;
    position: relative !important;
    z-index: 1 !important;
}

.select2-container .select2-selection__placeholder {
    color: #6c757d !important;
    /* Ensure placeholder also respects container boundaries */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: calc(100% - 3rem) !important;
    width: calc(100% - 3rem) !important;
}

/* Custom Select2 Arrow Styling */
.select2-container .select2-selection__arrow {
    height: 100% !important;
    right: 0.75rem !important;
    top: 0 !important;
    width: 20px !important;
}

.select2-container .select2-selection__arrow b {
    border-color: #6c757d transparent transparent transparent !important;
    border-style: solid !important;
    border-width: 5px 4px 0 4px !important;
    height: 0 !important;
    left: 50% !important;
    margin-left: -4px !important;
    margin-top: -2px !important;
    position: absolute !important;
    top: 50% !important;
    width: 0 !important;
}

.select2-container.select2-container--open .select2-selection__arrow b {
    border-color: transparent transparent #6c757d transparent !important;
    border-width: 0 4px 5px 4px !important;
}

/* Add FontAwesome icon to Select2 dropdowns */
.select-wrapper .select2-container::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: #6c757d;
    font-size: 0.875rem;
    z-index: 10;
    pointer-events: none;
}

/* Specific icons for each filter type */
.select-wrapper:has([data-filter-type="owners"]) .select2-container::before {
    content: '\f1ad'; /* fa-building */
}

.select-wrapper:has([data-filter-type="operators"]) .select2-container::before {
    content: '\f13d'; /* fa-anchor */
}

.select-wrapper:has([data-filter-type="managers"]) .select2-container::before {
    content: '\f0c0'; /* fa-users */
}

.select-wrapper:has([data-filter-type="vessel_types"]) .select2-container::before {
    content: '\f21a'; /* fa-ship */
}

.select-wrapper:has([data-filter-type="size_categories"]) .select2-container::before {
    content: '\f545'; /* fa-ruler-combined */
}

.select-wrapper:has([data-filter-type="flag_states"]) .select2-container::before {
    content: '\f024'; /* fa-flag */
}

.select-wrapper:has([data-filter-type="trading_statuses"]) .select2-container::before {
    content: '\f201'; /* fa-chart-line */
}

/* REMOVED: Duplicate Select2 dropdown styling that conflicts with main definitions */

/* Prevent filter panel from expanding when dropdowns open */
#filterPanel {
    overflow: visible !important;
    position: relative !important;
    z-index: 1 !important;
}

.select-wrapper {
    overflow: visible !important;
    position: relative !important;
}

/* REMOVED: Excessive z-index rules that cause layering conflicts */

/* REMOVED: Overly aggressive overflow rules that can break layout */

/* Polished search field styling */
.select2-container .select2-dropdown .select2-search__field {
    border: 2px solid #e9ecef !important;
    border-radius: 8px !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
    margin: 0.75rem !important;
    width: calc(100% - 1.5rem) !important;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%) !important;
    transition: all 0.2s ease !important;
}

.select2-container .select2-dropdown .select2-search__field:focus {
    border-color: var(--vp-teal) !important;
    box-shadow: 0 0 0 0.2rem rgba(32, 201, 151, 0.15), 0 2px 8px rgba(32, 201, 151, 0.1) !important;
    outline: none !important;
    background: #ffffff !important;
}

.select2-container .select2-dropdown .select2-search__field::placeholder {
    color: #6c757d !important;
    font-style: italic !important;
}

/* Polished dropdown option styling */
.select2-container .select2-results__option {
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
    color: #495057 !important;
    transition: all 0.2s ease !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    cursor: pointer !important;
}

.select2-container .select2-results__option:last-child {
    border-bottom: none !important;
}

.select2-container .select2-results__option--highlighted {
    background: linear-gradient(135deg, rgba(32, 201, 151, 0.1) 0%, rgba(32, 201, 151, 0.05) 100%) !important;
    color: var(--vp-teal) !important;
    font-weight: 500 !important;
}

.select2-container .select2-results__option--selected {
    background: linear-gradient(135deg, var(--vp-teal) 0%, #1ba085 100%) !important;
    color: white !important;
    font-weight: 600 !important;
}

.select2-container .select2-results__option[aria-selected="true"] {
    background: linear-gradient(135deg, var(--vp-teal) 0%, #1ba085 100%) !important;
    color: white !important;
    font-weight: 600 !important;
}

/* Enhanced Select2 styling for filter wrappers */
.select-wrapper .select2-container {
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
    /* Remove any transitions that might cause jumping */
    transition: none !important;
}

/* Polished dropdown styling with seamless connection */
.select2-dropdown {
    background: #ffffff !important;
    border: 2px solid var(--vp-teal, #20c997) !important;
    border-top: none !important;
    border-radius: 0 0 8px 8px !important;
    box-shadow: 0 8px 25px rgba(32, 201, 151, 0.15) !important;
    margin-top: -2px !important; /* Perfect visual connection */
    z-index: 9999 !important;
    /* Enhanced visual polish */
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

/* Simplified Select2 positioning - let Select2 handle it naturally */
.select2-container--open .select2-dropdown {
    /* Let Select2 position the dropdown naturally */
    margin-top: -1px !important; /* Connect visually to selection box */
}

/* CRITICAL: Prevent ALL page-wide CSS from interfering with Select2 dropdowns */
.select2-container,
.select2-container *,
.select2-dropdown,
.select2-dropdown *,
.select-wrapper:has(.select2-container),
.select-wrapper:has(.select2-container) * {
    /* Override any page-wide hover transforms that cause jumping */
    transform: none !important;
    /* Prevent any animations or transitions that interfere */
    animation: none !important;
    /* Ensure stable positioning */
    will-change: auto !important;
}

/* Specifically prevent hover effects on Select2 elements */
.select2-container:hover,
.select2-container:hover *,
.select2-dropdown:hover,
.select2-dropdown:hover *,
.select-wrapper:has(.select2-container):hover,
.select-wrapper:has(.select2-container):hover * {
    transform: none !important;
    animation: none !important;
}

/* Enhanced selection box when dropdown is open */
.select2-container--open .select2-selection--single {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-color: var(--vp-teal) !important;
    border-bottom-color: var(--vp-teal) !important;
    box-shadow: 0 0 0 0.2rem rgba(32, 201, 151, 0.15) !important;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%) !important;
}

/* Prevent any container size changes when dropdown opens */
.select-wrapper:has(.select2-container--open) {
    /* Maintain exact same dimensions */
    min-height: auto !important;
    height: auto !important;
}

/* REMOVED: Duplicate Select2 styling that conflicts with main definitions */

/* Ensure Select2 selection area is clickable */
.select-wrapper .select2-container .select2-selection {
    cursor: pointer !important;
    pointer-events: auto !important;
}

.select-wrapper.has-filter .select2-selection--single {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%) !important;
    border-color: var(--vp-teal) !important;
    box-shadow: 0 2px 8px rgba(32, 201, 151, 0.15) !important;
}

/* Loading state for Select2 */
.select2-container .select2-results__option--loading-more,
.select2-container .select2-results__message {
    padding: 0.75rem !important;
    color: #6c757d !important;
    font-style: italic !important;
    text-align: center !important;
}

/* Mobile Select2 adjustments */
@media (max-width: 768px) {
    .select2-container .select2-selection--single {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.875rem 2.5rem !important;
        height: auto !important;
        min-height: 44px !important;
    }
    
    .select2-dropdown {
        font-size: 16px !important;
    }
    
    .select2-container .select2-results__option {
        padding: 0.75rem !important;
        font-size: 16px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    /* Ensure FontAwesome icons are visible on mobile */
    .select-wrapper .select2-container::before {
        font-size: 16px !important;
    }
    
    /* Fix mobile input selection issues */
    #mobileFilterContainer input,
    #mobileFilterContainer select,
    #mobileFilterContainer .select2-container,
    #mobileFilterContainer .select2-selection {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-user-select: text !important;
        user-select: text !important;
    }
    
    /* Global mobile Select2 fixes - apply to all Select2 elements on mobile */
    .select2-container,
    .select2-container *,
    .select2-dropdown,
    .select2-dropdown * {
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }
    
    /* Specifically target Select2 search input on mobile */
    .select2-search input,
    .select2-search__field {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-user-select: text !important;
        user-select: text !important;
        cursor: text !important;
        -webkit-tap-highlight-color: transparent !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        outline: none !important;
        border: 2px solid #e9ecef !important;
        border-radius: 8px !important;
        font-size: 16px !important;
        padding: 0.75rem 1rem !important;
        background: #ffffff !important;
        width: calc(100% - 1.5rem) !important;
        margin: 0.75rem !important;
        box-sizing: border-box !important;
        position: relative !important;
        z-index: 10000 !important;
    }
    
    /* Ensure mobile filter inputs are properly focusable */
    #mobileFilterContainer .form-control,
    #mobileFilterContainer .form-select {
        -webkit-appearance: none !important;
        appearance: none !important;
        background-color: #ffffff !important;
        border: 2px solid #e9ecef !important;
        border-radius: 8px !important;
        font-size: 16px !important;
        padding: 0.875rem 1rem !important;
        min-height: 44px !important;
        touch-action: manipulation !important;
    }
    
    /* Fix Select2 mobile interaction */
    #mobileFilterContainer .select2-container .select2-selection--single {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        cursor: pointer !important;
    }
    
    /* Ensure search field in Select2 dropdown is selectable */
    #mobileFilterContainer .select2-search__field {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-user-select: text !important;
        user-select: text !important;
        cursor: text !important;
    }
    
    /* Mobile-specific Select2 container styling */
    .mobile-select2-container {
        z-index: 1050 !important;
    }
    
    .mobile-select2-container .select2-selection--single {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    /* Mobile-specific Select2 dropdown styling */
    .mobile-select2-dropdown {
        z-index: 1060 !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }
    
    .mobile-select2-dropdown .select2-search__field {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-user-select: text !important;
        user-select: text !important;
        cursor: text !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    .mobile-select2-dropdown .select2-results__option {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: rgba(32, 201, 151, 0.1) !important;
    }
    
    /* More aggressive mobile Select2 search field fixes */
    .select2-dropdown .select2-search__field {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-user-select: text !important;
        user-select: text !important;
        cursor: text !important;
        -webkit-tap-highlight-color: transparent !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        background-color: #ffffff !important;
        border: 2px solid #e9ecef !important;
        border-radius: 8px !important;
        font-size: 16px !important;
        padding: 0.75rem 1rem !important;
        width: calc(100% - 1.5rem) !important;
        margin: 0.75rem !important;
        box-sizing: border-box !important;
        outline: none !important;
        position: relative !important;
        z-index: 9999 !important;
    }
    
    /* Force focus styles for mobile Select2 search */
    .select2-dropdown .select2-search__field:focus {
        border-color: var(--vp-teal, #20c997) !important;
        box-shadow: 0 0 0 0.2rem rgba(32, 201, 151, 0.15) !important;
        outline: none !important;
        background-color: #ffffff !important;
    }
    
    /* Ensure Select2 dropdown container allows interaction */
    .select2-dropdown {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        z-index: 9998 !important;
    }
    
    /* Fix Select2 search container */
    .select2-dropdown .select2-search {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        position: relative !important;
        z-index: 9999 !important;
    }
}

#results-controls .input-group-text {
    border-color: #dee2e6;
    color: #20c997;
}

#results-controls .form-control {
    border-color: #dee2e6;
    padding: 0.5rem 1rem;
}

#results-controls .form-control:focus {
    border-color: #20c997;
    box-shadow: 0 0 0 0.2rem rgba(32, 201, 151, 0.25);
}

#results-controls .btn-vp-teal {
    border-color: #20c997;
}

/* Spreadsheet-like Table View */
.spreadsheet-table {
    width: 100%;
    margin: 0;
    padding: 0;
}

.spreadsheet-table .table {
    margin-bottom: 0;
    background-color: #fff;
}

.spreadsheet-table .vessel-row {
    border-bottom: 1px solid #f1f3f4 !important;
    transition: background-color 0.15s ease;
}

.spreadsheet-table .vessel-row:hover {
    background-color: #f8f9fa !important;
}

.spreadsheet-table .vessel-row:last-child {
    border-bottom: none !important;
}

.spreadsheet-table td {
    border: none !important;
    vertical-align: middle;
    font-size: 0.9rem;
}

.spreadsheet-table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spreadsheet-table .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.spreadsheet-table .btn-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

/* Card shell */
.vp-card {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(13,27,42,0.06);
  overflow: hidden;
  background: #fff;
  transition: transform .18s ease, box-shadow .18s ease;
}
/* DISABLED: Card hover transform that interferes with Select2 dropdowns */
.vp-card:hover { 
    /* transform: translateY(-2px); */ 
    box-shadow: 0 14px 28px rgba(13,27,42,0.10); 
}
.vp-card:focus-within { outline: 2px solid rgba(32, 201, 151, .3); outline-offset: 2px; }

/* Gradient header */
.vp-card__header {
  background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
  color: #fff;
  padding: 1.1rem 1.15rem;
  position: relative;
}
.vp-card__title { font-weight: 800; letter-spacing: .3px; }

/* Corner highlight bubble similar to legacy */
.vp-card__header::after {
  content: "";
  position: absolute;
  right: -26px;
  top: -26px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.25), rgba(255,255,255,0) 60%);
  pointer-events: none;
}

/* Subtle body */
.vp-card__body { padding: 1.2rem 1.2rem 1.1rem; }
.vp-spec-grid .spec {
  display: flex; align-items: center; gap: .5rem;
  color: #6c757d; font-size: .925rem;
}
.vp-spec-grid .spec strong { color: #0d1b2a; font-weight: 700; }
.vp-spec-grid .spec i { color: #9eacb8; width: 20px; text-align: center; }
/* Labels and value spacing */
.vp-spec-grid .spec small { color: #8a96a3; font-weight: 600; letter-spacing: .2px; display: block; margin-bottom: .1rem; }
.vp-spec-grid .col-6 > strong { display: block; margin-top: .5rem; line-height: 1.2; font-size: 1.1rem; }
.vp-spec-grid .col-6 { margin-bottom: .15rem; }
/* Extra space for chip values (e.g., Status) so they don't choke the label */
.vp-spec-grid .col-6 > .chip { display: inline-flex; margin-top: .55rem; }

/* Footer */
.vp-card__footer { padding: 1rem 1.15rem 1.1rem; background: #f8fafc; }

/* Divider like legacy */
.vp-divider { height: 1px; background: #e9eef3; border: 0; margin: .5rem 0 1rem; }

/* Chips (badges with pill look) */
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 999px; font-weight: 700; font-size: .8rem; }
.chip i { opacity: .9; }
.chip-solid { color: #fff; }

/* Brand teal chip */
.chip-teal { background: var(--vp-teal, #20c997); color: #fff; }

/* Status chips */
.chip-success { background: #198754; color: #fff; }
.chip-warning { background: #f7b500; color: #0d1b2a; }
.chip-danger  { background: #dc3545; color: #fff; }
.chip-info    { background: #0dcaf0; color: #0d1b2a; }
.chip-dark    { background: #212529; color: #fff; }
.chip-primary { background: #0d6efd; color: #fff; }
.chip-secondary { background: #6c757d; color: #fff; }

/* Flag in header */
.vp-flag { font-size: 1.35rem; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); line-height: 1; }
/* Align flag with vessel name on the same row (no absolute positioning) */
.vp-card__header .vp-flag { position: static; margin-left: auto; }

/* CTA button polish */
.btn-vp-teal { background: var(--vp-teal, #20c997); border-color: var(--vp-teal, #20c997); }
.btn-vp-teal:hover { filter: brightness(.95); }

/* Outline teal button global */
.btn-outline-vp-teal { color: var(--vp-teal, #20c997); border-color: var(--vp-teal, #20c997); background: transparent; }
.btn-outline-vp-teal:hover { color: #fff; background: var(--vp-teal, #20c997); border-color: var(--vp-teal, #20c997); }

/* Row gutter */
#vessel-results-container .row { --bs-gutter-y: 1.5rem; }

/* --- Filter Panel Enhancements --- */
/* Range slider bubble above the thumb */
.range-wrapper { position: relative; }
.range-wrapper .range-bubble {
  position: absolute;
  top: -28px;
  transform: translateX(-50%);
  padding: 2px 8px;
  font-size: .75rem;
  border-radius: 999px;
  background: #0d1b2a;
  color: #fff;
  box-shadow: 0 2px 6px rgba(13,27,42,.15);
  white-space: nowrap;
}
.range-wrapper .range-bubble::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -4px;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #0d1b2a;
}

/* Enhanced lazy dropdown loading state */
.lazy-dropdown.loading { 
  opacity: .8; 
  cursor: wait;
  position: relative;
}
.lazy-dropdown.loading::after {
  content: '';
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border: 2px solid #e9eef3;
  border-top: 2px solid var(--vp-teal, #20c997);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}

/* REMOVED: Duplicate select-wrapper styling that conflicts with Select2 */

/* Teal focus states for inputs */
.form-select:focus, .form-control:focus {
  border-color: var(--vp-teal, #20c997);
  box-shadow: 0 0 0 .2rem rgba(32,201,151,.15);
}
.form-range:focus {
  outline: none;
  box-shadow: 0 0 0 .2rem rgba(32,201,151,.15);
}

/* --- Teal Range Sliders --- */
.form-range {
  background: transparent;
}
.form-range::-webkit-slider-track {
  background: #e9eef3;
  border-radius: 0.25rem;
  height: 6px;
}
.form-range::-webkit-slider-thumb {
  background: var(--vp-teal, #20c997);
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(32,201,151,.3);
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.form-range::-webkit-slider-thumb:hover {
  background: #1ab394;
  box-shadow: 0 4px 8px rgba(32,201,151,.4);
}
.form-range::-moz-range-track {
  background: #e9eef3;
  border-radius: 0.25rem;
  height: 6px;
  border: none;
}
.form-range::-moz-range-thumb {
  background: var(--vp-teal, #20c997);
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(32,201,151,.3);
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.form-range::-moz-range-thumb:hover {
  background: #1ab394;
  box-shadow: 0 4px 8px rgba(32,201,151,.4);
}

/* Compact label spacing */
.card .form-label { margin-bottom: .25rem; }

/* --- Sort Dropdown Styling --- */
.sort-wrapper {
  background: #f8fafc;
  border: 1px solid #e9eef3;
  border-radius: .375rem;
  padding: .375rem .75rem;
  transition: all .15s ease-in-out;
}
.sort-wrapper:hover {
  border-color: var(--vp-teal, #20c997);
  background: #fff;
}
.sort-select {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  min-width: 140px;
}
.sort-select:focus {
  border: none;
  box-shadow: none;
  background: transparent;
}

/* --- View Toggle Styling --- */
.view-toggle-wrapper {
  background: #f8fafc;
  border: 1px solid #e9eef3;
  border-radius: .375rem;
  padding: .375rem .75rem;
  transition: all .15s ease-in-out;
}
.view-toggle-wrapper:hover {
  border-color: var(--vp-teal, #20c997);
  background: #fff;
}
.view-toggle .btn-view {
  border: none;
  background: transparent;
  color: #6c757d;
  padding: .25rem .5rem;
  transition: all .15s ease-in-out;
}
.view-toggle .btn-view:hover {
  background: rgba(32,201,151,.1);
  color: var(--vp-teal, #20c997);
}
.view-toggle .btn-view.active {
  background: var(--vp-teal, #20c997);
  color: white;
  box-shadow: 0 2px 4px rgba(32,201,151,.2);
}
.view-toggle .btn-view:focus {
  box-shadow: 0 0 0 .2rem rgba(32,201,151,.15);
}

/* --- Enhanced Clear Button --- */
.btn-outline-vp-teal {
  color: var(--vp-teal, #20c997);
  border-color: var(--vp-teal, #20c997);
  background: transparent;
  transition: all .15s ease-in-out;
}
/* DISABLED: Button hover transform that interferes with Select2 dropdowns */
.btn-outline-vp-teal:hover {
  color: white;
  background: var(--vp-teal, #20c997);
  border-color: var(--vp-teal, #20c997);
  /* transform: translateY(-1px); */
  box-shadow: 0 4px 8px rgba(32,201,151,.2);
}
.btn-outline-vp-teal:focus {
  box-shadow: 0 0 0 .2rem rgba(32,201,151,.25);
}

/* --- Filter Panel Enhancements --- */
.card.border-0.shadow-sm {
  border-radius: .5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.1) !important;
  background: #ffffff;
  border: 1px solid #e9eef3 !important;
}

/* Label icon styling */
.form-label .fas {
  opacity: .8;
  transition: opacity .15s ease-in-out;
}
.form-label:hover .fas {
  opacity: 1;
}

/* REMOVED: Duplicate dropdown styling that conflicts with Select2 */

/* REMOVED: Duplicate select-icon styling that conflicts with Select2 icons */

/* --- Custom Vessel Loading Spinner --- */
.vessel-loading-spinner {
  position: relative;
  width: 60px;
  height: 60px;
  margin: 0 auto;
}

/* Outer spinning ring */
.vessel-loading-spinner::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid #e9eef3;
  border-top: 3px solid var(--vp-teal, #20c997);
  border-radius: 50%;
  animation: vessel-spin 1.2s linear infinite;
}

/* Inner spinning ring */
.vessel-loading-spinner::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 48px;
  height: 48px;
  border: 2px solid transparent;
  border-top: 2px solid rgba(32,201,151,.4);
  border-right: 2px solid rgba(32,201,151,.2);
  border-radius: 50%;
  animation: vessel-spin 2s linear infinite reverse;
}

/* Ship icon in center */
.vessel-loading-spinner .ship-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  color: var(--vp-teal, #20c997);
  z-index: 2;
  animation: vessel-pulse 1.5s ease-in-out infinite;
}

@keyframes vessel-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes vessel-pulse {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.05); }
}


/* --- Results Count Badge --- */
.results-count-badge {
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid #e9eef3;
  border-radius: 1.5rem;
  padding: .375rem .75rem;
  font-size: .75rem;
  font-weight: 600;
  color: #374151;
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  transition: all .2s ease-in-out;
}

.results-count-badge:hover {
  border-color: var(--vp-teal, #20c997);
  box-shadow: 0 2px 6px rgba(32,201,151,.1);
}

.results-count-badge::before {
  content: '\f1b2';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--vp-teal, #20c997);
  font-size: .7rem;
}
