/* Theme ISAO */
:root {
    --bg: #0B0E14;
    --surface: #121826;
    --surface-light: #1a2332;
    --text: #E6EAF2;
    --muted: #A8B2C1;
    --primary: #6A5ACD;
    --primary-hover: #5a4ec0;
    --secondary: #00D1B2;
    --secondary-hover: #00b39b;
    --glow: #7DF9FF;
    --success: #22C55E;
    --warning: #F59E0B;
    --error: #F43F5E;
    --border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(18, 24, 38, 0.7);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo img {
    height: 36px;
    width: auto;
}

.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(106, 90, 205, 0.2);
}

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

.search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--muted);
    pointer-events: none;
}

/* Main Layout */
.main {
    display: flex;
    padding-top: 76px;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 340px;
    position: fixed;
    top: 76px;
    left: 0;
    bottom: 0;
    padding: 1.5rem;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

.categories {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.category-btn:hover {
    background: var(--surface-light);
}

.category-btn.active {
    background: linear-gradient(135deg, var(--primary), #8B7CF7);
    box-shadow: 0 0 20px rgba(106, 90, 205, 0.3);
}

.category-icon {
    font-size: 1.25rem;
    width: 28px;
    text-align: center;
}

.category-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--muted);
}

.category-btn.active .category-count {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text);
}

/* Hierarchical Categories */
.category-group {
    margin-bottom: 0.25rem;
}

.category-parent {
    position: relative;
}

.category-expand {
    font-size: 0.7rem;
    width: 16px;
    color: var(--muted);
    transition: transform 0.2s ease;
}

.category-parent:hover .category-expand {
    color: var(--text);
}

.subcategories {
    margin-left: 1.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border);
}

.subcategory-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.subcategory-btn .category-name {
    color: var(--muted);
}

.subcategory-btn:hover .category-name,
.subcategory-btn.active .category-name {
    color: var(--text);
}

.subcategory-btn .category-count {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
}

/* Content */
.content {
    flex: 1;
    margin-left: 340px;
    padding: 2rem;
}

.content-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.content-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

.prompt-count {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Prompts Grid */
.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* Prompt Card */
.prompt-card {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.prompt-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 0 24px rgba(125, 249, 255, 0.15);
}

.prompt-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.prompt-card-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.prompt-card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
}

.prompt-card-subcategory {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

.prompt-card-preview {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prompt-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.tag {
    padding: 0.25rem 0.5rem;
    background: rgba(106, 90, 205, 0.15);
    border-radius: 999px;
    font-size: 0.7rem;
    color: var(--primary);
    border: 1px solid rgba(106, 90, 205, 0.3);
}

.votes {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--warning);
    font-size: 0.85rem;
    font-weight: 500;
}

.votes svg {
    width: 14px;
    height: 14px;
}

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

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-right: 2.5rem;
}

.modal-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: var(--radius);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-subcategory {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.prompt-text-container {
    position: relative;
}

.prompt-text {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 350px;
    overflow-y: auto;
    color: var(--text);
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

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

.copy-btn svg {
    width: 16px;
    height: 16px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.modal-votes {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warning);
    font-weight: 600;
}

.modal-votes svg {
    width: 20px;
    height: 20px;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.menu-toggle:hover {
    background: var(--surface-light);
    border-color: var(--primary);
}

.menu-toggle svg {
    width: 20px;
    height: 20px;
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 140;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 1100px) {
    .menu-toggle {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: -340px;
        transition: left 0.3s ease;
        z-index: 150;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .sidebar.open {
        left: 0;
    }

    .content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 1rem;
        gap: 0.75rem;
    }

    .logo img {
        height: 28px;
    }

    .search-input {
        font-size: 0.9rem;
        padding: 0.625rem 0.875rem 0.625rem 2.5rem;
    }

    .content {
        padding: 1.25rem;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .content-header h1 {
        font-size: 1.5rem;
    }

    .prompts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .prompt-card {
        padding: 1rem;
    }

    .modal {
        padding: 1rem;
    }

    .modal-content {
        padding: 1rem;
        max-height: 90vh;
    }

    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .modal-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    .prompt-text {
        font-size: 0.8rem;
        padding: 1rem;
        max-height: 280px;
    }

    .copy-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0.75rem;
    }

    .menu-toggle {
        width: 36px;
        height: 36px;
    }

    .logo img {
        height: 24px;
    }

    .search-input {
        font-size: 0.85rem;
    }

    .content {
        padding: 1rem;
    }

    .content-header h1 {
        font-size: 1.25rem;
    }

    .sidebar {
        width: 85vw;
        max-width: 320px;
        left: -85vw;
    }

    .prompt-card-title {
        font-size: 0.95rem;
    }

    .prompt-card-preview {
        font-size: 0.8rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* Skeleton Loading */
.skeleton-card {
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    height: 180px;
    position: relative;
    overflow: hidden;
}

.skeleton-card::before {
    content: '';
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    width: 40px;
    height: 40px;
    background: var(--surface);
    border-radius: var(--radius-sm);
}

.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

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

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

.prompts-grid .prompt-card:nth-child(1) { animation-delay: 0.05s; }
.prompts-grid .prompt-card:nth-child(2) { animation-delay: 0.1s; }
.prompts-grid .prompt-card:nth-child(3) { animation-delay: 0.15s; }
.prompts-grid .prompt-card:nth-child(4) { animation-delay: 0.2s; }
.prompts-grid .prompt-card:nth-child(5) { animation-delay: 0.25s; }
.prompts-grid .prompt-card:nth-child(6) { animation-delay: 0.3s; }
