/* ==========================================================================
   KJB Modern Search - Tulex Style V2.2
   ========================================================================== */

/* 1. Grundgerüst & Layout */
.kjb-modern-container {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    max-width: 1100px;
    margin: 20px auto;
    line-height: 1.5;
}

.kjb-modern-main-content {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-top: 30px;
}

/* 2. Such-Optionen (Radios) */
.search-options {
    display: flex;
    gap: 30px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.95em;
}

.search-options label {
    cursor: pointer;
    font-weight: 500;
}

/* 3. Suchfeld & Buttons */
.search-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

#kjb_ajax_searchtext {
    flex-grow: 1;
    padding: 14px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

#kjb_ajax_searchtext:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.1);
}

#kjb_ajax_search_btn {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 0 30px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

#kjb_ajax_search_btn:hover {
    background-color: #005177;
}

/* 4. Linke Spalte: Treffer & Filter */
.kjb-search-side {
    flex: 1.6;
}

.kjb-search-side h3 {
    margin: 0 0 15px 0;
    font-size: 1.4em;
    color: #2c3338;
}

.kjb-filter-bar {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kjb-filter-btn {
    background: #fff;
    border: 1px solid #ddd;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.kjb-filter-btn:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.kjb-filter-btn.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.2);
}

/* 5. Ergebniskarten (Treffer-Cards) */
.kjb-result-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.kjb-card {
    position: relative;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 20px 60px 20px 20px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.kjb-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    border-color: #d0d0d0;
}

.kjb-card.is-selected {
    background-color: #f0f7ff;
    border: 1px solid #0073aa;
    box-shadow: inset 4px 0 0 #0073aa;
}

.kjb-card-title {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 6px;
}

.kjb-card-class {
    display: inline-block;
    background: #f0f0f1;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.8em;
    color: #50575e;
    font-weight: 500;
}

/* 6. Action-Button (Hinzufügen/Entfernen) */
.kjb-add-btn {
    position: absolute;
    right: 18px;
    bottom: 50%;
    transform: translateY(50%);
    background: #f0f0f1;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #0073aa;
    transition: all 0.2s ease;
}

.kjb-add-btn:hover {
    background: #e2e4e7;
    transform: translateY(50%) scale(1.05);
}

.kjb-card.is-selected .kjb-add-btn {
    background: #0073aa;
    color: white;
}

.kjb-card.is-selected .kjb-add-btn:hover {
    background: #d63638; /* Wechselt zu Rot beim Hover zum Löschen */
}

/* 7. Rechte Spalte: Auswahl (Sticky Panel) */
.kjb-selection-side {
    flex: 1;
    position: sticky;
    top: 30px;
    background: #ffffff;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

#kjb-ajaxsearch-select-header {
    border-bottom: 2px solid #f0f0f1;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

/* Gruppierung & Farblogik */
.kjb-selection-class-group {
    margin-bottom: 18px;
    border: 1px solid #f0f0f1;
    border-radius: 10px;
    overflow: hidden;
}

.class-header {
    padding: 8px 15px;
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Farbschema für die Gruppen (Tulex Style) */
.kjb-selection-class-group:nth-child(4n+1) .class-header { background: #e3f2fd; color: #1565c0; }
.kjb-selection-class-group:nth-child(4n+2) .class-header { background: #f1f8e9; color: #33691e; }
.kjb-selection-class-group:nth-child(4n+3) .class-header { background: #fff3e0; color: #e65100; }
.kjb-selection-class-group:nth-child(4n+4) .class-header { background: #f3e5f5; color: #7b1fa2; }

.kjb-selection-item {
    background: #fff;
    padding: 10px 15px;
    border-bottom: 1px solid #f9f9f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.kjb-selection-item:last-child { border-bottom: none; }

.kjb-remove-item {
    cursor: pointer;
    color: #bdc3c7;
    font-weight: bold;
    font-size: 1.3em;
    transition: color 0.2s;
}

.kjb-remove-item:hover { color: #d63638; }

/* 8. Export & Löschen Buttons */
.btn-download {
    background: #28a745;
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: bold;
}

#kjb-modern-remove-all {
    background: #fbeaea;
    color: #d63638;
    border: 1px solid #f5d3d3;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
}

#kjb-modern-remove-all:hover { background: #fce2e2; }

/* 9. Mobile Responsiveness */
@media (max-width: 850px) {
    .kjb-modern-main-content {
        flex-direction: column;
    }
    .kjb-selection-side {
        position: static;
        width: 100%;
        max-height: none;
    }
}