/*
    jQuery UI css reset
*/
.ui-corner-all {
    background: unset !important;
    border: unset !important;
    padding: unset !important;
}

.ui-tabs .ui-tabs-nav {
    border-bottom: 2px solid #e1e5e9 !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-radius: 12px 12px 0 0 !important;
}

.ui-tabs .ui-tabs-nav li.ui-tabs-active {
    border-bottom: none !important;
    margin-bottom: -2px !important;
    padding-bottom: 4px !important;
}

.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover {
    border: 1px solid #5ba3b8 !important;
    background: linear-gradient(135deg, #9ccee1 0%, #5ba3b8 100%) !important;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(156, 206, 225, 0.5) !important;
}

.ui-tabs-panel {
    padding: 0 !important;
}

#search_tagSelector {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
}

/* Modern Search Container */
.search-container-modern {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 300px; /* 4 equal tag columns + fixed width filter */
    gap: 6px; /* Reduced from 24px */
    background: #ffffff;
    /*border-radius: 16px;*/
    padding: 16px 0; /* Reduced from 24px */
    position: relative;
    overflow: hidden;
}

.search-container-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #5ba3b8 0%, #9ccee1 50%, #b8dce8 100%);
}

/* Tag Section */
.tag-section-modern {
    /*display: flex;
    flex-direction: column;*/
    display: contents; /* This allows grid items to be direct children */
}

.tags-grid {
    /*display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    align-items: start;*/
    display: contents; /* This allows grid items to be direct children */
}

.tag-group-modern {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 200px;
}

.tag-group-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

/* Specific adjustments for two-column layouts */
.tag-group-modern.two-columns {
    /*padding: 8px;*/ /* Even more compact for two columns */
}

.tag-group-modern.two-columns .tag-group-header {
    /*margin-bottom: 8px;*/ /* Reduced spacing */
    /*padding-bottom: 6px;*/
}

.tag-group-modern.two-columns .tag-group-title {
    /*font-size: 1rem;*/ /* Slightly smaller title */
}

.tag-group-modern.two-columns .tag-count {
    /*padding: 2px 6px;*/ /* Smaller count badge */
    /*font-size: 0.7rem;*/
}

/* Hover effects for two-column items */
.tag-group-modern.two-columns .tag-label-modern:hover {
    transform: translateX(2px); /* Smaller transform for compact layout */
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.12); /* Lighter shadow */
}

.tag-group-modern.funktion-wide {
    grid-column: span 1;
}



.tag-group-modern.two-columns .tag-text {
    /*font-size: inherit;*/ /* Use the smaller font size from parent */
    /*line-height: 1.2;*/ /* Tighter line height */
}

.tag-group-modern.two-columns .tag-checkmark {
    /*font-size: 0.7rem;*/ /* Smaller checkmark */
}

.tag-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.tag-group-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-group-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: linear-gradient(135deg, #9ccee1, #5ba3b8);
    border-radius: 2px;
}

.tag-count {
    background: linear-gradient(135deg, #9ccee1, #5ba3b8);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tag-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tag-item {
    /*break-inside: avoid;*/
    margin-bottom: 0px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.tag-items.two-columns {
    /*column-count: 2;*/
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 8px;
    column-fill: balance; /* Distribute items evenly */
}

.tag-items.two-columns .tag-item {
    /*width: 49%;*/
    width: 100%;
    break-inside: avoid; /* Prevent items from breaking across columns */
    page-break-inside: avoid; /* For better cross-browser support */
    /*margin-bottom: 3px;*/ /* Reduced margin */
}

.tag-items.two-columns .tag-item.short-text {
    width: 48%;
}

.tag-group-modern.two-columns .tag-label-modern {
    /*padding: 6px 8px;*/ /* Reduced padding for two-column layout */
    /*font-size: 0.75rem;*/ /* Smaller font size */
    margin-bottom: 0;
    width: 100%; /* Ensure full width within column */
    box-sizing: border-box;
}

@media (max-width: 1280px) {
    .tag-items.two-columns .tag-item.short-text {
        width: 100%;
    }
}

.tag-checkbox-modern {
    display: none;
}

.tag-label-modern {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.85rem;
    color: #475569;
    position: relative;
    overflow: hidden;
}

.tag-label-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(156, 206, 225, 0.2), transparent);
    transition: left 0.5s ease;
}

.tag-label-modern:hover::before {
    left: 100%;
}

.tag-label-modern:hover {
    border-color: #9ccee1;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(156, 206, 225, 0.3);
}

.tag-text {
    flex: 1;
    text-align: left;
}

.tag-checkmark {
    opacity: 0;
    transition: all 0.3s ease;
    /*color: #10b981;*/
    font-weight: bold;
}

