:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #10b981;
    --accent-hover: #059669;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border-color: #e2e8f0;
    --ring-color: rgba(37, 99, 235, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Thanh điều hướng tối ưu cho cả PC và Mobile */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.nav-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-links::-webkit-scrollbar {
    display: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 7px 14px;
    border-radius: 999px;
    white-space: nowrap;
    background: #f1f5f9;
    transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a:active {
    background: #dbeafe;
    color: var(--primary);
}

/* Khung nội dung chính */
.container {
    max-width: 820px;
    margin: 28px auto;
    padding: 0 16px;
}

.hero-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #ffffff;
    padding: 40px 28px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.25);
    margin-bottom: 28px;
}

.hero-card h1 {
    font-size: 1.85rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.3;
}

.hero-card p.subtitle {
    color: #dbeafe;
    font-size: 0.98rem;
    margin-bottom: 24px;
}

/* Form nhập link kèm nút Dán & nút Lấy thông tin */
.download-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 680px;
    margin: 0 auto;
    background: #ffffff;
    padding: 6px;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

.input-group {
    display: flex;
    flex: 1 1 260px;
    align-items: center;
    background: #ffffff;
    border-radius: 10px;
    padding-right: 6px;
}

.input-group input[type="text"] {
    flex: 1;
    width: 100%;
    border: none;
    padding: 14px 12px 14px 16px;
    font-size: 16px;
    color: var(--text-main);
    outline: none;
    background: transparent;
}

.btn-paste {
    background: #e2e8f0;
    color: #334155;
    border: none;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.btn-paste:hover,
.btn-paste:active {
    background: #cbd5e1;
}

.btn-submit {
    background: var(--accent);
    color: #ffffff;
    border: none;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-submit:hover {
    background: var(--accent-hover);
}

.btn-submit:active {
    transform: scale(0.98);
}

.btn-submit:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* Thông báo lỗi */
.preview-error {
    flex: 0 0 100%;
    width: 100%;
    margin-top: 8px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-size: 0.88rem;
    line-height: 1.5;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Card xem trước thông tin video & danh sách độ phân giải */
.preview-card {
    flex: 0 0 100%;
    width: 100%;
    margin-top: 10px;
    padding: 18px;
    border-radius: 14px;
    background: #ffffff;
    color: var(--text-main);
    text-align: left;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}

.preview-top {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.preview-thumb-wrap {
    flex: 0 0 220px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    aspect-ratio: 16 / 9;
}

.preview-thumb-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-meta {
    flex: 1;
    min-width: 0;
}

.preview-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
    word-break: break-word;
}

.preview-author {
    margin: 0 0 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
}

.preview-desc {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.5;
    color: #334155;
    max-height: 105px;
    overflow-y: auto;
    padding-right: 4px;
    white-space: pre-line;
    word-break: break-word;
}

.preview-desc::-webkit-scrollbar {
    width: 5px;
}

.preview-desc::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

/* Danh sách độ phân giải + dung lượng + nút tải từng dòng */
.quality-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.quality-title {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-main);
}

.quality-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quality-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #f8fafc;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.quality-row:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.quality-row.is-downloading {
    border-color: var(--primary);
    background: #eff6ff;
}

.quality-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.quality-row-info {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 14px;
    min-width: 0;
}

.q-label {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-main);
}

.q-size {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-muted);
}

