/* ============================================
   Down-Videos — Professional Video Downloader PWA
   Mobile-first responsive design
   ============================================ */

/* --- CSS Variables (Light Theme) --- */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --bg-hover: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #dbeafe;
    --success: #10b981;
    --danger: #ef4444;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: 0.2s ease;

    /* Timeline */
    --timeline-track: #e2e8f0;
    --timeline-selected: #3b82f6;
    --timeline-marker: #1d4ed8;
    --timeline-marker-hover: #1e40af;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --bg-hover: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-light: #1e3a5f;
    --border: #334155;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    --timeline-track: #334155;
    --timeline-selected: #60a5fa;
    --timeline-marker: #3b82f6;
    --timeline-marker-hover: #2563eb;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100dvh;
    transition: background var(--transition), color var(--transition);
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
}

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    border-radius: 6px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent);
}
.btn-outline:hover {
    background: var(--accent-light);
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    padding: 24px 0;
}

.hidden { display: none !important; }

/* --- URL Section --- */
.url-section {
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color var(--transition);
    outline: none;
}
.input-group input:focus {
    border-color: var(--accent);
}
.input-group input::placeholder {
    color: var(--text-muted);
}

/* --- Video Info Card --- */
.video-info {
    animation: slideUp 0.3s ease;
}

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

.info-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.thumbnail {
    width: 160px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    flex-shrink: 0;
}

.info-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.info-details h2 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.info-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.meta-item {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- Video Preview Player --- */
.video-preview {
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
}

.preview-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.preview-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    object-fit: contain;
    background: #000;
}

.preview-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.preview-fallback img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-no-player {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #94a3b8;
    font-size: 0.7rem;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.preview-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}
.preview-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.preview-btn-sm {
    width: 32px;
    height: 32px;
    font-size: 0.7rem;
    font-weight: 800;
    gap: 1px;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}
.preview-btn-sm:hover {
    border-color: var(--accent);
}

.preview-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 38px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.preview-seek-bar {
    flex: 1;
    display: flex;
    align-items: center;
}

.preview-seek-bar input[type="range"] {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--timeline-track);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.preview-seek-bar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.preview-seek-bar input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* --- Timeline Section --- */
.timeline-section {
    margin-bottom: 24px;
}

.section-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.timeline-container {
    padding: 8px 0;
}

/* Timeline Slider Component */
.timeline-wrapper {
    position: relative;
    padding: 24px 14px 8px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.timeline-track {
    position: relative;
    height: 6px;
    background: var(--timeline-track);
    border-radius: 3px;
    cursor: pointer;
}

.timeline-selected {
    position: absolute;
    top: 0;
    height: 100%;
    background: var(--timeline-selected);
    border-radius: 3px;
    pointer-events: none;
}

/* Triangle markers */
.timeline-marker {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    cursor: grab;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    touch-action: none;
}

.timeline-marker:active {
    cursor: grabbing;
}

.marker-triangle {
    width: 0;
    height: 0;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-top: 15px solid var(--timeline-marker);
    transition: border-top-color var(--transition);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.timeline-marker:hover .marker-triangle,
.timeline-marker:active .marker-triangle {
    border-top-color: var(--timeline-marker-hover);
}

.timeline-marker.start .marker-triangle {
    border-top-color: #10b981;
}
.timeline-marker.start:hover .marker-triangle,
.timeline-marker.start:active .marker-triangle {
    border-top-color: #059669;
}

.timeline-marker.end .marker-triangle {
    border-top-color: #ef4444;
}
.timeline-marker.end:hover .marker-triangle,
.timeline-marker.end:active .marker-triangle {
    border-top-color: #dc2626;
}

.marker-time {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.duration-selected {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.85rem;
}

/* --- Format Selection --- */
.format-section {
    margin-bottom: 24px;
}

.radio-group {
    display: flex;
    gap: 12px;
}

.radio-card {
    flex: 1;
    cursor: pointer;
}

.radio-card input {
    display: none;
}

.radio-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    text-align: center;
}

.radio-body span {
    font-weight: 700;
    font-size: 0.95rem;
}

.radio-body small {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.radio-body svg {
    color: var(--text-secondary);
}

.radio-card input:checked + .radio-body {
    border-color: var(--accent);
    background: var(--accent-light);
}

.radio-card input:checked + .radio-body svg {
    color: var(--accent);
}

.radio-card:hover .radio-body {
    border-color: var(--accent);
}

/* --- Download Button --- */
.btn-download {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-download:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-download:active:not(:disabled) {
    transform: translateY(0);
}

.btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* --- Progress Bar --- */
.progress-section {
    margin-top: 16px;
    animation: slideUp 0.3s ease;
}

.progress-bar {
    height: 8px;
    background: var(--timeline-track);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 4px;
    transition: width 0.3s ease;
}

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

#progress-percent {
    font-weight: 700;
    color: var(--accent);
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    animation: toastIn 0.3s ease;
}

.toast.success {
    background: #10b981;
    color: #fff;
}
.toast.error {
    background: #ef4444;
    color: #fff;
}
.toast.info {
    background: var(--accent);
    color: #fff;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- Footer --- */
.app-footer {
    padding: 16px 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* --- Renewal Banner --- */
.renewal-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 200;
    animation: bannerSlide 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.renewal-banner.renewal-hiding {
    animation: bannerSlideOut 0.3s ease forwards;
}

.renewal-icon { font-size: 1.2rem; }
.renewal-text { flex: 1; }

.renewal-action {
    padding: 5px 14px;
    background: #fff;
    color: #d97706;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: opacity 0.2s;
}
.renewal-action:hover { opacity: 0.85; }

.renewal-dismiss {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
}
.renewal-dismiss:hover { color: #fff; }

@keyframes bannerSlide {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}
@keyframes bannerSlideOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-100%); opacity: 0; }
}

/* --- Responsive --- */
@media (max-width: 480px) {
    #app {
        padding: 0 12px;
    }

    .info-card {
        flex-direction: column;
    }

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

    .input-group {
        flex-direction: column;
    }

    .input-group .btn {
        width: 100%;
    }
}

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* --- Skeleton Loading --- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* ============================================
   Platforms Bar
   ============================================ */
.platforms-section {
    margin-bottom: 20px;
}

.platforms-label {
    margin-bottom: 8px;
}

.platforms-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.platforms-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding: 4px 0;
    scrollbar-width: none;
}
.platforms-scroll::-webkit-scrollbar { display: none; }

.platform-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
}

