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

:root {
    /* Professional Color Palette - Dark Teal/Blue Theme */
    --primary: #0891b2;
    --primary-dark: #0e7490;
    --primary-light: #22d3ee;
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.4);

    /* Backgrounds */
    --background: #0a0f1a;
    --background-secondary: #0f172a;
    --surface: rgba(15, 23, 42, 0.8);
    --surface-solid: #0f172a;
    --surface-light: rgba(30, 41, 59, 0.8);
    --surface-border: rgba(51, 65, 85, 0.5);

    /* Text */
    --text: #f1f5f9;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;

    /* Status Colors */
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --error: #ef4444;
    --error-glow: rgba(239, 68, 68, 0.3);
    --warning: #f59e0b;

    /* Gradients */
    --gradient: linear-gradient(135deg, #0891b2 0%, #06b6d4 50%, #22d3ee 100%);
    --gradient-surface: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(6, 182, 212, 0.2);
}

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

/* Animated Background */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(8, 145, 178, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(8, 145, 178, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* Subtle grid pattern overlay */
.background-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(51, 65, 85, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(51, 65, 85, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
header {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.logo-icon {
    width: 52px;
    height: 52px;
    color: var(--accent);
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

.logo h1 {
    font-size: 2.75rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.tagline {
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 400;
}

/* ===== Tab Navigation ===== */
.tab-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0.5rem;
    border-radius: 16px;
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-md);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.9rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    font-weight: 500;
}

.tab-btn svg,
.tab-btn i {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--surface-light);
}

.tab-btn.active {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* ===== Tab Content ===== */
.tab-content {
    display: none;
    animation: fadeSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content.active {
    display: block;
}

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

/* Alias for backwards compatibility */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Main Content ===== */
main {
    flex: 1;
}

/* ===== Input Section ===== */
.input-section {
    margin-bottom: 2rem;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
}

.url-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg), 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.input-icon {
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    margin-left: 1rem;
    flex-shrink: 0;
}

#url-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 1rem;
    padding: 1rem;
}

#url-input::placeholder {
    color: var(--text-muted);
}

.fetch-button {
    background: var(--gradient);
    border: none;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fetch-button:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.fetch-button:active {
    transform: scale(0.98);
}

.fetch-button svg,
.fetch-button i {
    width: 22px;
    height: 22px;
    color: white;
    stroke-width: 2.5;
}

/* ===== Video Preview ===== */
.video-preview {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
}

.preview-content {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.thumbnail {
    width: 200px;
    height: 112px;
    object-fit: cover;
    border-radius: 12px;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.video-info {
    flex: 1;
}

.video-info h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: var(--text);
}

.channel-name {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.video-stats {
    display: flex;
    gap: 1.5rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat svg,
.stat i {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* ===== Format Section ===== */
.format-section {
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.format-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text);
    font-weight: 600;
}

.format-categories {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.format-category h3 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 500;
}

.format-category h3 svg,
.format-category h3 i {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    color: var(--accent);
}

.format-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.format-btn {
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 1.15rem 1rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.format-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.format-btn.selected {
    border-color: var(--primary);
    background: rgba(8, 145, 178, 0.1);
    box-shadow: 0 0 20px rgba(8, 145, 178, 0.15);
}

.format-name {
    display: block;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.format-desc {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== Batch Section ===== */
.batch-section,
.file-section {
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.batch-section h2,
.file-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0.3rem;
    text-align: center;
    font-weight: 600;
}

.batch-description,
.file-description {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.textarea-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

#batch-urls {
    width: 100%;
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 1rem;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 150px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#batch-urls:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

#batch-urls::placeholder {
    color: var(--text-muted);
}

.url-counter {
    position: absolute;
    bottom: 0.75rem;
    right: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.batch-format-section {
    margin-bottom: 1.5rem;
}

.batch-format-section h3 {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 500;
}

.batch-format-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
}

.batch-format-btn {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 0.7rem 1.4rem;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.batch-format-btn:hover {
    border-color: var(--primary);
}

.batch-format-btn.selected {
    background: var(--gradient);
    border-color: transparent;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.primary-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-button:hover {
    transform: scale(1.01);
    box-shadow: 0 6px 25px var(--accent-glow);
}

.primary-button:active {
    transform: scale(0.99);
}

.primary-button svg,
.primary-button i {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
}

/* ===== File Upload Section ===== */
.upload-area {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px dashed var(--surface-border);
    border-radius: 12px;
    padding: 1.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 1rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(8, 145, 178, 0.05);
    box-shadow: 0 0 30px rgba(8, 145, 178, 0.1);
}

.upload-area svg,
.upload-area i {
    width: 32px;
    height: 32px;
    color: var(--accent);
    margin-bottom: 0.5rem;
    stroke-width: 1.5;
}

.upload-area p {
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.supported-formats {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.file-preview {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.file-info-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-info-header svg,
.file-info-header i {
    width: 18px;
    height: 18px;
    color: var(--accent);
    stroke-width: 2;
    flex-shrink: 0;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-info svg,
.file-info i {
    width: 18px;
    height: 18px;
    color: var(--accent);
    stroke-width: 2;
}

#file-name {
    flex: 1;
    color: var(--text);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remove-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    transition: color 0.3s ease;
    line-height: 1;
}

.remove-btn:hover {
    color: var(--error);
}

/* File Details / Bitrate Info - Compact horizontal layout */
.file-details {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--surface-border);
}

.file-stats-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.output-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    background: var(--surface-light);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    flex: 1;
    min-width: 70px;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

/* Output Info Section */
.output-info {
    background: var(--surface-light);
    border-radius: 10px;
    padding: 0.75rem;
    margin: 0.75rem 0 1rem;
    text-align: left;
}

.output-info h4 {
    font-size: 0.8rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.output-info h4::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: var(--gradient);
    border-radius: 2px;
}

.file-format-section {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 1rem;
}

.file-format-section h3 {
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.75rem;
    text-align: center;
    font-weight: 600;
}

.file-format-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.format-group h4 {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.file-format-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.file-format-btn {
    background: var(--surface-light);
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-format-btn:hover {
    border-color: var(--primary);
}

.file-format-btn.selected {
    background: var(--gradient);
    border-color: transparent;
}

/* File Convert Button */
.file-convert-btn {
    margin-top: 1rem;
}

.file-convert-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ===== Progress Section ===== */
.progress-section {
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-content {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.progress-icon {
    margin-bottom: 1.5rem;
}

.spinner {
    width: 56px;
    height: 56px;
    color: var(--accent);
    animation: spin 1s linear infinite;
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

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

.progress-content h3 {
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.progress-bar-container {
    background: var(--surface-light);
    border-radius: 10px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: var(--gradient);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--accent-glow);
}

.progress-percent {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.progress-detail {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ===== Download Section ===== */
.download-section {
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.download-content {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.success-icon {
    margin-bottom: 1.5rem;
}

.success-icon svg,
.success-icon i {
    width: 60px;
    height: 60px;
    color: var(--success);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 15px var(--success-glow));
}

.download-content h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.download-content p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.download-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 1rem;
}

.download-button:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 25px var(--accent-glow);
}

.download-button:active {
    transform: scale(0.98);
}

.download-button svg,
.download-button i {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
}

.secondary-button {
    display: block;
    margin: 0 auto;
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: color 0.25s ease;
}

.secondary-button:hover {
    color: var(--text);
}

/* Call-to-action button (red/orange) */
.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.9rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 1rem;
}

.action-button:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4);
}

.action-button:active {
    transform: scale(0.98);
}

.action-button i {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* ===== Error Section ===== */
.error-section {
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.error-content {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.error-icon {
    margin-bottom: 1.5rem;
}

.error-icon svg,
.error-icon i {
    width: 60px;
    height: 60px;
    color: var(--error);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 15px var(--error-glow));
}

.error-content h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.error-content p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 2.5rem 0 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--surface-border);
    margin-top: 3rem;
}

footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.heart {
    color: var(--error);
}

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

/* ===== Animations ===== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for loading states */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }

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

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

    .preview-content {
        flex-direction: column;
    }

    .thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }

    .file-format-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

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

    .tagline {
        font-size: 0.95rem;
    }

    .tab-nav {
        flex-direction: column;
    }

    .tab-btn {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }

    .video-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .format-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .batch-format-buttons {
        gap: 0.5rem;
    }

    .batch-format-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Selection Styling ===== */
::selection {
    background: rgba(8, 145, 178, 0.3);
    color: var(--text);
}

/* ===== TikTok Maker Section ===== */
.tiktok-section {
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.tiktok-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0.3rem;
    text-align: center;
    font-weight: 600;
}

.tiktok-description {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.tiktok-upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tiktok-upload-box {
    position: relative;
}

.tiktok-upload {
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tiktok-file-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

.tiktok-file-preview svg,
.tiktok-file-preview i {
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex-shrink: 0;
}

.tiktok-file-preview span {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.duration-badge {
    background: var(--primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0 !important;
    flex: none !important;
}

.image-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.tiktok-settings {
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.tiktok-settings h3 {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 1rem;
    font-weight: 600;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.setting-item label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.time-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.time-input-wrapper input {
    background: var(--surface-light);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    width: 100%;
}

.time-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
}

.time-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.duration-slider-container {
    margin-top: 0.5rem;
}

.duration-slider-container > label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
    margin-bottom: 0.75rem;
}

.duration-slider-wrapper {
    position: relative;
    height: 8px;
    margin: 0 8px;
}

.range-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    transform: translateY(-50%);
}

.range-fill {
    position: absolute;
    top: 50%;
    height: 6px;
    background: var(--gradient);
    border-radius: 3px;
    transform: translateY(-50%);
    left: 0%;
    right: 90%;
}

.dual-range {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
}

.dual-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    border: 2px solid white;
}

.dual-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    border: 2px solid white;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Audio Preview Controls */
.audio-preview-container {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--surface-border);
}

.audio-preview-container > label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
    margin-bottom: 0.75rem;
}

.audio-preview-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--surface-light);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

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

.preview-btn svg,
.preview-btn i {
    width: 16px;
    height: 16px;
}

.preview-progress {
    flex: 1;
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
}

.preview-progress-fill {
    height: 100%;
    background: var(--gradient);
    width: 0%;
    transition: width 0.1s linear;
}

.preview-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.tiktok-create-btn {
    margin-top: 0;
}

.tiktok-create-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

@media (max-width: 640px) {
    .tiktok-upload-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Trim Section Styles
   ============================================ */

.trim-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--surface-border);
}

.trim-section h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.trim-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.trim-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-light);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.toggle-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-border);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--gradient);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

/* Trim Controls */
.trim-controls {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--surface-border);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.trim-controls .settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.trim-controls .duration-slider-container {
    margin-top: 0;
}

.trim-controls .range-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.duration-label {
    font-weight: 600;
    color: var(--primary);
    background: var(--surface-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

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

    .trim-section {
        padding: 1.25rem;
    }
}
