:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #475569;
    --success: #10b981;
    --error: #ef4444;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
}

/* Tabs */
.tabs {
    background-color: var(--surface);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.tabs .container {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 20px;
}

.tab-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    background-color: var(--surface-light);
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--primary-color);
    background-color: var(--surface-light);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem 20px;
}

.loading {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:disabled {
    background-color: var(--surface-light);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.page-info {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1rem;
}

.page-numbers {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.page-btn {
    background-color: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    border-radius: calc(var(--radius) / 2);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 40px;
}

.page-btn:hover {
    background-color: var(--surface-light);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

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

.page-ellipsis {
    color: var(--text-muted);
    padding: 0 0.25rem;
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.item-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.item-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.item-card .author {
    color: var(--primary-color);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.item-card .short-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-card .icon {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: calc(var(--radius) / 2);
    margin-bottom: 1rem;
    background-color: var(--surface-light);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--surface);
    margin: 2% auto;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: var(--text-muted);
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--text-primary);
}

.modal-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.modal-header h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.modal-header .author {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.modal-icon {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    background-color: var(--surface-light);
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section h3 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
}

.modal-section p,
.modal-section pre {
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.modal-section code {
    background-color: var(--surface-light);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

/* Markdown content in modals */
.modal-section .markdown-content {
    color: var(--text-secondary);
    line-height: 1.8;
}

.modal-section .markdown-content h1,
.modal-section .markdown-content h2,
.modal-section .markdown-content h3 {
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.modal-section .markdown-content h1 {
    font-size: 1.5rem;
}

.modal-section .markdown-content h2 {
    font-size: 1.3rem;
}

.modal-section .markdown-content h3 {
    font-size: 1.1rem;
}

.modal-section .markdown-content p {
    margin-bottom: 1rem;
}

.modal-section .markdown-content ul,
.modal-section .markdown-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.modal-section .markdown-content li {
    margin-bottom: 0.5rem;
}

.modal-section .markdown-content code {
    background-color: var(--background);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.modal-section .markdown-content pre {
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.modal-section .markdown-content pre code {
    background: none;
    padding: 0;
}

.modal-section .markdown-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.modal-section .markdown-content a:hover {
    text-decoration: underline;
}

.modal-section .markdown-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-muted);
    font-style: italic;
}

.modal-section .markdown-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Screenshots Gallery */
.screenshots-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.screenshot-thumb {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: calc(var(--radius) / 2);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border);
}

.screenshot-thumb:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 3rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    transition: color 0.3s ease;
}

.lightbox-close:hover {
    color: var(--primary-color);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    font-size: 3rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2001;
    border-radius: var(--radius);
}

.lightbox-nav:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--primary-color);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    z-index: 2001;
}

/* Download Buttons */
.download-btn {
    display: inline-block;
    background-color: var(--success);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    margin-top: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.download-btn:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.download-btn-small {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius) / 2);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-left: 1rem;
}

.download-btn-small:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--surface-light);
    border-radius: calc(var(--radius) / 2);
    margin-bottom: 0.75rem;
}

.file-item p {
    margin: 0;
    flex: 1;
}

/* Footer */
footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    margin-top: auto;
}

/* Responsive */
@media (max-width: 1400px) {
    .items-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .items-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .items-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 1.5rem;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .page-numbers {
        order: 3;
        width: 100%;
    }
}

/* Documentation */
.docs-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    margin: 2rem 0;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.docs-content h1 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.docs-content h2 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.docs-content h3 {
    color: var(--text-secondary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.docs-content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.docs-content ul, .docs-content ol {
    margin-bottom: 1rem;
    margin-left: 2rem;
    color: var(--text-secondary);
}

.docs-content li {
    margin-bottom: 0.5rem;
}

.docs-content pre {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.docs-content code {
    background: var(--background);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--primary-color);
}

.docs-content pre code {
    background: none;
    padding: 0;
    color: var(--text-secondary);
}

.docs-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.docs-content a:hover {
    text-decoration: underline;
}

.docs-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-muted);
    font-style: italic;
}

.docs-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

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

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

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

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