/* CSS for IAPG Badge Filter V20 - Dropdown / Clean Revert */

#iapg-badge-filter-container {
    display: flex;
    flex-direction: column; /* Vertical layout for dropdown behavior */
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px 0; /* Minimal padding */
    background: transparent; /* Cleaner look */
    border: none;
}

/* Header Row for Right Alignment */
#iapg-filter-header {
    display: flex;
    justify-content: flex-end; /* Align right */
    width: 100%;
}

/* The Trigger Button */
#iapg-filter-trigger {
    background: none;
    border: none;
    color: #666;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
}

#iapg-filter-trigger:hover {
    color: #333;
}

#iapg-filter-trigger.active {
    color: #000;
}

/* The List Container (Hidden by default) */
#iapg-filter-list {
    display: none; /* Hidden */
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Filter Tag Buttons (Pill shape) */
.iapg-filter-btn {
    background-color: #fff;
    border: 1px solid #ccc;
    color: #333;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.iapg-filter-btn:hover {
    background-color: #e6e6e6;
    border-color: #bbb;
}

.iapg-filter-btn.active {
    background-color: #0073aa; /* Standard WordPress Blue or similar */
    color: white;
    border-color: #0073aa;
    font-weight: bold;
}

/* Modal Styling */
#iapg-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    backdrop-filter: blur(2px);
}

#iapg-modal-backdrop.active {
    display: block;
}

#iapg-filtered-results {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 9999;
    flex-direction: column;
}

#iapg-filtered-results.active {
    display: flex;
}

/* Hide controls safety */
#iapg-modal-controls,
#iapg-modal-results-list .iapg-filter-btn,
#iapg-modal-results-list #iapg-badge-filter-container {
    display: none !important;
}

/* Results List inside Modal */
#iapg-modal-results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#iapg-close-modal {
    align-self: flex-end;
    background: #ff4d4d;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 10px;
    position: sticky; top: 0; z-index: 10000;
}

/* Widget Styles in Modal - Revert V19 changes */
#iapg-modal-results-list .elementor-widget-container,
#iapg-modal-results-list > div:not(.iapg-debug-msg) {
    display: block !important;
    width: 100% !important;
    background: #fff;
    border: 1px solid #eee !important; /* Standard border */
    border-radius: 8px !important; /* Standard Radius */
    padding: 20px !important;
    margin-bottom: 20px !important;
}

.iapg-debug-msg {
    padding: 15px;
    background: #ffeeee;
    border: 1px solid #ffcccc;
    color: #aa0000;
}