:root {
    /* Темна тема (за замовчуванням) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #b8b8d4;
    --accent-purple: #8b5cf6;
    --accent-purple-light: #a78bfa;
    --accent-purple-dark: #6d28d9;
    --border-color: #2d2d44;
    
    /* Світла тема */
    --light-bg-primary: #ffffff;
    --light-bg-secondary: #fff7ed;
    --light-bg-tertiary: #ffedd5;
    --light-text-primary: #1a1a2e;
    --light-text-secondary: #4a4a6e;
    --light-accent-orange: #f97316;
    --light-accent-yellow: #fbbf24;
    --light-border-color: #e5e7eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}

body.light-theme {
    background: linear-gradient(135deg, var(--light-bg-primary) 0%, var(--light-bg-secondary) 50%, var(--light-bg-tertiary) 100%);
    color: var(--light-text-primary);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.logo {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-purple-light) 0%, var(--accent-purple) 50%, var(--accent-purple-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -2px;
}

body.light-theme .logo {
    background: linear-gradient(135deg, var(--light-accent-yellow) 0%, var(--light-accent-orange) 50%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

body.light-theme .tagline {
    color: var(--light-text-secondary);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.upload-section {
    width: 100%;
    max-width: 700px;
    margin-bottom: 4rem;
}

.upload-box {
    border: 3px dashed var(--border-color);
    border-radius: 20px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

body.light-theme .upload-box {
    border-color: var(--light-border-color);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.upload-box:hover {
    border-color: var(--accent-purple);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

body.light-theme .upload-box:hover {
    border-color: var(--light-accent-orange);
    background: rgba(255, 255, 255, 0.95);
}

.upload-box.dragover {
    border-color: var(--accent-purple);
    background: var(--bg-tertiary);
    transform: scale(1.02);
}

body.light-theme .upload-box.dragover {
    border-color: var(--light-accent-orange);
}

.upload-icon {
    color: var(--accent-purple);
    margin-bottom: 1.5rem;
}

body.light-theme .upload-icon {
    color: var(--light-accent-orange);
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

body.light-theme .upload-text {
    color: var(--light-text-primary);
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

body.light-theme .upload-hint {
    color: var(--light-text-secondary);
}

.upload-progress {
    margin-top: 2rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

body.light-theme .progress-bar {
    background: var(--light-border-color);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-purple-light), var(--accent-purple));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

body.light-theme .progress-fill {
    background: linear-gradient(90deg, var(--light-accent-yellow), var(--light-accent-orange));
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

body.light-theme .progress-text {
    color: var(--light-text-secondary);
}

.result-section {
    margin-top: 2rem;
}

.result-box {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

body.light-theme .result-box {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--light-border-color);
}

.result-box h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

body.light-theme .result-box h3 {
    color: var(--light-text-primary);
}

.result-url {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.result-url input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

body.light-theme .result-url input {
    background: var(--light-bg-primary);
    border-color: var(--light-border-color);
    color: var(--light-text-primary);
}

.copy-btn {
    padding: 0.75rem 1.5rem;
    background: var(--accent-purple);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

body.light-theme .copy-btn {
    background: var(--light-accent-orange);
}

.copy-btn:hover {
    background: var(--accent-purple-dark);
    transform: translateY(-1px);
}

body.light-theme .copy-btn:hover {
    background: #ea580c;
}

.copy-btn:active {
    transform: translateY(0);
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background: var(--accent-purple);
    color: white;
}

body.light-theme .btn-primary {
    background: var(--light-accent-orange);
}

.btn-primary:hover {
    background: var(--accent-purple-dark);
    transform: translateY(-1px);
}

body.light-theme .btn-primary:hover {
    background: #ea580c;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

body.light-theme .btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: var(--light-text-primary);
    border-color: var(--light-border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

body.light-theme .btn-secondary:hover {
    background: rgba(255, 255, 255, 1);
}

.error-message {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #fca5a5;
    text-align: center;
}

body.light-theme .error-message {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

body.light-theme footer {
    color: var(--light-text-secondary);
}

/* Галерея */
.gallery-section {
    width: 100%;
    max-width: 1200px;
}

.gallery-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--accent-purple-light) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.light-theme .gallery-title {
    background: linear-gradient(135deg, var(--light-accent-yellow) 0%, var(--light-accent-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.gallery-item {
    display: block;
    text-decoration: none;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
}

body.light-theme .gallery-item {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--light-border-color);
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
    border-color: var(--accent-purple);
}

body.light-theme .gallery-item:hover {
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.3);
    border-color: var(--light-accent-orange);
}

.gallery-item-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

body.light-theme .gallery-item-image {
    background: var(--light-bg-primary);
}

.gallery-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-item-image img {
    transform: scale(1.05);
}

.gallery-item-info {
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.gallery-item-id {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

body.light-theme .gallery-item-id {
    color: var(--light-text-primary);
}

.gallery-item-views {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

body.light-theme .gallery-item-views {
    color: var(--light-text-secondary);
}

.gallery-item-views svg {
    width: 14px;
    height: 14px;
}

/* Адаптивність */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .logo {
        font-size: 2.5rem;
    }
    
    .upload-box {
        padding: 3rem 1.5rem;
    }
    
    .result-url {
        flex-direction: column;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .upload-section {
        margin-bottom: 2rem;
    }
    
    .gallery-section {
        width: 100%;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;
    }
    
    .gallery-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
}