.tag-checkbox-modern:checked + .tag-label-modern {
    background: linear-gradient(135deg, #9ccee1 0%, #5ba3b8 100%);
    border-color: #5ba3b8;
    color: white;
    transform: translateX(0);
}

.tag-checkbox-modern:checked + .tag-label-modern .tag-checkmark {
    opacity: 1;
}

/* Filter Section */
.filter-section-modern {
    display: flex;
    /*flex-direction: column;*/
}

.filter-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 20px;
}

.filter-header {
    margin-bottom: 16px;
    text-align: center;
}

.filter-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.filter-title::before,
.filter-title::after {
    content: '';
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, #9ccee1, #5ba3b8);
    border-radius: 1px;
}

.filter-group {
    margin-bottom: 15px;
}

.filter-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 2px;
    font-size: 0.9rem;
}

/*.field-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.85rem;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.field-input:focus {
    outline: none;
    border-color: #9ccee1;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(156, 206, 225, 0.1);
}*/

.form-input-modern {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    font-weight: 500;
    transition: all 0.3s ease;
    appearance: none;   
    padding-right: 32px;
    font-size: 0.85rem !important;
}

.form-select-modern {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    font-weight: 500;
    transition: all 0.3s ease;
    appearance: none;
    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");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 14px;
    padding-right: 32px;
    font-size: 0.85rem !important;
}

.form-select-modern:focus,
.form-input-modern:focus {
    outline: none;
    border-color: #9ccee1;
    box-shadow: 0 0 0 3px rgba(156, 206, 225, 0.3);
}

/* Dimensions Section */
.dimensions-section {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 10px;
    padding: 14px;
    margin-top: 6px;
}

.dimensions-toggle-modern {
    margin-bottom: 14px;
}

.toggle-switch {
    display: none;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 12px;
}

.toggle-slider {
    width: 48px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 24px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch:checked + .toggle-label .toggle-slider {
    background: #9ccee1;
}

.toggle-switch:checked + .toggle-label .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-text {
    font-weight: 600;
    color: #374151;
}

.sliders-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /*opacity: 0.5;*/
    transition: opacity 0.3s ease;
}

/* When toggle is checked, make entire sliders container fully opaque */
.toggle-switch:checked + .toggle-label + .sliders-container,
.toggle-switch:checked ~ .sliders-container {
    opacity: 1;
}

.slider-group {
    /*opacity: 0.5;*/
    transition: opacity 0.3s ease;
}

/*.toggle-switch:checked ~ .sliders-container .slider-group {
    opacity: 1;
}*/

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.slider-title {
    font-weight: 600;
    color: #374151; /* This will now properly show as black when enabled */
    font-size: 0.8rem;
}

.toggle-text {
    font-weight: 600;
    color: #374151; /* Ensure toggle text is always black */
}

/* Ensure range inputs are also disabled/enabled properly */
.range-modern:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.range-modern:disabled::-webkit-slider-thumb {
    background: #cbd5e1;
    cursor: not-allowed;
}

.range-modern:disabled::-moz-range-thumb {
    background: #cbd5e1;
    cursor: not-allowed;
}

.slider-value-modern {
    background: linear-gradient(135deg, #9ccee1, #5ba3b8);
    color: white;
    padding: 2px 8px;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
}

.range-modern {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    outline: none;
    appearance: none;
    margin-bottom: 6px;
}

.range-modern::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9ccee1, #5ba3b8);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(156, 206, 225, 0.5);
    transition: all 0.2s ease;
}

.range-modern::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.range-modern::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9ccee1, #5ba3b8);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(156, 206, 225, 0.5);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

/* Search Footer */
.search-container-footer {
    display: flex;
    justify-content: center;
    padding: 20px 4px 0;
}

.search-container-footer .btn {
    padding: 12px 32px;
    border-radius: 10px;
    font-weight: 600;
    background: linear-gradient(135deg, #9ccee1 0%, #5ba3b8 100%);
    border: none;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(156, 206, 225, 0.5);
}

.search-container-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(156, 206, 225, 0.6);
}

/* Responsive Design */
/*@media (max-width: 1200px) {
    .tag-label-modern {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .tag-group-modern.funktion-wide {
        grid-column: span 1;
    }
    
    .tags-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 900px) {
    .search-container-modern {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }
    
    .filter-card {
        position: static;
    }
    
    .tags-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 12px;
    }
    
    .tag-label-modern {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

@media (max-width: 600px) {
    .tag-group-modern.two-columns .tag-items {
        column-count: 1;
    }
    
    .tags-grid {
        grid-template-columns: 1fr;
    }
    
    .search-container-modern {
        padding: 16px;
    }
    
    .tag-label-modern {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    
    .tag-group-title {
        font-size: 1rem;
    }
    
    .sliders-container {
        gap: 16px;
    }
}*/

