/* ==================== RESET & BASE ==================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(22, 22, 35, 0.7);
    --bg-card-hover: rgba(30, 30, 48, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(139, 92, 246, 0.3);
    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #55556a;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.25);
    --accent-2: #6366f1;
    --gradient-1: linear-gradient(135deg, #8b5cf6, #6366f1, #3b82f6);
    --gradient-2: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.25);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ==================== BG EFFECTS ==================== */
.bg-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3), transparent 70%);
    top: -150px;
    left: -100px;
    animation: float1 20s ease-in-out infinite;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.25), transparent 70%);
    bottom: -100px;
    right: -100px;
    animation: float2 25s ease-in-out infinite;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.15), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float3 30s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(80px, 60px); }
    66% { transform: translate(-40px, 80px); }
}

@keyframes float2 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-60px, -40px); }
    66% { transform: translate(40px, -60px); }
}

@keyframes float3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
}

/* ==================== CONTAINER ==================== */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 24px 60px;
    position: relative;
    z-index: 1;
}

/* ==================== HEADER ==================== */
.header {
    margin-bottom: 40px;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.logo-icon {
    width: 56px;
    height: 56px;
    color: var(--accent-light);
    flex-shrink: 0;
    animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {
    0%, 100% { filter: drop-shadow(0 0 8px var(--accent-glow)); }
    50% { filter: drop-shadow(0 0 20px var(--accent-glow)); }
}

.logo h1 {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
    margin-top: 2px;
}

/* ==================== DROP ZONE ==================== */
.drop-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-xl);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    transition: var(--transition);
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.05), transparent 70%);
    opacity: 0;
    transition: var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.05);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
    opacity: 1;
}

.drop-zone-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--accent-light);
    opacity: 0.7;
    transition: var(--transition);
}

.drop-zone:hover .upload-icon {
    opacity: 1;
    transform: translateY(-4px);
}

.drop-zone h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.drop-zone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.supported-formats {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.format-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-light);
    border: 1px solid rgba(139, 92, 246, 0.15);
}

/* ==================== SECTIONS ==================== */
.hidden {
    display: none !important;
}

.video-list-section,
.settings-section,
.merge-section,
.progress-section,
.result-section {
    margin-top: 32px;
    animation: fadeInUp 0.5s ease-out;
}

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

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

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-actions {
    display: flex;
    gap: 8px;
}

.video-count {
    background: var(--accent);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 12px;
    min-width: 22px;
    text-align: center;
}

.drag-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ==================== VIDEO LIST ==================== */
.video-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.video-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: var(--transition);
    user-select: none;
}

.video-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.video-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.video-item.drag-over-item {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.08);
}

.drag-handle {
    color: var(--text-muted);
    cursor: grab;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 4px;
    opacity: 0.5;
    transition: var(--transition);
}

.video-item:hover .drag-handle {
    opacity: 1;
    color: var(--accent-light);
}

.video-thumbnail {
    width: 80px;
    height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-secondary);
    position: relative;
}

.video-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumbnail .thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: var(--transition);
}

.video-thumbnail:hover .thumb-play {
    opacity: 1;
}

.video-info {
    flex: 1;
    min-width: 0;
}

.video-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-meta {
    display: flex;
    gap: 12px;
    margin-top: 3px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.video-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-order {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.video-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.video-remove:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* ==================== SETTINGS ==================== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-group label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.setting-group select,
.setting-group input {
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

.setting-group select:focus,
.setting-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.setting-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--accent-glow), 0 0 48px rgba(139, 92, 246, 0.15);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ==================== MERGE SECTION ==================== */
.merge-section {
    text-align: center;
    padding: 20px 0;
}

.merge-note {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==================== PROGRESS ==================== */
.progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    backdrop-filter: blur(12px);
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.progress-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.progress-detail {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* ==================== RESULT ==================== */
.result-card {
    background: var(--bg-card);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-xl);
    padding: 40px;
    text-align: center;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 60px rgba(16, 185, 129, 0.08);
}

.result-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    color: var(--success);
    animation: successPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.result-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--success), #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-info {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.result-info .info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.result-preview {
    margin: 20px 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: black;
    max-height: 400px;
}

.result-preview video {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================== FOOTER ==================== */
.footer {
    text-align: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .container {
        padding: 24px 16px 40px;
    }

    .logo {
        flex-direction: column;
        gap: 10px;
    }

    .logo-icon {
        width: 44px;
        height: 44px;
    }

    .logo h1 {
        font-size: 1.6rem;
    }

    .drop-zone {
        padding: 40px 24px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .video-item {
        flex-wrap: wrap;
    }

    .video-thumbnail {
        width: 64px;
        height: 40px;
    }

    .btn-lg {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .result-card {
        padding: 28px 20px;
    }
}

/* ==================== SCROLL BAR ==================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== TOAST ==================== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 24px;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    z-index: 100;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.toast-error {
    border-color: rgba(239, 68, 68, 0.3);
}

.toast.toast-success {
    border-color: rgba(16, 185, 129, 0.3);
}
