/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #4f46e5;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
    min-height: 100vh;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Styles */
.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.subtitle {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.stats-header {
    text-align: right;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Main Content Layout */
.main-content {
    padding: 2rem 0 4rem;
}

.content-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Sidebar Styles */
.sidebar {
    position: sticky;
    top: 120px;
}

.filter-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.filter-section h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* Search Input */
.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--gray-600);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Select Dropdown */
.filter-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-name {
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* Category Pills */
.category-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.category-pill {
    padding: 0.375rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 9999px;
    background: white;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

.category-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Prompts Container */
.prompts-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Prompt Card */
.prompt-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
    overflow: hidden;
}

.prompt-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.prompt-card.favorite {
    border-left: 4px solid var(--warning-color);
    background: linear-gradient(to right, rgba(245, 158, 11, 0.03) 0%, transparent 200px);
}

.prompt-card.expanded {
    box-shadow: var(--shadow-lg);
}

.prompt-header {
    padding: 1.5rem;
}

.prompt-header-top {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.prompt-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.prompt-purpose {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.5;
}

.prompt-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.favorite-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-400);
}

.favorite-btn:hover {
    background: var(--warning-color);
    color: white;
}

.favorite-btn.active {
    background: var(--warning-color);
    color: white;
}

.expand-icon {
    width: 24px;
    height: 24px;
    color: var(--gray-400);
    transition: transform 0.3s;
}

.prompt-card.expanded .expand-icon {
    transform: rotate(90deg);
}

/* Tags */
.prompt-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag.category {
    background: var(--primary-color);
    color: white;
}


.tag.tool {
    background: #ede9fe;
    color: #5b21b6;
}

/* Prompt Meta */
.prompt-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Expanded Content */
.prompt-content {
    border-top: 1px solid var(--gray-200);
    padding: 1.5rem;
    display: none;
}

.prompt-card.expanded .prompt-content {
    display: block;
}

.content-section {
    margin-bottom: 2rem;
}

.content-section:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.copy-btn {
    padding: 0.375rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--primary-dark);
}

.copy-btn.copied {
    background: var(--success-color);
}

.prompt-text {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--gray-800);
}

.variables-list, .tips-list {
    list-style: none;
}

.variables-list li, .tips-list li {
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.variable-name {
    font-family: 'Courier New', monospace;
    background: var(--gray-100);
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    margin-right: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-900);
}

.tips-list li::before {
    content: "💡";
    margin-right: 0.5rem;
}

.tag-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag-item {
    padding: 0.25rem 0.75rem;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: var(--radius);
    font-size: 0.75rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.empty-state svg {
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

/* Favorites Section */
.favorites-section {
    background: var(--warning-color-light, #FEF3C7);
    border: 1px solid var(--warning-color-border, #F59E0B);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.favorites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.favorites-header label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.favorites-header svg {
    color: var(--warning-color);
}

.favorites-badge {
    background: var(--warning-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
}

.favorites-toggle-btn {
    width: 100%;
    padding: 0.625rem 1rem;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.favorites-toggle-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.favorites-toggle-btn.active {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.favorites-toggle-btn svg {
    width: 18px;
    height: 18px;
}

/* Tag Filters */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 8px 0;
    user-select: none;
}

.collapsible-header label {
    cursor: pointer;
    margin-bottom: 0;
}

.collapsible-header:hover .toggle-arrow {
    opacity: 0.8;
}

.toggle-arrow {
    transition: transform 0.3s ease;
    color: var(--gray-600);
}

.toggle-arrow.rotated {
    transform: rotate(-180deg);
}

.tag-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
    transition: all 0.3s ease;
    opacity: 1;
}

.tag-filters.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0;
}

.tag-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-filter-item:hover {
    background: var(--gray-100);
}

.tag-filter-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.tag-filter-item label {
    cursor: pointer;
    flex: 1;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin: 0;
}

.tag-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-200);
    padding: 2px 8px;
    border-radius: 12px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    width: 48px;
    height: 48px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    background: var(--gray-50);
    box-shadow: var(--shadow-md);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
    color: var(--gray-700);
}

/* Mobile Backdrop */
.mobile-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-backdrop.active {
    display: block;
    opacity: 1;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
}

.footer p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.footer-help {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--gray-900);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    /* Mobile Sidebar */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 320px;
        height: 100vh;
        background: white;
        z-index: 1000;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .filter-section {
        padding: 1.5rem;
        padding-top: 80px;
        margin-bottom: 0;
    }
    
    .filter-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .stats-header {
        text-align: center;
    }
    
    .category-pills {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .prompt-meta {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}

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

.prompt-card {
    animation: fadeIn 0.3s ease-out;
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Virtual Scrolling Styles */
.loading-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.loading-more .spinner {
    width: 24px;
    height: 24px;
}

.end-message {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 500;
}