/* CSS Variables */
:root {
    --primary-color: #005B41;
    --primary-light: #007a58;
    --primary-dark: #003d2e;
    --primary-hover: #007a58;
    --text-primary: #333;
    --text-secondary: #666;
    --body-background: #ffffff;
    --card-background: #ffffff;
    --input-background: #ffffff;
    --border-color: #e0e0e0;
    --card-hover: #f8f9fa;
    --transition: all 0.3s ease;
}

.dark-mode {
    --text-primary: #f8f9fa;
    --text-secondary: #ccc;
    --body-background: #121212;
    --card-background: #1e1e1e;
    --input-background: #2d2d2d;
    --border-color: #333;
    --card-hover: #2a2a2a;
}

/* Browse Prompts Page Styles */
.browse-prompts-container {
    width: 90%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Page Header */
.browse-header {
    text-align: center;
    margin-bottom: 3rem;
}

.browse-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.browse-header p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-info {
    background: var(--card-background);
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: inline-block;
    margin-top: 1rem;
}

.search-info p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Main Browse Content Layout */
.browse-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 3rem;
    align-items: start;
}

/* Desktop Sidebar Filters */
.desktop-sidebar {
    position: sticky;
    top: 2rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.filter-section {
    margin-bottom: 2.5rem;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-section h3 i {
    color: var(--primary-color);
    font-size: 0.9rem;
}

/* Search Filter */
.search-filter {
    display: flex;
    gap: 0.5rem;
}

.search-filter input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--input-background);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-filter input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.search-filter button {
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-filter button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Filter Options */
.category-filter,
.sort-filter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--input-background);
}

.filter-option:hover {
    border-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.05);
}

.filter-option.active {
    border-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

.filter-option input[type="radio"] {
    display: none;
}

.filter-option span {
    font-size: 0.9rem;
}

.filter-option .count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--border-color);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

.filter-option.active .count {
    background: var(--primary-color);
    color: white;
}

/* Filter Actions */
.filter-actions {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.clear-filters-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.clear-filters-btn:hover {
    background: var(--card-hover);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Main Content Area */
.prompts-content {
    min-height: 600px;
}

/* Results Info */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.results-count {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.mobile-filter-toggle {
    display: none;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.mobile-filter-toggle:hover {
    background: var(--primary-hover);
}

.mobile-filter-toggle i {
    margin-right: 0.5rem;
}

/* Prompts Grid */
.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* No Results State */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin: 2rem 0;
}

.no-results-icon {
    font-size: 4rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.no-results p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Pagination */
.browse-pagination {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

.browse-pagination .pagination {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
}

.browse-pagination .pagination li {
    display: flex;
}

.browse-pagination .pagination a,
.browse-pagination .pagination span {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--card-background);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.browse-pagination .pagination a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.browse-pagination .pagination .current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.browse-pagination .pagination .dots {
    border: none;
    background: transparent;
    color: var(--text-secondary);
}

/* Mobile Filter Sidebar */
.mobile-filter-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    display: none; /* Hidden by default */
}

.mobile-filter-sidebar.active {
    transform: translateX(0);
}

.mobile-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mobile-filter-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
    font-weight: 600;
}

.close-mobile-filter {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.close-mobile-filter:hover {
    color: #333;
    background: #f0f0f0;
}

.mobile-filter-content {
    padding: 1.5rem;
    background: #ffffff;
}

.mobile-filter-content .filter-section {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-filter-content .filter-section:last-child {
    margin-bottom: 0;
}

/* Mobile Filter Overlay */
.mobile-filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: none; /* Hidden by default */
}

.mobile-filter-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Search Tips */
.search-tips {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(var(--primary-color), 0.05);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.search-tips small {
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-tips i {
    color: var(--primary-color);
}

/* Search Suggestions */
.search-suggestions {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.search-suggestions h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.search-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-suggestions li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.search-suggestions li:last-child {
    border-bottom: none;
}

.search-suggestions li:before {
    content: "•";
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .browse-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .desktop-sidebar {
        display: none;
    }
    
    .mobile-filter-toggle {
        display: inline-flex;
        align-items: center;
    }
    
    .mobile-filter-sidebar,
    .mobile-filter-overlay {
        display: block;
    }
    
    .prompts-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .browse-prompts-container {
        padding: 1rem 0.5rem;
    }
    
    .browse-header {
        margin-bottom: 2rem;
        text-align: left;
    }
    
    .browse-header h1 {
        font-size: 2rem;
    }
    
    .browse-header p {
        font-size: 1rem;
        text-align: left;
    }
    
    .search-info {
        display: block;
        width: 100%;
        text-align: center;
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .results-info {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .prompts-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .mobile-filter-sidebar {
        width: 100%;
    }
    
    .no-results {
        padding: 2rem 1rem;
    }
    
    .no-results-icon {
        font-size: 3rem;
    }
    
    .browse-pagination .pagination a,
    .browse-pagination .pagination span {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .browse-header h1 {
        font-size: 1.75rem;
    }
    
    .prompts-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.75rem;
    }
    
    .browse-pagination .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .browse-pagination .pagination a,
    .browse-pagination .pagination span {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .mobile-filter-header {
        padding: 1rem;
    }
    
    .mobile-filter-content {
        padding: 1rem;
    }
    
    .mobile-filter-content .filter-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
}

/* Dark Mode Support for Mobile Sidebar */
body.dark-mode .mobile-filter-sidebar {
    background: #121212;
    border-color: #333;
}

body.dark-mode .mobile-filter-header {
    background: #121212;
    border-color: #333;
}

body.dark-mode .mobile-filter-header h3 {
    color: #f8f9fa;
}

body.dark-mode .close-mobile-filter {
    color: #ccc;
}

body.dark-mode .close-mobile-filter:hover {
    color: #f8f9fa;
    background: #2a2a2a;
}

body.dark-mode .mobile-filter-content {
    background: #121212;
}

body.dark-mode .mobile-filter-content .filter-section {
    background: #1e1e1e;
    border-color: #333;
}

/* Animation Classes */
.animate-fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.loading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.loading-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.loading-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.loading-placeholder {
    background: var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.loading-placeholder.title {
    height: 20px;
    width: 80%;
}

.loading-placeholder.meta {
    height: 16px;
    width: 60%;
}

.loading-placeholder.image {
    height: 200px;
    width: 100%;
    margin-bottom: 1rem;
}

/* Smooth transitions for filter changes */
.prompts-grid {
    transition: opacity 0.3s ease;
}

.prompts-grid.filtering {
    opacity: 0.5;
    pointer-events: none;
}

/* Accessibility improvements */
.filter-option:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.search-filter input:focus,
.search-filter button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.clear-filters-btn:focus,
.mobile-filter-toggle:focus,
.close-mobile-filter:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .desktop-sidebar,
    .mobile-filter-toggle,
    .mobile-filter-sidebar,
    .mobile-filter-overlay,
    .browse-pagination {
        display: none;
    }
    
    .browse-content {
        grid-template-columns: 1fr;
    }
    
    .prompts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}