.btn-row-download {
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-row-download:hover {
    background: var(--accent-hover);
}

.btn-row-download:active {
    transform: scale(0.97);
}

.btn-row-download:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* Thanh tiến trình % nằm gọn trong ô độ phân giải */
.row-progress {
    width: 100%;
}

.row-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.row-progress-pct {
    color: var(--primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.row-progress-track {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: #dbeafe;
    overflow: hidden;
}

.row-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    transition: width 0.25s ease;
}

/* Khu vực bài viết hướng dẫn SEO */
.seo-article {
    background: var(--bg-card);
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.seo-article h2 {
    font-size: 1.3rem;
    color: var(--text-main);
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f1f5f9;
}

.seo-article h2:first-child {
    margin-top: 0;
}

.seo-article h3 {
    font-size: 1.05rem;
    color: var(--text-main);
    margin: 18px 0 6px;
}

.seo-article p,
.seo-article li {
    color: var(--text-muted);
    margin-bottom: 10px;
    font-size: 0.98rem;
}

.seo-article ol,
.seo-article ul {
    padding-left: 20px;
    margin-bottom: 16px;
}

footer {
    text-align: center;
    padding: 28px 16px;
    color: #94a3b8;
    font-size: 0.85rem;
}

/* Tối ưu riêng cho màn hình điện thoại (dưới 640px) */
@media (max-width: 640px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .nav-links {
        width: 100%;
        padding-bottom: 2px;
    }
    .container {
        margin: 16px auto;
        padding: 0 12px;
    }
    .hero-card {
        padding: 26px 14px;
        border-radius: 14px;
    }
    .hero-card h1 {
        font-size: 1.4rem;
    }
    .hero-card p.subtitle {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    .download-form {
        flex-direction: column;
        background: transparent;
        box-shadow: none;
        padding: 0;
        gap: 10px;
    }
    .input-group {
        flex: none;
        width: 100%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
        border-radius: 12px;
    }
    .btn-submit {
        width: 100%;
        padding: 15px;
        font-size: 1.05rem;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    }
    .preview-card {
        padding: 14px;
        border-radius: 12px;
    }
    .preview-top {
        flex-direction: column;
        gap: 12px;
    }
    .preview-thumb-wrap {
        flex: none;
        width: 100%;
    }
    .seo-article {
        padding: 22px 16px;
        border-radius: 14px;
    }
    .seo-article h2 {
        font-size: 1.18rem;
    }
}

/* Bảng màu nền theo từng nền tảng */
.hero-card.theme-fb {
    background: linear-gradient(135deg, #155dfc 0%, #0866ff 100%);
    box-shadow: 0 10px 25px -5px rgba(8, 102, 255, 0.28);
}
.theme-fb .btn-submit,
.theme-fb .btn-row-download {
    background: #10b981;
}
.theme-fb .btn-submit:hover,
.theme-fb .btn-row-download:hover {
    background: #059669;
}

.hero-card.theme-tt {
    background: linear-gradient(135deg, #111827 0%, #1f2937 55%, #be123c 100%);
    box-shadow: 0 10px 25px -5px rgba(17, 24, 39, 0.32);
}
.theme-tt .btn-submit,
.theme-tt .btn-row-download {
    background: #fe2c55;
}
.theme-tt .btn-submit:hover,
.theme-tt .btn-row-download:hover {
    background: #e11d48;
}

.hero-card.theme-ig {
    background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 55%, #fcb045 100%);
    box-shadow: 0 10px 25px -5px rgba(225, 48, 108, 0.28);
}
.theme-ig .btn-submit,
.theme-ig .btn-row-download {
    background: #111827;
}
.theme-ig .btn-submit:hover,
.theme-ig .btn-row-download:hover {
    background: #1f2937;
}

.hero-card.theme-x {
    background: linear-gradient(135deg, #090d16 0%, #1e293b 100%);
    box-shadow: 0 10px 25px -5px rgba(9, 13, 22, 0.35);
}
.theme-x .btn-submit,
.theme-x .btn-row-download {
    background: #2563eb;
}
.theme-x .btn-submit:hover,
.theme-x .btn-row-download:hover {
    background: #1d4ed8;
}

/* Theme YouTube (.theme-yt) */
.hero-card.theme-yt {
    background: linear-gradient(135deg, #450a0a 0%, #dc2626 55%, #991b1b 100%);
    box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.3);
}
.theme-yt .btn-submit,
.theme-yt .btn-row-download {
    background: #ff0033;
}
.theme-yt .btn-submit:hover,
.theme-yt .btn-row-download:hover {
    background: #cc0029;
}
.theme-yt .quality-row.is-downloading {
    border-color: #ff0033;
    background: #fef2f2;
}
.theme-yt .row-progress-pct {
    color: #dc2626;
}
.theme-yt .row-progress-track {
    background: #fee2e2;
}
.theme-yt .row-progress-fill {
    background: linear-gradient(90deg, #dc2626 0%, #ff0033 100%);
}
.theme-yt .nav-links a.active,
.theme-yt .nav-links .nav-tab.active {
    background: #ff0033;
    color: #ffffff;
}

/* Theme Threads (.theme-tr) */
.hero-card.theme-tr {
    background: linear-gradient(135deg, #09090b 0%, #27272a 55%, #3f3f46 100%);
    box-shadow: 0 10px 25px -5px rgba(24, 24, 27, 0.32);
}
.theme-tr .btn-submit,
.theme-tr .btn-row-download {
    background: #18181b;
}
.theme-tr .btn-submit:hover,
.theme-tr .btn-row-download:hover {
    background: #09090b;
}
.theme-tr .quality-row.is-downloading {
    border-color: #18181b;
    background: #f4f4f5;
}
.theme-tr .row-progress-pct {
    color: #18181b;
}
.theme-tr .row-progress-track {
    background: #e4e4e7;
}
.theme-tr .row-progress-fill {
    background: linear-gradient(90deg, #27272a 0%, #18181b 100%);
}
.theme-tr .nav-links a.active,
.theme-tr .nav-links .nav-tab.active {
    background: #18181b;
    color: #ffffff;
}

.nav-links .nav-tab {
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-links .nav-tab.active {
    background-color: #e11d48;
    color: #ffffff;
    font-weight: 600;
}

.faq-question {
    cursor: pointer;
    user-select: none;
}

.faq-question::after {
    content: " +";
    font-weight: normal;
}

.faq-question.is-open::after {
    content: " −";
}

.faq-answer {
    margin-top: 6px;
}
