:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --success-hover: #059669;
    --error-color: #ef4444;
    --error-hover: #dc2626;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --background: #f9fafb;
    --surface: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    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;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 0;
}

.header-content {
    animation: fadeInDown 0.5s ease-out;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.title .icon {
    width: 40px;
    height: 40px;
    color: var(--primary-color);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.5s ease-out;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeInDown 0.3s ease-out;
}

.alert-icon {
    font-size: 1.5rem;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--primary-color);
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--error-color);
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.required {
    color: var(--error-color);
}

.optional {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.9rem;
}

.input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
    background: var(--surface);
}

.input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input:disabled {
    background-color: var(--background);
    cursor: not-allowed;
    opacity: 0.6;
}

.help-text {
    display: block;
    margin-top: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-hover);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-hover);
}

/* Progress */
.progress-container {
    margin-bottom: 24px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-label {
    font-weight: 500;
    color: var(--text-primary);
}

.progress-percentage {
    font-weight: 600;
    color: var(--primary-color);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-info {
    display: block;
    margin-top: 4px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-message {
    padding: 16px;
    background-color: var(--background);
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    color: var(--text-primary);
}

.merging-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background-color: var(--background);
    border-radius: 8px;
    margin-top: 20px;
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success Card */
.success-card {
    text-align: center;
    border: 2px solid var(--success-color);
}

.success-icon {
    width: 64px;
    height: 64px;
    background-color: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 auto 20px;
}

.success-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--success-color);
    margin-bottom: 10px;
}

.success-message {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Error Card */
.error-card {
    text-align: center;
    border: 2px solid var(--error-color);
}

.error-icon {
    width: 64px;
    height: 64px;
    background-color: var(--error-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 auto 20px;
}

.error-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--error-color);
    margin-bottom: 10px;
}

.error-message {
    color: var(--text-secondary);
    background-color: var(--background);
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

/* Info Card */
.info-card {
    background-color: #f0f9ff;
    border-left: 4px solid var(--primary-color);
}

.instructions-list {
    margin-left: 20px;
    margin-bottom: 20px;
}

.instructions-list li {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.note {
    background-color: white;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
}

.note strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 8px;
}

.note ul {
    margin-left: 20px;
}

.note li {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

code {
    background-color: var(--background);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--primary-color);
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 15px;
    }

    .title {
        font-size: 2rem;
    }

    .title .icon {
        width: 32px;
        height: 32px;
    }

    .card {
        padding: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 32px 0;
    color: var(--text-secondary);
    font-weight: 500;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 2px solid var(--border-color);
}

.divider span {
    padding: 0 16px;
    background-color: var(--background);
}

/* Videos List */
.videos-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.video-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background-color: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.video-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.video-item.selected {
    border-color: var(--primary-color);
    background-color: #eff6ff;
}

.video-radio {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.video-info {
    flex: 1;
}

.video-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.video-meta {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.video-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