.platform-icon svg {
    width: 22px;
    height: 22px;
}

.platform-icon:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.platform-config-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.platform-config-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================
   Platforms Config Modal
   ============================================ */
.pf-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    animation: fadeIn 0.2s ease;
    padding: 16px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pf-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
}

.pf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.pf-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.pf-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition);
}
.pf-modal-close:hover {
    background: var(--danger);
    color: #fff;
}

.pf-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    margin-top: 12px;
}

.pf-selected-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.pf-selected-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

.pf-item-icon svg {
    width: 18px;
    height: 18px;
}

.pf-item-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
}

.pf-badge {
    margin-left: 6px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--accent-light);
    color: var(--accent);
    padding: 1px 5px;
    border-radius: var(--radius-full);
}

.pf-move-btn, .pf-remove-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-input);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.7rem;
    transition: all var(--transition);
}
.pf-move-btn:hover { background: var(--accent-light); color: var(--accent); }
.pf-move-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.pf-remove-btn:hover { background: #fee2e2; color: var(--danger); }
[data-theme="dark"] .pf-remove-btn:hover { background: #3b1111; }

.pf-available-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.pf-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
}
.pf-add-btn svg {
    width: 14px;
    height: 14px;
}
.pf-add-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.pf-custom-form {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pf-input {
    flex: 1;
    min-width: 100px;
    padding: 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: border-color var(--transition);
}
.pf-input:focus { border-color: var(--accent); }
.pf-input::placeholder { color: var(--text-muted); }

.pf-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 8px;
    text-align: center;
}

/* ============================================
   Ad Interstitial Overlay
   ============================================ */
.ad-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 16px;
}

.ad-overlay.ad-visible {
    opacity: 1;
}

.ad-overlay.ad-closing {
    opacity: 0;
}

.ad-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
}

.ad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.ad-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.ad-countdown {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.ad-slot-wrapper {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ad-slot {
    width: 100%;
    min-height: 200px;
}

.ad-footer {
    text-align: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ad-footer strong {
    color: var(--accent);
    font-size: 1.1rem;
}

/* During-download ad variant */
.ad-during .ad-during-container {
    border: 2px solid var(--accent);
}

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

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

/* ============================================
   Down-Videos Pro — Subscription UI
   ============================================ */

/* Pro Button (header) */
.pro-btn {
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    border: 2px solid #f59e0b;
    border-radius: var(--radius-full);
    background: transparent;
    color: #f59e0b;
    cursor: pointer;
    transition: all var(--transition);
}
.pro-btn:hover {
    background: #f59e0b;
    color: #fff;
}
.pro-btn.pro-active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border-color: #d97706;
}

/* Pro Badge (next to title) */
.pro-badge {
    display: none;
    align-items: center;
    gap: 3px;
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    vertical-align: middle;
}

/* Danger button */
.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-danger:hover { opacity: 0.85; }

/* Pro Modal Overlay */
.pro-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 16px;
}
.pro-modal-overlay.pro-visible {
    opacity: 1;
}

/* Pro Modal */
.pro-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 24px;
    animation: slideUp 0.3s ease;
}

