.filter-bar {
    display: flex;
    gap: 15px;
    background-color: var(--bg2);
    padding: 15px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;

    .filter-bar-search {
        flex: 1;
        max-width: 400px;
        background-color: var(--bg);
        border: 1px solid var(--border);
        display: flex;
        align-items: center;
        padding: 8px 12px;
        gap: 8px;

    }
}

.database-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;

    .database-filters {
        width: 300px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
        background-color: var(--bg2);
        border: 1px solid var(--border);

        .filter-group {
            border-bottom: 1px solid var(--border);
            overflow: hidden;
            &:last-child {
                border-bottom: none;
            }
        }

        .filter-title-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 14px;
            background-color: var(--bg3);
            cursor: pointer;
            user-select: none;

            .filter-title {
                font-size: 0.8rem;
                font-weight: 600;
                text-transform: uppercase;
                letter-spacing: 0.8px;
                color: var(--text2);
                margin: 0;
            }

        }

        .filter-mode {
            display: flex;
            gap: 4px;
        }

        .filter-btn-mode {
            background: none;
            border: 1px solid var(--border);
            color: var(--text2);
            font-size: 0.7rem;
            font-weight: 600;
            padding: 2px 7px;
            cursor: pointer;
            font-family: var(--typography);
            transition: all 0.15s;
            letter-spacing: 0.5px;
            &:hover {
                border-color: var(--rhpz-orange);
                color: var(--rhpz-orange);
            }
            &.active {
                background-color: var(--rhpz-orange);
                border-color: var(--rhpz-orange);
                color: var(--text3);
            }
        }

        .filter-options {
            padding: 6px 0;
            max-height: 180px;
            overflow-y: auto;
            &::-webkit-scrollbar {
                width: 6px;
            }
            &::-webkit-scrollbar-track {
                background: var(--bg2);
            }
            &::-webkit-scrollbar-thumb {
                background: var(--border);
            }
        }

        .filter-option {
            display: flex;
            align-items: center;
            gap: 9px;
            padding: 6px 14px;
            font-size: 0.88rem;
            color: var(--text);
            cursor: pointer;
            transition: background-color 0.1s;
            &:hover {
                background-color: var(--bg4);
            }
        }

        .filter-option input[type="checkbox"] {
            accent-color: var(--rhpz-orange);
            width: 14px;
            height: 14px;
            cursor: pointer;
            flex-shrink: 0;
        }

    }

    .database-results {
        flex: 1;
        min-width: 0;

        .database-sort {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 15px;
            padding-bottom: 15px;
            border-bottom: 1px solid var(--border);
            flex-wrap: wrap;

            .btn {
                font-size: 0.85rem;
                padding: 6px 12px;
                &.active {
                    border-color: var(--rhpz-orange);
                    color: var(--rhpz-orange);
                }
            }

        }

        .database-results-count {
            margin-left: auto;
            font-size: 0.85rem;
            color: var(--text2);
        }

        .database-active-filters {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 15px;
        }

        .database-active-filter-tag {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background-color: var(--bg3);
            border: 1px solid var(--border);
            padding: 3px 10px;
            font-size: 0.8rem;
            color: var(--text);
            .tag-type {
                color: var(--rhpz-orange);
                font-weight: 600;
                font-size: 0.75rem;
                text-transform: uppercase;
                letter-spacing: 0.5px;
            }
            button {
                background: none;
                border: none;
                color: var(--text2);
                cursor: pointer;
                padding: 0;
                display: flex;
                align-items: center;
                transition: color 0.15s;
                &:hover {
                    color: var(--text);
                }
            }
        }

        .database-empty {
            grid-column: 1 / -1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 60px 20px;
            color: var(--text2);
            background-color: var(--bg2);
            border: 1px solid var(--border);
            gap: 15px;
            text-align: center;

            i {
                color: var(--border);
            }

            p {
                font-size: 0.95rem;
            }
        }

    }

}

.database-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 20px;

    .btn {
        min-width: 36px;
        padding: 6px 10px;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .active {
        background-color: var(--rhpz-orange);
        border-color: var(--rhpz-orange);
        color: #111;
        font-weight: 600;
    }
}

.database-search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .database-layout {
        flex-direction: column;
    }

    .database-wrapper {
        flex-direction: column;
    }

    .database-filters {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2,1fr);
    }

    .database-filter-group:last-child {
        border-bottom: 1px solid var(--border);
    }

    .database-results-count {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .database-search {
        gap: 8px;
        margin-bottom: 15px;
        flex-wrap: wrap;
    }

    .database-wrapper {
        flex-direction: column;
        gap: 15px;
    }

    .database-filters {
        width: 100%;
        grid-template-columns: 1fr;
        order: -1;
        margin-bottom: 10px;
    }

    .database-filter-group {
        padding: 12px 0;
    }

    .grid-entries {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 600px) {
    .database-search {
        flex-direction: column;
    }

    .database-filters {
        grid-template-columns: 1fr;
    }

    .grid-entries {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .database-filter-group {
        padding: 10px 0;
    }
}

@media (max-width: 420px) {
    .grid-entries {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .database-search input {
        font-size: 0.85rem;
        padding: 6px 8px;
    }
}

.filter-chevron {
    transition: transform 0.2s ease;
    color: var(--text2);
    flex-shrink: 0;
}

.filter-chevron.rotated {
    transform: rotate(-90deg);
}

.internal-filter-search {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg);

    i {
        color: var(--text2);
        flex-shrink: 0;
    }

    input {
        background: none;
        border: none;
        outline: none;
        color: var(--text);
        font-family: var(--typography);
        font-size: 0.85rem;
        width: 100%;

        &::placeholder {
            color: var(--text2);
        }
    }
}

.filter-title-left {
    display: flex;
    align-items: center;
    gap: 7px;
}

.filter-title-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.internal-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--rhpz-orange);
    color: #111;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    line-height: 1;
}

.internal-filter-clear {
    background: none;
    border: 1px solid var(--border);
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    transition: all 0.15s;

    &:hover {
        border-color: var(--error);
        color: var(--error);
    }
}

.filter-search-clear {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0;
    flex-shrink: 0;
    transition: color 0.15s;
    &:hover {
        color: var(--text);
    }
}

