:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --text-primary: #333333;
    --text-secondary: #7f8c8d;
    --text-heading: #2c3e50;
    --border-color: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
    --accent: #3498db;
    --success: #27ae60;
    --error: #e74c3c;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-heading: #f0f0f0;
    --border-color: #404040;
    --shadow: rgba(0, 0, 0, 0.3);
    --accent: #5dade2;
    --success: #2ecc71;
    --error: #e74c3c;
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --text-primary: #e0e0e0;
        --text-secondary: #a0a0a0;
        --text-heading: #f0f0f0;
        --border-color: #404040;
        --shadow: rgba(0, 0, 0, 0.3);
        --accent: #5dade2;
        --success: #2ecc71;
        --error: #e74c3c;
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

/* Upload Header with Image and Info */
.upload-header {
    display: flex;
    gap: 25px;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.upload-image {
    flex-shrink: 0;
}

.upload-hero-image {
    width: 120px;
    height: 120px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    object-fit: cover;
    border: 3px solid #D4AF37;
}

.upload-hero-image:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.upload-info {
    flex: 1;
    min-width: 250px;
}

.header-content {
    text-align: center;
    flex: 1;
}

header h1 {
    font-size: 2rem;
    color: var(--text-heading);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.language-switcher {
    display: flex;
    gap: 10px;
}

.lang-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.5rem;
    -webkit-tap-highlight-color: rgba(52, 152, 219, 0.3);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.lang-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.lang-btn.active {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 2px 8px var(--shadow);
}

.lang-btn .fi {
    display: block;
    width: 24px;
    height: 18px;
}

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

.name-input-section {
    margin-bottom: 0;
}

.name-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1.1rem;
}

.name-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.name-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

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

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

#fileInput {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 30px;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-size: 1.2rem;
    font-weight: 500;
    -webkit-tap-highlight-color: rgba(52, 152, 219, 0.3);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
}

.file-label:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.file-label.uploading {
    background: #95a5a6;
    cursor: not-allowed;
}

.file-label svg {
    width: 50px;
    height: 50px;
}

.file-label span {
    font-size: 1.2rem;
    font-weight: 500;
}

.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.preview-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0.9;
}

.upload-btn {
    width: 100%;
    padding: 15px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.3s ease;
}

.upload-btn:hover {
    filter: brightness(0.9);
}

.upload-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.send-btn {
    width: 100%;
    padding: 15px 30px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    -webkit-tap-highlight-color: rgba(39, 174, 96, 0.3);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.send-btn:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.send-btn:active {
    transform: scale(0.98);
}

.send-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

.send-btn.uploading {
    background: #95a5a6;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    display: none;
}

.message.success {
    background: var(--success);
    color: white;
    opacity: 0.9;
}

.message.error {
    background: var(--error);
    color: white;
    opacity: 0.9;
}

.message.info {
    background: var(--accent);
    color: white;
    opacity: 0.9;
}

.instructions {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px var(--shadow);
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
}

.instructions h3 {
    color: var(--text-heading);
    margin-bottom: 15px;
}

.instructions ol {
    margin-left: 20px;
    color: var(--text-primary);
}

.instructions li {
    margin-bottom: 10px;
}

.note {
    margin-top: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}


footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-secondary);
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


.gallery {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px var(--shadow);
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
}

.gallery h2 {
    color: var(--text-heading);
    margin-bottom: 20px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.gallery-item {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    -webkit-tap-highlight-color: rgba(52, 152, 219, 0.3);
    touch-action: manipulation;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.gallery-item video {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #000;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    pointer-events: none;
    z-index: 2;
}

.gallery-item:hover .play-icon {
    background: rgba(0, 0, 0, 0.9);
}


.session-info {
    text-align: center;
    margin-top: 20px;
}

.session-id {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: monospace;
    opacity: 0.7;
}

.gallery-item.not-mine {
    opacity: 0.7;
}

.gallery-item .owner-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    opacity: 0.9;
}

/* Progress bar styles */
.progress-container {
    margin: 20px 0;
}

.upload-progress {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    display: block;
    text-align: center;
    font-weight: bold;
    color: var(--text-primary);
}

/* Video preview styles */
.video-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 8px;
    height: 100%;
}

.video-preview svg {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.video-preview span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    word-break: break-word;
}

.preview-item .file-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 5px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .upload-section,
    .instructions,
    .gallery {
        padding: 20px;
    }
    
    .send-btn {
        min-height: 60px;
        font-size: 1.3rem;
        padding: 18px 30px;
    }
    
    .language-switcher {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    header {
        text-align: center;
    }
    
    .file-label {
        padding: 25px 20px;
        font-size: 1.1rem;
        min-height: 60px;
        /* Better touch target for mobile */
        min-height: 70px;
        border: 2px solid transparent;
    }
    
    .file-label:active {
        border-color: rgba(255, 255, 255, 0.3);
        transform: scale(0.98);
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .gallery-item img,
    .gallery-item video {
        height: 120px;
    }
    
    .gallery-item:active {
        transform: scale(0.95);
    }
    
    .preview-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .preview-item img {
        height: 80px;
    }
    
    .lang-btn {
        padding: 12px 16px;
        font-size: 1.2rem;
        min-height: 50px;
        min-width: 50px;
    }
    
    .lang-btn:active {
        transform: scale(0.95);
    }
    
    /* Upload header mobile optimization */
    .upload-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }
    
    .upload-hero-image {
        width: 100px;
        height: 100px;
        border-radius: 12px;
    }
    
    .upload-info {
        width: 100%;
        min-width: auto;
    }
    
    /* Better modal for mobile */
    .modal {
        padding-top: 20px;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 85vh;
    }
    
    .modal .close {
        font-size: 50px;
        top: 10px;
        right: 25px;
        padding: 10px;
    }
}
/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
}

.modal .close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

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

/* Admin improvements */
.admin-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.admin-stat {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px var(--shadow);
}

.admin-stat h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.admin-stat .value {
    color: var(--accent);
    font-size: 2rem;
    font-weight: bold;
}
