/* ================== ADVANCED SEARCH PAGE ================== */
/* Redesigned for maximum width usage and beautiful layout */

/* Global container rules to prevent horizontal overflow */
.results-section,
.results-container,
.filters-section {
    max-width: 100%;
    overflow-x: hidden;
}

/* Module Selector Card - Beautiful centered hero section */
.module-selector-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 1rem 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    max-width: 900px;
    margin: 0 auto 3rem;
}

/* Title styling removed - now outside card */

.module-selector-card p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    opacity: 0.9;
    text-align: center;
    font-weight: 400;
}

.module-select-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

.module-selector-card .form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    display: block;
    text-align: center;
}

.module-selector-card .form-label i {
    color: var(--primary-color);
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

/* Module Select Dropdown - Beautiful and large */
.module-select {
    width: 100%;
    padding: 1.25rem 3.5rem 1.25rem 1.75rem;
    font-size: 1.15rem;
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%236366f1' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.25rem center;
    background-size: 1.5rem;
}

.module-select:hover {
    border-color: var(--primary-color);
}

.module-select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.module-select option {
    padding: 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1.05rem;
}

/* Filters Section - Full width with grid layout */
.filters-section {
    animation: fadeInUp 0.5s ease;
}

.filters-card {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.filters-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    padding: 1.5rem 2rem;
    border-bottom: 2px solid rgba(99, 102, 241, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filters-header h5 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    margin: 0;
}

.filters-header h5 i {
    color: var(--primary-color);
    margin-right: 0.75rem;
    font-size: 1.3rem;
}

.filters-body {
    padding: 2rem;
}

/* Filters Grid - Beautiful horizontal layout */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Filters Separator - Divides Filters from Settings */
.filters-separator {
    margin: 2rem 0 1.5rem 0;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.filters-separator h6 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.filters-separator h6 i {
    color: var(--primary-color);
}

@media (min-width: 1400px) {
    .filters-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .filters-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Filter Group - Each filter item */
.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    min-height: 24px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.filter-group label i {
    color: var(--primary-color);
    font-size: 1rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    height: 3.25rem !important; /* 52px - Forçar mesma altura para TODOS os inputs */
    min-height: 3.25rem !important;
    max-height: 3.25rem !important;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
    background: var(--bg-card);
}

.filter-group input:hover,
.filter-group select:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.filter-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%236366f1' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* Year Range Filter - Special layout */
.filter-group.year-range {
    grid-column: span 2;
}

.year-range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Switch Toggle Container */
.switch-container {
    display: flex;
    align-items: center;
    margin-top: 0.5rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    transition: all 0.3s ease;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.switch input:checked + .slider:before {
    transform: translateX(24px);
    background-color: white;
}

.switch:hover .slider {
    border-color: rgba(99, 102, 241, 0.5);
}

/* Remove old checkbox filter styles */
.filter-group.filter-checkbox {
    display: none;
}

.filter-group.filter-checkbox .form-check {
    display: none;
}

.filter-group.filter-checkbox .form-check-input {
    display: none;
}

.filter-group.filter-checkbox .form-check-label {
    display: none;
}

/* Range Filters (score, date, year) */
.filter-group.filter-range .range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.filter-group.filter-range input,
.filter-group.filter-range select {
    width: 100%;
    padding: 0.875rem 1rem;
    height: 3.25rem !important;
    min-height: 3.25rem !important;
    max-height: 3.25rem !important;
    line-height: 1.5;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    flex-shrink: 0;
}

.filter-group.filter-range input:focus,
.filter-group.filter-range select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
    background: var(--bg-card);
}

.filter-group.filter-range input:hover,
.filter-group.filter-range select:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.filter-group.filter-range select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%236366f1' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

@media (max-width: 767px) {
    .filter-group.year-range {
        grid-column: span 1;
    }
}

/* Filters Footer - Action buttons */
.filters-footer {
    padding: 1.5rem 2rem;
    background: rgba(99, 102, 241, 0.03);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.filters-footer .btn-site {
    padding: 0.875rem 2.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.filters-footer .btn-site:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Results Section - Full width grid */
.results-section {
    animation: fadeInUp 0.5s ease;
    position: relative;
}

/* Pagination Loading Overlay */
.pagination-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 16px;
    backdrop-filter: blur(2px);
}

.pagination-loading-overlay .spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.pagination-loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

.pagination-loading-overlay p {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.results-header {
    background: var(--bg-card);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.results-header h4 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    margin: 0;
}

.results-header h4 i {
    color: var(--primary-color);
    margin-right: 0.75rem;
}

.results-header .badge {
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

/* Results Grid - List layout (one per line) */
.results-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

/* Result Card - Horizontal list layout */
.result-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: visible;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 120px;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
}

.result-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    z-index: 10;
}

.result-image-wrapper {
    width: 90px;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    position: relative;
    border-radius: 12px 0 0 12px;
}

.result-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Image Placeholder - Module colored background with icon */
.result-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* background set inline via JS with module color */
}

.result-image-placeholder i {
    font-size: 2rem;
    color: white;
    opacity: 0.9;
}

/* Result Content - Horizontal layout */
.result-content {
    flex: 1;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
    overflow: visible;
}

.result-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.result-title {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.result-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 100%;
    overflow: hidden;
}

.result-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.result-meta-item i {
    color: var(--primary-color);
    font-size: 0.85rem;
}

/* Genre display - following same pattern as other meta items */
.result-genres {
    display: inline;
}

.genre-tag-more {
    color: var(--primary-color);
    font-weight: 600;
    cursor: help;
    white-space: nowrap;
}

.genre-tag-more:hover {
    color: var(--primary-hover);
}

/* In Library Badge - shows in place of Add button */
.in-library-badge {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
    transition: all 0.3s ease;
}

.in-library-badge:hover {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    transform: translateY(-1px);
}

.in-library-badge i {
    font-size: 0.875rem;
}

/* Add Button Wrapper - contains button and dropdown */
.add-button-wrapper {
    position: relative;
    flex-shrink: 0;
    z-index: 100;
}

.btn-add-toggle {
    padding: 0.5rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-add-toggle:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

.btn-add-toggle:active {
    transform: translateY(0);
}

/* Add Dropdown Menu - appears ABOVE button */
.add-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(99, 102, 241, 0.2);
    border: 2px solid rgba(99, 102, 241, 0.3);
    display: none;
    z-index: 1000;
    overflow: hidden;
    backdrop-filter: blur(10px);
    padding: 0.5rem 0;
}

.add-dropdown-menu.show {
    display: block;
    animation: slideUpFade 0.3s ease;
}

.dropdown-item {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: transparent;
    color: var(--text-primary);
    border: none;
    border-bottom: 1px solid rgba(99, 102, 241, 0.08);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-align: left;
}

.dropdown-item:first-child {
    margin-top: 0;
}

.dropdown-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));
    color: var(--primary-light);
}

.dropdown-item:active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
}

