:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #94a3b8;
    --border: #e2e8f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 40px 20px;
    color: var(--dark);
}

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

.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.upload-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.upload-area {
    border: 3px dashed var(--border);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--light);
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.upload-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.upload-text h3 {
    font-size: 1.5em;
    color: var(--dark);
    margin-bottom: 10px;
}

.upload-text p {
    color: var(--gray);
    margin-bottom: 20px;
}

.upload-hint {
    font-size: 0.9em;
    color: var(--gray);
    margin-top: 20px;
}

.btn-select {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.btn-select:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.progress-container {
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin-top: 20px;
    display: none;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#progressFileName {
    font-weight: 600;
    color: var(--dark);
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: var(--gray);
    font-size: 0.85em;
    background: var(--border);
    padding: 4px 12px;
    border-radius: 50px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--dark);
    font-size: 0.95em;
    flex-wrap: wrap;
    gap: 10px;
}

.progress-stats {
    display: flex;
    gap: 20px;
    color: var(--gray);
    font-size: 0.9em;
}

.progress-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.progress-stat i {
    font-style: normal;
    color: var(--primary);
}

#uploadSpeed, #timeRemaining {
    font-weight: 600;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.9em;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 50%, var(--primary) 100%);
    background-size: 200% 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    animation: gradientMove 2s linear infinite;
}

@keyframes gradientMove {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

.upload-details {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    color: var(--gray);
    font-size: 0.85em;
}

.btn-cancel {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    width: 100%;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.btn-cancel:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

.result-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    display: none;
    animation: slideIn 0.5s ease;
}

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

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.result-header h2 {
    color: var(--success);
    font-size: 1.3em;
}

.btn-new {
    background: var(--border);
    border: none;
    padding: 8px 20px;
    border-radius: 50px;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-new:hover {
    background: var(--gray);
    color: white;
}

.video-preview {
    width: 100%;
    margin-bottom: 25px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--dark);
}

.video-preview video {
    width: 100%;
    max-height: 400px;
    display: block;
}

.link-container {
    margin-bottom: 20px;
}

.link-label {
    font-size: 0.95em;
    color: var(--gray);
    margin-bottom: 8px;
}

.link-box {
    display: flex;
    gap: 10px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 5px;
}

.link-box input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 15px;
    font-size: 0.95em;
    color: var(--dark);
    outline: none;
}

.btn-copy {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-copy:hover {
    background: var(--primary-dark);
}

.btn-copy-small {
    background: var(--border);
    border: none;
    width: 45px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
}

.btn-copy-small:hover {
    background: var(--gray);
    color: white;
}

.code-sample {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
}

.code-label {
    font-size: 0.95em;
    color: var(--gray);
    margin-bottom: 10px;
}

.code-block {
    background: var(--dark);
    color: #e2e8f0;
    padding: 20px;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    overflow-x: auto;
    margin-bottom: 15px;
}

.code-block span {
    color: var(--success);
    word-break: break-all;
}

.btn-copy-code {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-copy-code:hover {
    background: #7c3aed;
}

.library-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
}

.library-section h2 {
    margin-bottom: 25px;
    color: var(--dark);
    font-size: 1.3em;
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.video-card {
    background: var(--light);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

.video-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 15px;
}

.video-info h4 {
    font-size: 1em;
    margin-bottom: 8px;
    color: var(--dark);
    word-break: break-all;
}

.video-meta {
    font-size: 0.85em;
    color: var(--gray);
    margin-bottom: 15px;
}

.video-actions {
    display: flex;
    gap: 10px;
}

.btn-video {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.btn-use {
    background: var(--primary);
    color: white;
}

.btn-use:hover {
    background: var(--primary-dark);
}

.btn-delete {
    background: var(--danger);
    color: white;
}

.btn-delete:hover {
    background: #dc2626;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray);
    grid-column: 1 / -1;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--dark);
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    animation: slideInRight 0.3s ease;
    z-index: 1000;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    body {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .upload-area {
        padding: 30px 20px;
    }
    
    .link-box {
        flex-direction: column;
    }
    
    .btn-copy {
        width: 100%;
        justify-content: center;
    }
    
    .videos-grid {
        grid-template-columns: 1fr;
    }
    
    .progress-stats {
        flex-direction: column;
        gap: 5px;
    }
}
