/* =========================================
   Feature 14: Filter Builder Styles
   Theme: Dark Pro
   ========================================= */

/* --- Modal Base --- */
.modal-backdrop {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0); 
    backdrop-filter: blur(0);
    z-index: 2000; justify-content: center; align-items: center;
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}
.modal-backdrop.open { 
    display: flex; 
    background: rgba(15, 23, 42, 0.85); 
    backdrop-filter: blur(4px); 
}

#filter-builder-content.modal-content {
    background: #1e293b; border: 1px solid var(--glass-border);
    width: 1000px; max-width: 95vw;
    border-radius: 12px; box-shadow: 0 25px 80px rgba(0,0,0,0.6);
    border-top: 3px solid var(--brand-yellow); 
    display: flex; flex-direction: column; overflow: hidden;
    height: auto; max-height: 95vh; min-height: 300px;
    
    /* START STATE: Landing Style */
    opacity: 0; 
    transform: scale(1.1); 
    filter: blur(20px);
    
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s ease, filter 0.4s ease, width 0.3s ease, height 0.3s ease;
}

.modal-backdrop.open #filter-builder-content { 
    opacity: 1; 
    transform: scale(1); 
    filter: blur(0); 
}

#filter-builder-content.compact-mode { width: 500px; }

/* Header */
#filter-builder-content .modal-header { 
    padding: 15px 25px; border-bottom: 1px solid var(--glass-border); 
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(15, 23, 42, 0.3);
}
#filter-builder-content h3 { font-size: 1.1rem; color: #fff; margin: 0; font-weight: 600; display: flex; align-items: center; gap: 10px; }

.close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; transition: 0.2s; }
.close-btn:hover { color: #fff; }

.back-btn { background: none; border: none; color: var(--brand-yellow); cursor: pointer; font-size: 1.1rem; margin-right: 10px; }
.back-btn:hover { transform: translateX(-3px); }

/* Body & Steps */
#filter-builder-content .modal-body { padding: 25px; overflow-y: auto; position: relative; flex: 1; }

.modal-step { display: none; flex-direction: column; width: 100%; flex: 1; overflow: hidden; }
.modal-step.active { display: flex; animation: fadeUp 0.3s ease-out forwards; }
.modal-step.active.instant { animation: fadeUp 0s ease-out forwards; }

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

/* Filter Grid (Step 1) */
.filter-group-header {
    font-size: 0.8rem; text-transform: uppercase; color: var(--text-muted);
    font-weight: 700; letter-spacing: 0.5px; border-bottom: 1px solid var(--glass-border);
    padding-bottom: 5px; margin: 20px 0 10px 0;
}
.filter-group-header:first-child { margin-top: 0; }

.filter-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.filter-type-grid.second-row { margin-top: 8px; }

.filter-btn {
    background: #334155; border: 1px solid transparent;
    color: #f1f5f9; padding: 10px; border-radius: 6px;
    font-size: 0.85rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s; text-align: center;
    display: flex; align-items: center; justify-content: center; min-height: 50px;
    line-height: 1.2;
}
.filter-btn:hover {
    background: #475569; border-color: var(--brand-blue);
    color: var(--brand-yellow); transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* FIX: Removed 'display: flex' so grid containers can stay 'display: grid' */
body.custom-off .custom-dep { display: none !important; }
.hidden { display: none !important; }

/* Config (Step 2) */
.config-container { padding-top: 10px; }
.config-group { margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; }
.config-group label { display: block; color: var(--brand-yellow); font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; }

.input-wrapper {
    position: relative; display: flex; align-items: center; justify-content: center; width: fit-content;
}

.config-input {
    width: 100px; background: var(--input-bg); border: 1px solid #334155;
    color: #fff; padding: 10px; border-radius: 6px;
    font-family: var(--font-main); font-size: 1.1rem; text-align: center;
    outline: none; transition: 0.2s;
}
.config-input.has-suffix { padding-right: 25px; }
.input-suffix {
    position: absolute; right: 10px; color: var(--text-muted); font-weight: 600; font-size: 0.9rem; pointer-events: none;
}

.config-input.input-error {
    border-color: var(--danger); background: rgba(239, 68, 68, 0.1); box-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
}

.config-select {
    width: 100%; max-width: 250px;
    background: var(--input-bg); border: 1px solid #334155;
    color: #fff; padding: 10px; border-radius: 6px;
    font-family: var(--font-main); font-size: 0.95rem; outline: none; transition: 0.2s; text-align: center;
}
.config-input:focus, .config-select:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 2px rgba(0, 66, 122, 0.3); }
.config-input::-webkit-outer-spin-button, .config-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.config-input[type=number] { -moz-appearance: textfield; }

.divider { height: 1px; background: var(--glass-border); margin: 25px 0; width: 100%; }

/* Tooltip */
.builder-tooltip {
    visibility: hidden; opacity: 0; position: fixed; z-index: 3000;
    background-color: #0f172a; border: 1px solid var(--brand-yellow);
    color: #f1f5f9; font-size: 0.85rem; padding: 10px; border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8); pointer-events: none; transition: opacity 0.2s; max-width: 250px; line-height: 1.4;
}

/* Footer */
#filter-builder-content .modal-footer { 
    padding: 15px 25px; border-top: 1px solid var(--glass-border); 
    background: rgba(15, 23, 42, 0.3); display: flex; justify-content: flex-end; gap: 10px;
    margin-top: auto;
}