.pro-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.pro-modal-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
}

.pro-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition);
}
.pro-modal-close:hover {
    background: var(--danger);
    color: #fff;
}

/* Pitch section */
.pro-pitch {
    text-align: center;
    padding: 12px 0 20px;
}
.pro-crown {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
}
.pro-pitch p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 280px;
    margin: 0 auto;
    line-height: 1.4;
}

/* Plans grid */
.pro-plans {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.pro-plan-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 12px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}
.pro-plan-card:hover {
    border-color: #f59e0b;
    background: var(--bg-secondary);
}

.pro-plan-highlight {
    border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245,158,11,0.06), rgba(217,119,6,0.06));
}

.pro-plan-badge {
    position: absolute;
    top: -9px;
    right: 12px;
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.pro-plan-name {
    font-size: 0.95rem;
    font-weight: 700;
    grid-column: 1;
    grid-row: 1;
}

.pro-plan-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    grid-column: 2;
    grid-row: 1;
    text-align: right;
}

.pro-plan-period {
    font-size: 0.7rem;
    color: var(--text-muted);
    grid-column: 2;
    grid-row: 2;
    text-align: right;
}

.pro-plan-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    grid-column: 1;
    grid-row: 2;
}

/* Footer note */
.pro-footer-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    padding-top: 4px;
}

/* Active subscription info */
.pro-active-info {
    text-align: center;
    padding: 16px 0;
}
.pro-status-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}
.pro-active-info h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--success);
}
.pro-active-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.pro-benefit {
    color: var(--success) !important;
    font-weight: 600;
    margin: 12px 0 16px !important;
}

/* Ad upsell banner inside ad interstitial */
.ad-upsell {
    text-align: center;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
}
.ad-upsell-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1.5px solid #f59e0b;
    border-radius: var(--radius-full);
    background: transparent;
    color: #f59e0b;
    cursor: pointer;
    transition: all var(--transition);
}
.ad-upsell-btn:hover {
    background: #f59e0b;
    color: #fff;
}

/* ============================================
   Video Browser — Swipe Feed
   ============================================ */
.browser-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 600;
    display: flex;
    flex-direction: column;
    animation: browserSlideIn 0.25s ease;
}

@keyframes browserSlideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.browser-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 2;
}

.browser-back {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
}
.browser-back:hover { background: var(--bg-hover); }

.browser-platform-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.browser-search-wrap {
    flex: 1;
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.browser-search {
    flex: 1;
    height: 36px;
    padding: 0 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    min-width: 0;
}
.browser-search:focus { border-color: var(--accent); }

.browser-search-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-full);
    cursor: pointer;
    flex-shrink: 0;
}

.browser-body {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.browser-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    z-index: 3;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.browser-cards {
    position: relative;
    width: 100%;
    height: 100%;
}

.browser-card {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
}

.browser-card-overlay {
    background: linear-gradient(transparent 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.85) 100%);
    padding: 24px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.browser-card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.browser-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.browser-card-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.7);
}

.browser-card-uploader { font-weight: 600; color: rgba(255,255,255,0.9); }

.browser-card-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.browser-card-download:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

.browser-card-counter {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(4px);
}

.browser-nav {
    padding: 10px 16px;
    text-align: center;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.browser-swipe-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.browser-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
}

/* Save location indicator */
.save-location {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.save-location svg { flex-shrink: 0; }

.save-location-path {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   Language Selector
   ============================================ */
.lang-selector {
    position: relative;
    display: inline-flex;
}

.lang-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 20px;
    line-height: 1;
}

.lang-btn:hover {
    background: var(--bg-hover);
}

.lang-dropdown {
    position: absolute;
    top: 48px;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.lang-dropdown.lang-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition);
}

.lang-option:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.lang-option:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.lang-option:hover {
    background: var(--bg-hover);
}

.lang-option.lang-active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.lang-flag {
    font-size: 18px;
    line-height: 1;
}

.lang-name {
    flex: 1;
    text-align: left;
}