.dropdown-item i {
    font-size: 1.1rem;
    color: var(--primary-light);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Quick Add Button Override - specific styles for advanced search page */
.quick-add-btn {
    top: 24px !important;
    right: 0px !important;
}

/* Advanced Add Button - exact same styling as Quick Add */
.advanced-add-btn {
    position: relative;
    top: 24px;
    right: 0px;
    transform: translateY(-50%);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.advanced-add-btn:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Load More Container */
.load-more-container {
    text-align: center;
    padding: 2rem 0;
}

.btn-load-more {
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-load-more:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.2);
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

.loading-state p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
}

/* No Results State */
.no-results-state {
    text-align: center;
    padding: 5rem 2rem;
    background: var(--bg-card);
    border-radius: 20px;
    border: 2px dashed var(--border-color);
}

.no-results-icon {
    font-size: 5rem;
    color: var(--text-secondary);
    opacity: 0.3;
    margin-bottom: 2rem;
}

.no-results-state h4 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.no-results-state p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ================== CUSTOM GENRES SELECT (NO SELECT2) ================== */
.custom-genres-select {
    position: relative;
    width: 100%;
}

/* Display box (shows selected genres) */
.genres-display-box {
    background: transparent;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    min-height: 3.25rem; /* Altura mínima igual aos outros inputs */
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.genres-display-box:hover {
    border-color: rgba(139, 92, 246, 0.5);
}

.custom-genres-select:focus-within .genres-display-box {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.genres-display-box .placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
    background: transparent;
    pointer-events: none;
}

/* Selected genre tags */
.genre-tag {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.genre-tag:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.genre-tag i {
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.genre-tag i:hover {
    opacity: 1;
    color: #ff6b6b;
}

/* Dropdown container */
.genres-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.genres-dropdown.show {
    max-height: 400px;
    opacity: 1;
    overflow: visible;
}

/* Search input */
.genres-search {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-bottom: 1.5px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    border-radius: 10px 10px 0 0;
}

.genres-search:focus {
    border-bottom-color: #8b5cf6;
}

.genres-search::placeholder {
    color: var(--text-muted);
}

/* Options container */
.genres-options {
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem;
}

.genres-options::-webkit-scrollbar {
    width: 8px;
}

.genres-options::-webkit-scrollbar-track {
    background: var(--bg-input);
    border-radius: 10px;
}

.genres-options::-webkit-scrollbar-thumb {
    background: #8b5cf6;
    border-radius: 10px;
}

.genres-options::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}

/* Genre option (checkbox + label) */
.genre-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
}

.genre-option:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(124, 58, 237, 0.08));
}