/* Responsive adjustments - stack when too narrow */
/*@media (max-width: 1100px) {
    .search-container-modern {
        grid-template-columns: 1fr 1fr 280px;*/ /* 2 columns + filter when medium */
/*grid-template-rows: auto auto;
    }
    
    .tag-group-modern:nth-child(3),
    .tag-group-modern:nth-child(4) {
        grid-row: 2;*/ /* Move last two tag groups to second row */
/*}
}*/



@media (max-width: 900px) {
    .search-container-modern {
        grid-template-columns: 1fr 250px; /* 1 column + filter when small */
        grid-template-rows: repeat(4, auto);
    }

    .tag-group-modern {
        grid-column: 1;
    }

    .filter-section-modern {
        grid-column: 2;
        grid-row: 1 / -1; /* Span all rows */
    }
}

@media (max-width: 800px) {
    .search-container-modern {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 10px;
        padding: 12px;
    }

    .filter-card {
        position: static;
    }

    .tag-label-modern {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .tag-group-modern.two-columns .tag-items {
        column-count: 1; /* Single column on mobile */
    }
}

/* Additional utility for better column distribution */
.tag-group-modern.two-columns .tag-items::before {
    content: '';
    display: block;
    height: 0;
    width: 100%;
    column-span: all; /* Helps with column balancing */
}

/* Ensure text doesn't overflow in narrow columns */
.tag-group-modern.two-columns .tag-text {
    word-break: break-word;
    hyphens: auto;
    overflow-wrap: break-word;
}

/* Legacy support for existing classes */
.search-container {
    display: flex;
    gap: 32px;
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 4px;
}

.tag-section {
    flex: 0.65;
    display: flex;
    flex-direction: column;
}

.filter-section {
    flex: 0.35;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tags-container {
    display: flex;
    align-items: flex-start;
    align-content: flex-start;
    gap: 8px;
    flex: 1;
}

.tag-group {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    width: 100%;
}

.tag-group.two-columns {
    column-count: 2;
    display: block;
}

.tag-group.two-columns > div {
    display: block;
    break-inside: avoid;
    margin-bottom: 6px;
    width: 100%;
}

.tag-group .tag-label {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.tag-group.two-columns .tag-group-heading {
    column-span: all;
    margin-bottom: 8px;
    display: block;
}

.tag-group-heading {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
}

.tag-checkbox {
    display: none;
}

.tag-label {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 6px 8px;
    border-radius: 8px;
    background: #f5f7fa;
    color: #333;
    cursor: pointer;
    border: 1px solid #e0e6ed;
    transition: all 0.25s ease;
    user-select: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.tag-checkbox:checked + .tag-label {
    background: #041e42;
    color: #fff;
    border: 1px solid #041e42;
    box-shadow: 0 2px 8px rgba(4, 30, 66, 0.2);
    transform: translateY(-1px);
}

.tag-label:hover {
    background: #e8ecf2;
    transform: translateY(-1px);
}

.custom-select {
    border-radius: 8px;
    border: 1px solid #e0e6ed;
    padding: 12px 16px;
    background-color: #f5f7fa;
    color: #333;
    font-weight: 500;
    transition: all 0.25s ease;
    height: auto;
}

.custom-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(4, 30, 66, 0.15);
    border-color: #041e42;
}

.dimensions-container {
    background: #f5f7fa;
    border-radius: 10px;
    padding: 16px;
}

.dimensions-toggle {
    margin-bottom: 8px;
}

.form-check-input {
    width: 18px;
    height: 18px;
}

.form-check-input:checked {
    background-color: #041e42;
    border-color: #041e42;
}

.form-check-label {
    margin-left: 4px;
    font-weight: 500;
    font-size: 0.9rem;
}

.slider-container {
    margin-bottom: 16px;
}

.slider-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0px;
    display: flex;
    justify-content: space-between;
    color: #333;
}

.slider-value {
    background: #041e42;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 30px;
    text-align: center;
}

.custom-range {
    height: 6px;
}

.custom-range::-webkit-slider-thumb {
    background: #041e42;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.custom-range:disabled::-webkit-slider-thumb {
    background: #b0b0b0;
}

.custom-range::-moz-range-thumb {
    background: #041e42;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-range::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.custom-range:disabled::-moz-range-thumb {
    background: #b0b0b0;
}

@media (max-width: 768px) {
    .search-container {
        flex-direction: column;
    }

    .tag-section, .filter-section {
        flex: 1;
        width: 100%;
    }
}
