:root {
    /* Light theme variables */
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-primary: #333;
    --text-secondary: #666;
    --text-tertiary: #777;
    --bg-primary: white;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --border-color: #ddd;
    --border-light: #eee;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-color-hover: rgba(0, 0, 0, 0.2);
    --code-bg: #f8f9fa;
    --code-color: #e74c3c;
    --error-bg: #fdf2f2;
    --error-color: #e74c3c;
    --modal-bg: rgba(0, 0, 0, 0.8);
    --header-bg: rgba(255, 255, 255, 0.95);
    --footer-bg: rgba(0, 0, 0, 0.2);
    --close-color: #aaa;
    --close-hover: #333;
}

[data-theme="dark"] {
    /* Dark theme variables */
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #909090;
    --bg-primary: #2d2d44;
    --bg-secondary: #3a3a5c;
    --bg-tertiary: #4a4a6a;
    --border-color: #555;
    --border-light: #444;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-color-hover: rgba(0, 0, 0, 0.5);
    --code-bg: #3a3a5c;
    --code-color: #ff6b6b;
    --error-bg: #4a2c2c;
    --error-color: #ff6b6b;
    --modal-bg: rgba(0, 0, 0, 0.9);
    --header-bg: rgba(45, 45, 68, 0.95);
    --footer-bg: rgba(0, 0, 0, 0.4);
    --close-color: #ccc;
    --close-hover: #fff;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-gradient);
    min-height: 100vh;
    transition: color 0.3s ease, background 0.3s ease;
}

header {
    position: relative;
    text-align: center;
    padding: 2rem 1rem;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
    box-shadow: 0 2px 20px var(--shadow-color);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px var(--shadow-color-hover);
}

.theme-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.upload-section {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.upload-section h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.8rem;
    transition: color 0.3s ease;
}

.upload-instructions ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.upload-instructions li {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.upload-instructions code {
    background: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--code-color);
    transition: background 0.3s ease, color 0.3s ease;
}

.gallery-section {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.gallery-section h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    text-align: center;
    transition: color 0.3s ease;
}

.search-bar {
    margin-bottom: 1.5rem;
    text-align: center;
}

.search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, background 0.3s, color 0.3s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.search-bar input:focus {
    border-color: #667eea;
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

.filters {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.filter-btn:hover,
.filter-btn.active {
    background: #667eea;
    color: white;
}

.design-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.design-card {
    background: var(--bg-primary);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    cursor: pointer;
}

.design-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px var(--shadow-color-hover);
}

.design-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-secondary);
    transition: background 0.3s ease;
}

.design-info {
    padding: 1.5rem;
}

.design-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.design-author {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.design-description {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.4;
    transition: color 0.3s ease;
}

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

.design-tag {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    transition: background 0.3s ease, color 0.3s ease;
}

.design-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: border-color 0.3s ease, color 0.3s ease;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    color: white;
    background: var(--footer-bg);
    transition: background 0.3s ease;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg);
    backdrop-filter: blur(5px);
    transition: background-color 0.3s ease;
}

.modal-content {
    background-color: var(--bg-primary);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    transition: background-color 0.3s ease;
    color: var(--text-primary);
}

.close {
    color: var(--close-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

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

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.error {
    text-align: center;
    padding: 2rem;
    color: var(--error-color);
    background: var(--error-bg);
    border-radius: 10px;
    margin: 1rem 0;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .theme-toggle {
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .header-content {
        padding-right: 60px; /* Make room for toggle button */
    }
    
    .design-gallery {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .upload-section,
    .gallery-section {
        padding: 1rem;
    }
    
    .filters {
        justify-content: center;
    }
    
    .filter-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}