.genre-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #8b5cf6;
    flex-shrink: 0;
}

.genre-option span {
    color: var(--text-primary);
    font-size: 0.9rem;
    user-select: none;
}

.genre-option:has(input:checked) {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(124, 58, 237, 0.2));
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .genre-tag {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    .genres-dropdown.show {
        max-height: 300px;
    }

    .genres-options {
        max-height: 220px;
    }
}

/* ================== COLLAPSIBLE SECTIONS (GENRES & SETTINGS) ================== */
.collapsible-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(124, 58, 237, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.collapsible-header:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.15));
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.collapsible-title {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.collapsible-title i {
    color: #8b5cf6;
    font-size: 1.35rem;
}

.collapse-icon {
    color: #8b5cf6;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 0;
}

.collapsible-content.expanded {
    max-height: 5000px;
    opacity: 1;
    margin-bottom: 1rem;
}

/* Genres Checkbox Grid */
.genres-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.genre-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--text-primary);
}

.genre-checkbox-label:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(124, 58, 237, 0.08));
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

.genre-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #8b5cf6;
}

.genre-checkbox-label:has(.genre-checkbox:checked) {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(124, 58, 237, 0.2));
    border-color: #8b5cf6;
    font-weight: 600;
}

@media (max-width: 768px) {
    .collapsible-header {
        padding: 0.875rem 1.25rem;
    }

    .collapsible-title {
        font-size: 1.1rem;
    }

    .collapse-icon {
        font-size: 1rem;
    }

    .genres-checkbox-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }
    
    .genre-checkbox-label {
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================== PAGINATION STYLES ================== */
#paginationContainer {
    margin-top: 3rem;
}

#paginationContainer .pagination {
    margin-bottom: 0;
}

#paginationContainer .page-link {
    transition: all 0.3s ease;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    font-size: 1.05rem;
}

#paginationContainer .page-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#paginationContainer .page-item.active .page-link {
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#paginationInfo {
    font-size: 1rem;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .module-selector-card {
        padding: 2.5rem 2rem;
    }
    
    .module-selector-card h1 {
        font-size: 2rem;
    }
    
    .filters-body {
        padding: 1.5rem;
    }
    
    .filters-footer {
        padding: 1.25rem 1.5rem;
    }
    
    .filters-footer .btn-site {
        width: 100%;
        justify-content: center;
    }
    
    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    #paginationContainer .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Result Card - Mobile Adaptations */
    .result-card {
        flex-direction: column;
        height: auto;
        min-height: unset;
    }
    
    .result-image-wrapper {
        width: 100%;
        height: 140px;
        border-radius: 12px 12px 0 0;
    }
    
    .result-content {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .result-info {
        width: 100%;
    }
    
    .result-title {
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .result-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 3;
    }
    
    .result-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }
    
    .result-meta-item {
        width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .result-meta-item span {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .add-button-wrapper {
        width: 100%;
    }
    
    .btn-add-toggle,
    .in-library-badge {
        width: 100%;
        justify-content: center;
        font-size: 0.85rem;
        padding: 0.625rem 1rem;
    }
    
    .add-dropdown-menu {
        left: 0;
        right: 0;
        bottom: calc(100% + 8px);
    }
}

/* Extra Small Devices (phones in portrait, less than 576px) */
@media (max-width: 575px) {
    .module-selector-card {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }
    
    .module-select {
        padding: 1rem 2.5rem 1rem 1rem;
        font-size: 1rem;
    }
    
    .filters-card {
        border-radius: 16px;
    }
    
    .filters-header {
        padding: 1rem 1rem;
    }
    
    .filters-body {
        padding: 1rem;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-group {
        grid-column: span 1 !important;
    }
    
    .year-range-inputs {
        grid-template-columns: 1fr;
    }
    
    .filters-footer {
        padding: 1rem;
    }
    
    .results-header {
        padding: 1rem;
    }
    
    .results-header h4 {
        font-size: 1.1rem;
    }
    
    .result-card {
        border-radius: 10px;
    }
    
    .result-image-wrapper {
        height: 120px;
        border-radius: 10px 10px 0 0;
    }
    
    .result-content {
        padding: 0.75rem;
    }
    
    .result-title {
        font-size: 0.95rem;
    }
    
    .result-description {
        font-size: 0.75rem;
    }
    
    .result-meta {
        font-size: 0.8rem;
        gap: 0.375rem;
    }
    
    .btn-add-toggle,
    .in-library-badge {
        font-size: 0.8rem;
        padding: 0.5rem 0.875rem;
    }
}
