/*
 * ============================================================================
 * BPCVN — Lovable Design System
 * ============================================================================
 * Font: Inter (Google Fonts, Vietnamese subset)
 * Background: #f7f4ed (warm cream)
 * Text: #1c1c1c (charcoal) + opacity-based gray scale
 * Borders: #eceae4 (passive), rgba(28,28,28,0.4) (interactive)
 * ============================================================================
 */

/* ── 0. Font Pixel cục bộ ────────────────────────────────────────────── */
/* Khai báo font Determination từ file .otf trong thư mục fonts */
@font-face {
    font-family: 'Determination';
    src: url('../fonts/SVN-DeterminationSans.otf') format('opentype');
    font-display: swap;
}

/* Utility class dùng font pixel — tắt anti-aliasing để giữ nét sắc, gai góc */
.text-pixel {
    font-family: 'Determination', sans-serif;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: never;
}

/* ── 1. CSS Custom Properties (Design Tokens) ───────────────────────────── */
:root {
    /* Primary */
    --color-cream: #f7f4ed;
    --color-charcoal: #1c1c1c;
    --color-off-white: #fcfbf8;

    /* Neutral Scale (opacity-based) */
    --color-charcoal-83: rgba(28, 28, 28, 0.83);
    --color-charcoal-82: rgba(28, 28, 28, 0.82);
    --color-muted: #5f5f5d;
    --color-charcoal-40: rgba(28, 28, 28, 0.4);
    --color-charcoal-04: rgba(28, 28, 28, 0.04);
    --color-charcoal-03: rgba(28, 28, 28, 0.03);

    /* Surface & Border */
    --border-light: #eceae4;
    --border-interactive: rgba(28, 28, 28, 0.4);

    /* Interactive */
    --ring-blue: rgba(59, 130, 246, 0.5);
    --focus-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;

    /* Inset Shadow (signature button effect) */
    --shadow-inset: rgba(255, 255, 255, 0.2) 0px 0.5px 0px 0px inset,
        rgba(0, 0, 0, 0.2) 0px 0px 0px 0.5px inset,
        rgba(0, 0, 0, 0.05) 0px 1px 2px 0px;

    /* Typography */
    --font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;

    /* Spacing (base 8px) */
    --space-1: 8px;
    --space-1-5: 12px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 40px;
    --space-7: 56px;
    --space-10: 80px;

    /* Border Radius */
    --radius-micro: 4px;
    --radius-standard: 6px;
    --radius-comfortable: 8px;
    --radius-card: 12px;
    --radius-container: 16px;
    --radius-pill: 9999px;
}


/* ── 2. Base / Reset ─────────────────────────────────────────────────────── */
body {
    background-color: var(--color-cream);
    font-family: var(--font-family);
    color: var(--color-charcoal-82);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Sticky footer — đẩy footer xuống đáy khi nội dung ít */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Main content chiếm hết không gian còn lại → footer luôn dính đáy */
main {
    flex: 1 0 auto;
}


/* ── 3. Typography ───────────────────────────────────────────────────────── */

/* Display Hero — 48px trở lên, weight 600, letter-spacing tight */
.text-display {
    font-size: 3rem;
    /* 48px */
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -1.2px;
    color: var(--color-charcoal);
}

/* Section Heading — 36px */
.text-heading {
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.9px;
    color: var(--color-charcoal);
}

/* Sub-heading — 24px */
.text-subheading {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.5px;
    color: var(--color-charcoal);
}

/* Card Title — 20px */
.text-card-title {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.25;
    color: var(--color-charcoal);
}

/* Body Large — 18px */
.text-body-lg {
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.38;
    color: var(--color-muted);
}

/* Body — 16px (default) */
.text-body {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-charcoal-82);
}

/* Caption — 14px */
.text-caption {
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-muted);
}

/* Muted text helper */
.text-warm-muted {
    color: var(--color-muted) !important;
}


/* ── 4. Buttons ──────────────────────────────────────────────────────────── */

/* Primary Dark — CTA chính */
.btn-dark-lovable {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: #fb7aec;
    color: var(--color-off-white);
    padding: 8px 16px;
    border-radius: var(--radius-standard);
    border: none;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-inset);
    transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

.btn-dark-lovable:hover {
    color: var(--color-off-white);
    opacity: 0.9;
    text-decoration: none;
}

.btn-dark-lovable:active {
    opacity: 0.8;
}

.btn-dark-lovable:focus-visible {
    box-shadow: var(--focus-shadow);
    outline: none;
}

/* Ghost / Outline — hành động phụ */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: transparent;
    color: var(--color-charcoal);
    padding: 8px 16px;
    border-radius: var(--radius-standard);
    border: 1px solid var(--border-interactive);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

.btn-ghost:hover {
    color: var(--color-charcoal);
    background-color: var(--color-charcoal-04);
    text-decoration: none;
}

.btn-ghost:active {
    opacity: 0.8;
}

.btn-ghost:focus-visible {
    box-shadow: var(--focus-shadow);
    outline: none;
}

/* Cream Surface — toolbar / tertiary */
.btn-cream {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--color-cream);
    color: var(--color-charcoal);
    padding: 8px 16px;
    border-radius: var(--radius-standard);
    border: 1px solid var(--border-light);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}

.btn-cream:hover {
    color: var(--color-charcoal);
    border-color: var(--border-interactive);
    text-decoration: none;
}

.btn-cream:active {
    opacity: 0.8;
}

/* Pill / Small tag button */
.btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: var(--color-cream);
    color: var(--color-charcoal);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-light);
    font-size: 0.875rem;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}

.btn-pill:hover {
    border-color: var(--border-interactive);
    color: var(--color-charcoal);
    text-decoration: none;
}

.btn-pill:active {
    opacity: 0.8;
}

/* Small variant cho buttons */
.btn-sm-lovable {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Full-width button helper */
.btn-block {
    width: 100%;
}


/* ── 5. Cards & Containers ───────────────────────────────────────────────── */

/* Card chuẩn — border containment, no shadow */
.card-lovable {
    background-color: var(--color-cream);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    overflow: hidden;
    transition: border-color 0.18s ease;
}

.card-lovable:hover {
    border-color: var(--border-interactive);
}

/* Featured card — radius lớn hơn */
.card-featured {
    background-color: var(--color-cream);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-container);
    overflow: hidden;
}

/* Compact card */
.card-compact {
    background-color: var(--color-cream);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-comfortable);
    overflow: hidden;
}

/* Card padding helper */
.card-body-lovable {
    padding: var(--space-3);
}

/* Inner info block (dùng trong Details) */
.info-block {
    background-color: var(--color-charcoal-03);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-comfortable);
    padding: var(--space-1-5) var(--space-2);
}


/* ── 6. Forms & Inputs ───────────────────────────────────────────────────── */

/* Override Bootstrap form controls */
.form-control-lovable,
.form-select-lovable {
    background-color: var(--color-cream);
    color: var(--color-charcoal);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-standard);
    padding: 8px 12px;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control-lovable::placeholder,
.form-select-lovable::placeholder {
    color: var(--color-muted);
}

.form-control-lovable:focus,
.form-select-lovable:focus {
    background-color: var(--color-cream);
    border-color: var(--ring-blue);
    box-shadow: 0 0 0 2px var(--ring-blue);
    outline: none;
    color: var(--color-charcoal);
}

/* Form label */
.form-label-lovable {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-charcoal);
    margin-bottom: 6px;
}

/* Form hint text */
.form-hint {
    font-size: 0.8125rem;
    color: var(--color-muted);
    margin-top: 4px;
}

/* Validation errors */
.field-validation-error,
.text-danger {
    color: #b91c1c !important;
    font-size: 0.8125rem;
}

/* Validation summary */
.validation-summary-lovable {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-standard);
    color: #991b1b;
    padding: 12px 16px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

/* Checkbox styling */
.form-check-lovable .form-check-input {
    border-color: var(--border-interactive);
    border-radius: var(--radius-micro);
}

.form-check-lovable .form-check-input:checked {
    background-color: var(--color-charcoal);
    border-color: var(--color-charcoal);
}


/* ── 7. Navigation ───────────────────────────────────────────────────────── */
.navbar-lovable {
    background-color: var(--color-cream) !important;
    border-bottom: 1px solid var(--border-light);
    padding-top: 12px;
    padding-bottom: 12px;
}

.navbar-lovable .navbar-brand {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--color-charcoal) !important;
    letter-spacing: -0.5px;
}

.navbar-lovable .nav-link {
    font-weight: 400;
    color: var(--color-charcoal) !important;
    border-radius: var(--radius-standard);
    padding: 6px 14px !important;
    font-size: 0.9375rem;
    transition: background-color 0.15s ease;
}

.navbar-lovable .nav-link:hover,
.navbar-lovable .nav-link.active {
    background-color: var(--color-charcoal-04);
    color: var(--color-charcoal) !important;
}

/* Navbar toggler (mobile hamburger) */
.navbar-lovable .navbar-toggler {
    border: 1px solid var(--border-interactive);
    border-radius: var(--radius-standard);
    padding: 6px 10px;
}

/*
 * ── Hover Dropdown trên Desktop (≥992px) ──────────────────────────────────
 * Dùng visibility + opacity + pointer-events thay vì display:none/block
 * Lý do: Bootstrap JS dùng class .show để toggle display, nếu ta dùng
 * display:none thì sẽ bị Bootstrap JS override sau khi user click lần đầu.
 * Dùng visibility/opacity tránh xung đột với cơ chế .show của Bootstrap.
 */
@media all and (min-width: 992px) {

    /* Mặc định: ẩn dropdown bằng visibility (không xung đột Bootstrap JS) */
    .navbar .dropdown>.dropdown-menu {
        display: block !important;
        /* Luôn giữ display:block để hover CSS hoạt động */
        visibility: hidden;
        /* Ẩn về mặt thị giác */
        opacity: 0;
        /* Mờ dần khi ẩn */
        pointer-events: none;
        /* Không cho click khi đang ẩn */
        transform: translateY(4px);
        /* Dịch xuống nhẹ để tạo hiệu ứng trượt */
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
        margin-top: 0 !important;
    }

    /* Hover vào .dropdown => hiện menu con với animation */
    .navbar .dropdown:hover>.dropdown-menu {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    /* Trường hợp Bootstrap JS đã add class .show (do user click) — vẫn hiển thị bình thường */
    .navbar .dropdown>.dropdown-menu.show {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
}

/* Áp dụng riêng cho dropdown Linh Kiện để tự xổ khi di chuột vào (desktop) */
@media all and (min-width: 992px) {
    .hover-dropdown:hover .dropdown-menu {
        display: block;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        margin-top: 0;
    }
}

/* Dropdown menu styling — đồng bộ với Design System */
.navbar-lovable .dropdown-menu {
    border-radius: var(--radius-comfortable);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 6px;
}

.navbar-lovable .dropdown-item {
    border-radius: var(--radius-standard);
    padding: 8px 14px;
    font-size: 0.9375rem;
    transition: background-color 0.12s ease;
}

.navbar-lovable .dropdown-item:hover {
    background-color: var(--color-charcoal-04);
}


/* ── 8. Badges ───────────────────────────────────────────────────────────── */
.badge-warm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: var(--color-charcoal-04);
    color: var(--color-charcoal-83);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    font-size: 0.8125rem;
    font-weight: 400;
}

/* Badge variants */
.badge-warm.badge-kit {
    background-color: rgba(28, 28, 28, 0.06);
    color: var(--color-charcoal);
}

.badge-warm.badge-switch {
    background-color: rgba(28, 28, 28, 0.04);
    color: var(--color-charcoal-83);
}

.badge-warm.badge-type {
    background-color: var(--color-charcoal-03);
    color: var(--color-muted);
}

/* Counter badge nhỏ */
.badge-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: var(--color-charcoal-04);
    color: var(--color-charcoal);
    border-radius: var(--radius-pill);
    padding: 2px 10px;
    font-size: 0.8125rem;
    font-weight: 600;
}


/* ── 9. Toast Notifications ──────────────────────────────────────────────── */
.toast-fixed {
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
}

.toast-lovable {
    background-color: var(--color-cream);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--focus-shadow);
    font-size: 0.9375rem;
    color: var(--color-charcoal);
}

/* Success toast */
.toast-lovable.toast-success {
    border-left: 3px solid #22c55e;
}

.toast-lovable.toast-success .toast-icon {
    color: #22c55e;
}

/* Error toast */
.toast-lovable.toast-error {
    border-left: 3px solid #ef4444;
}

.toast-lovable.toast-error .toast-icon {
    color: #ef4444;
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.toast-close:hover {
    opacity: 1;
}


/* ── 10. Footer ──────────────────────────────────────────────────────────── */
.footer-lovable {
    background-color: var(--color-cream);
    border-top: 1px solid var(--border-light);
    padding: 32px 0;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.875rem;
    flex-shrink: 0;
    /* Không cho footer bị co lại */
}

.footer-lovable strong {
    color: var(--color-charcoal);
    font-weight: 600;
}


/* ── 11. Audio Player Container ──────────────────────────────────────────── */
.audio-container {
    background-color: var(--color-charcoal-03);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-comfortable);
    padding: var(--space-1-5);
}

.audio-container audio {
    width: 100%;
    height: 36px;
}

.audio-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-charcoal);
    margin-bottom: 8px;
}

/* ── 11b. Waveform Audio Player (WaveSurfer.js) ─────────────────────────── */

/* Container chính bao quanh nút Play + Waveform + thời gian */
.waveform-player {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Nút Play/Pause — chỉ hiển thị icon, không khung viền */
.waveform-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--color-charcoal);
    font-size: 1.4rem;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.waveform-play-btn:hover {
    color: #fb7aec;
    transform: scale(1.15);
}

.waveform-play-btn:active {
    transform: scale(0.9);
}

/* Trạng thái đang phát */
.waveform-play-btn.playing {
    color: #fb7aec;
}

.waveform-play-btn.playing:hover {
    color: #f97316;
}

/* Trạng thái disabled (đang loading) */
.waveform-play-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Icon loading xoay tròn */
.waveform-icon-loading {
    animation: waveform-spin 1s linear infinite;
}

@keyframes waveform-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Vùng chứa sóng âm — chiếm hết không gian còn lại */
.waveform {
    flex: 1;
    min-width: 0;
    border-radius: var(--radius-standard);
    overflow: hidden;
    cursor: pointer;
}

/* Hiển thị thời gian (current / duration) */
.waveform-time {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'Inter', monospace;
    color: var(--color-muted);
    white-space: nowrap;
    min-width: 70px;
    justify-content: flex-end;
}

.waveform-time-separator {
    opacity: 0.4;
}

/* ── Waveform Dark Mode ─────────────────────────────────────────────────── */

/* Dark mode: nút Play — icon sáng trên nền tối */
html.dark .waveform-play-btn {
    color: #f0ede6;
}

html.dark .waveform-play-btn:hover {
    color: #fb7aec;
}

html.dark .waveform-play-btn.playing {
    color: #fb7aec;
}

html.dark .waveform-play-btn.playing:hover {
    color: #f97316;
}

/* Upvote button */
.upvote-btn-lovable {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: var(--color-charcoal-04);
    color: var(--color-charcoal);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.upvote-btn-lovable:hover {
    background-color: var(--color-charcoal);
    color: var(--color-off-white);
    border-color: var(--color-charcoal);
}

/* Trạng thái đã upvote */
.upvote-btn-lovable.upvoted {
    background-color: var(--color-charcoal);
    color: var(--color-off-white);
    border-color: var(--color-charcoal);
}


/* ── 12. Avatar ──────────────────────────────────────────────────────────── */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--color-charcoal);
    color: var(--color-off-white);
    font-weight: 600;
    flex-shrink: 0;
}

.avatar-sm {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

.avatar-md {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 1.8rem;
}


/* ── 13. Hero Section ────────────────────────────────────────────────────── */
.hero-section {
    background-color: var(--color-cream);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-container);
    padding: 56px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle warm gradient wash behind hero */
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%,
            rgba(244, 196, 180, 0.12) 0%,
            rgba(196, 181, 253, 0.08) 40%,
            rgba(147, 197, 253, 0.06) 70%,
            transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.hero-section>* {
    position: relative;
    z-index: 1;
}


/* ── 14. Stats Bar ───────────────────────────────────────────────────────── */
.stat-card {
    background-color: var(--color-cream);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    padding: 20px 16px;
    text-align: center;
    transition: border-color 0.18s ease;
}

.stat-card:hover {
    border-color: var(--border-interactive);
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-charcoal);
    letter-spacing: -0.5px;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-muted);
    margin-top: 4px;
}


/* ── 15. Empty State ─────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-muted);
}

.empty-state .empty-icon {
    font-size: 3.5rem;
    opacity: 0.2;
    display: block;
    margin-bottom: 12px;
    color: var(--color-charcoal);
}


/* ── 16. Image Treatment ─────────────────────────────────────────────────── */
.img-lovable {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    object-fit: cover;
}

/* Placeholder khi không có ảnh */
.img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-charcoal-03);
    border-bottom: 1px solid var(--border-light);
    color: var(--color-muted);
    opacity: 0.4;
}

/* Ảnh dạng Card (Index) — lấp đầy khung, không méo, chiều cao đồng đều */
.img-card-cover {
    width: 100%;
    height: 250px;
    object-fit: cover;
    object-position: center;
    border-top-left-radius: var(--radius-card);
    border-top-right-radius: var(--radius-card);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Ảnh trang Details — giữ nguyên tỷ lệ gốc, hiển thị toàn bộ chi tiết */
.img-detail-contain {
    width: 100%;
    max-height: 450px;
    object-fit: contain;
    background-color: #1e1e1e;
    border-radius: var(--radius-comfortable);
}


/* ── 17. Divider ─────────────────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 24px 0;
}


/* ── 18. Links ───────────────────────────────────────────────────────────── */
.link-lovable {
    color: var(--color-charcoal);
    text-decoration: underline;
    transition: opacity 0.15s ease;
}

.link-lovable:hover {
    opacity: 0.7;
    color: var(--color-charcoal);
}

/* Link muted (back links, secondary) */
.link-muted {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s ease;
}

.link-muted:hover {
    color: var(--color-charcoal);
}


/* ── 19. Page Sections ───────────────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-charcoal);
    letter-spacing: -0.3px;
    margin: 0;
}

.section-subtitle {
    color: var(--color-muted);
    font-size: 0.9375rem;
    margin: 0;
}


/* ── 20. Responsive ──────────────────────────────────────────────────────── */

/* Mobile: <768px */
@media (max-width: 767.98px) {
    .hero-section {
        padding: 40px 20px;
    }

    .text-display {
        font-size: 2.25rem;
        letter-spacing: -0.9px;
    }

    .text-heading {
        font-size: 1.75rem;
        letter-spacing: -0.5px;
    }

    .card-body-lovable {
        padding: var(--space-2);
    }

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

/* Tablet: 768–1024px */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .hero-section {
        padding: 48px 24px;
    }
}


/* ── 21. Transition & Animation Helpers ──────────────────────────────────── */
.transition-border {
    transition: border-color 0.18s ease;
}

.transition-all {
    transition: all 0.15s ease;
}

/* Smooth fade-in cho toast */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-fixed .toast-lovable {
    animation: slideInRight 0.3s ease-out;
}


/* ── 22. Bootstrap Overrides ─────────────────────────────────────────────── */

/* Override Bootstrap card defaults */
.card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    background-color: var(--color-cream);
    box-shadow: none;
}

.card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border-interactive);
}

/* Override form-control */
.form-control,
.form-select {
    background-color: var(--color-cream);
    border-color: var(--border-light);
    border-radius: var(--radius-standard);
    color: var(--color-charcoal);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--color-cream);
    border-color: var(--ring-blue);
    box-shadow: 0 0 0 2px var(--ring-blue);
    color: var(--color-charcoal);
}

.form-control::placeholder {
    color: var(--color-muted);
}

/* Override alert */
.alert {
    border-radius: var(--radius-standard);
}

/* Keep Bootstrap grid and utilities functional */
.shadow-sm {
    box-shadow: none !important;
}

/* Container max-width ~1200px */
.container {
    max-width: 1200px;
}


/* ── 23. Navbar Logo Switch — nhấn chuột đổi ảnh mô phỏng switch cơ ────── */

/* Trạng thái bình thường — ảnh hiển thị qua src, CSS chỉ quản lý kích thước */
.navbar-logo-switch {
    height: 34px;
    /* Cùng kích thước với icon bàn phím viền hồng cũ (34px) */
    width: auto;
    cursor: pointer;
    transition: transform 0.08s ease;
}

/* Trạng thái nhấn chuột — áp dụng khi bấm vào cả khu vực chứa logo và chữ BPCVN */
.navbar-brand:active .navbar-logo-switch {
    content: url('/icons/Logo-BPCVN-pressed-removebg.png');
    transform: scale(0.96);
    /* Thu nhẹ mô phỏng cảm giác nhấn */
}


/* ── 24. Dark/Light Mode Toggle Button ───────────────────────────────────── */

/* Nút toggle cố định góc dưới bên phải */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background-color: var(--color-cream);
    color: var(--color-charcoal);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--border-interactive);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Light mode: hiển thị icon mặt trăng, ẩn mặt trời */
.theme-icon-light {
    display: none;
}

.theme-icon-dark {
    display: inline;
}

/* Dark mode: hiển thị icon mặt trời, ẩn mặt trăng */
html.dark .theme-icon-light {
    display: inline;
}

html.dark .theme-icon-dark {
    display: none;
}


/* ── 25. DARK MODE ───────────────────────────────────────────────────────── */
/*
 * Khi <html> có class "dark", toàn bộ trang chuyển sang dark theme.
 * Dùng CSS variables để override — giữ nguyên structure, chỉ đổi màu.
 */
html.dark {
    /* Override CSS Variables cho dark mode */
    --color-cream: #1a1a1e;
    --color-charcoal: #f0ede6;
    --color-off-white: #1a1a1e;

    --color-charcoal-83: rgba(240, 237, 230, 0.83);
    --color-charcoal-82: rgba(240, 237, 230, 0.82);
    --color-muted: #9a9a97;
    --color-charcoal-40: rgba(240, 237, 230, 0.4);
    --color-charcoal-04: rgba(240, 237, 230, 0.04);
    --color-charcoal-03: rgba(240, 237, 230, 0.03);

    --border-light: #2e2e33;
    --border-interactive: rgba(240, 237, 230, 0.25);

    --ring-blue: rgba(96, 165, 250, 0.5);

    --shadow-inset: rgba(255, 255, 255, 0.06) 0px 0.5px 0px 0px inset,
        rgba(255, 255, 255, 0.1) 0px 0px 0px 0.5px inset,
        rgba(0, 0, 0, 0.3) 0px 1px 2px 0px;
}

/* Body dark background */
html.dark body {
    background-color: #141416;
    color: rgba(240, 237, 230, 0.82);
}

/* Navbar dark */
html.dark .navbar-lovable {
    background-color: #1a1a1e !important;
    border-bottom-color: #2e2e33;
}

/* Primary button dark mode — giữ pink nhưng điều chỉnh */
html.dark .btn-dark-lovable {
    background-color: #fb7aec;
    color: #1a1a1e;
}

/* Ghost button dark mode */
html.dark .btn-ghost {
    color: #f0ede6;
    border-color: rgba(240, 237, 230, 0.2);
}

html.dark .btn-ghost:hover {
    color: #f0ede6;
    background-color: rgba(240, 237, 230, 0.06);
}

/* Cream button dark */
html.dark .btn-cream {
    background-color: #1a1a1e;
    color: #f0ede6;
    border-color: #2e2e33;
}

/* Cards dark */
html.dark .card-lovable,
html.dark .card-featured,
html.dark .card-compact,
html.dark .card {
    background-color: #1e1e22;
    border-color: #2e2e33;
}

html.dark .card-lovable:hover,
html.dark .card:hover {
    border-color: rgba(240, 237, 230, 0.2);
}

/* Info blocks dark */
html.dark .info-block {
    background-color: rgba(240, 237, 230, 0.03);
    border-color: #2e2e33;
}

/* Inputs dark */
html.dark .form-control,
html.dark .form-select {
    background-color: #1e1e22;
    border-color: #2e2e33;
    color: #f0ede6;
}

html.dark .form-control:focus,
html.dark .form-select:focus {
    background-color: #1e1e22;
    color: #f0ede6;
}

html.dark .form-control::placeholder {
    color: #6a6a67;
}

/* Audio container dark */
html.dark .audio-container {
    background-color: rgba(240, 237, 230, 0.03);
    border-color: #2e2e33;
}

/* Badges dark */
html.dark .badge-warm {
    background-color: rgba(240, 237, 230, 0.06);
    border-color: #2e2e33;
    color: rgba(240, 237, 230, 0.8);
}

html.dark .badge-count {
    background-color: rgba(240, 237, 230, 0.06);
    color: #f0ede6;
}

/* Upvote button dark */
html.dark .upvote-btn-lovable {
    background-color: rgba(240, 237, 230, 0.06);
    border-color: #2e2e33;
    color: #f0ede6;
}

html.dark .upvote-btn-lovable:hover,
html.dark .upvote-btn-lovable.upvoted {
    background-color: #fb7aec;
    color: #1a1a1e;
    border-color: #fb7aec;
}

/* Avatar dark — giữ contrast */
html.dark .avatar {
    background-color: #fb7aec;
    color: #1a1a1e;
}

/* Logo switch dark — không cần đổi màu vì dùng ảnh PNG */

/* Toast dark */
html.dark .toast-lovable {
    background-color: #1e1e22;
    border-color: #2e2e33;
    color: #f0ede6;
}

/* Footer dark */
html.dark .footer-lovable {
    background-color: #1a1a1e;
    border-top-color: #2e2e33;
    color: #6a6a67;
}

html.dark .footer-lovable strong {
    color: #f0ede6;
}

/* Hero section dark */
html.dark .hero-section {
    background-color: #1e1e22;
    border-color: #2e2e33;
}

html.dark .hero-section::before {
    background: radial-gradient(ellipse at 30% 20%,
            rgba(251, 122, 236, 0.06) 0%,
            rgba(147, 130, 253, 0.04) 40%,
            transparent 70%);
}

/* Stat card dark */
html.dark .stat-card {
    background-color: #1e1e22;
    border-color: #2e2e33;
}

html.dark .stat-card:hover {
    border-color: rgba(240, 237, 230, 0.2);
}

/* Image placeholder dark */
html.dark .img-placeholder {
    background-color: rgba(240, 237, 230, 0.03);
    border-bottom-color: #2e2e33;
}

/* Divider dark */
html.dark .divider {
    border-top-color: #2e2e33;
}

/* Links dark */
html.dark .link-lovable {
    color: #f0ede6;
}

html.dark .link-muted {
    color: #6a6a67;
}

html.dark .link-muted:hover {
    color: #f0ede6;
}

/* Theme toggle button dark */
html.dark .theme-toggle {
    background-color: #2e2e33;
    border-color: #3e3e44;
    color: #fb7aec;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

/* Validation dark */
html.dark .validation-summary-lovable {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Bootstrap override shadows in dark */
html.dark .shadow-sm {
    box-shadow: none !important;
}


/* ── 26. Language Switcher ────────────────────────────────────────────────── */

/* Container — nằm trong navbar, position relative để dropdown mở từ đây */
.lang-switcher {
    position: relative;
    z-index: 100;
}

/* Text label bên cạnh flag (VN / EN) */
.lang-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-charcoal);
}

/* Nút toggle chính — hiển thị flag ngôn ngữ hiện tại */
.lang-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--color-cream);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-charcoal);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.15s ease;
}

.lang-toggle:hover {
    border-color: var(--border-interactive);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Flag text label (VN, GB, EN) */
.lang-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 20px;
    border-radius: 4px;
    background-color: #fb7aec;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Dropdown menu — mở xuống dưới */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background-color: var(--color-cream);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 6px;
    display: none;
    /* ẩn mặc định */
    flex-direction: column;
    gap: 2px;
}

/* Hiển thị dropdown khi có class "show" */
.lang-dropdown.show {
    display: flex;
}

/* Mỗi option trong dropdown */
.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    border-radius: var(--radius-comfortable);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--color-charcoal);
    transition: background-color 0.12s ease;
    text-align: left;
}

.lang-option:hover {
    background-color: var(--color-charcoal-04);
}

/* Dấu check — hiển thị cho ngôn ngữ đang chọn */
.lang-check {
    margin-left: auto;
    color: #fb7aec;
    font-size: 1rem;
    display: none;
    /* JS sẽ toggle */
}


/* ── Language Switcher Dark Mode ─────────────────────────────────────────── */
html.dark .lang-toggle {
    background-color: #2e2e33;
    border-color: #3e3e44;
    color: #f0ede6;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

html.dark .lang-dropdown {
    background-color: #1e1e22;
    border-color: #2e2e33;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

html.dark .lang-option {
    color: #f0ede6;
}

html.dark .lang-option:hover {
    background-color: rgba(240, 237, 230, 0.06);
}

html.dark .lang-label {
    color: #f0ede6;
}

/* Custom Nav Icon for Dropdown */
.custom-nav-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 6px;
    margin-bottom: 2px;
}

/* ── 27. Brand Aura Tràn Viền (Độc quyền BPCVN Fix Cuối Cùng) ────────── */

/* Tuyệt kỹ phá vỡ mọi giới hạn của Bootstrap Container */
.brand-aura-wrapper {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    /* Ép rộng bằng 100% màn hình browser */
    height: 1000px;
    /* Bao phủ khu vực hero ở trên */
    overflow: hidden;
    /* Cắt vệt sáng tràn ra ngoài window, ko gây scroll ngang */
    z-index: 0;
    pointer-events: none;
}

/* Cục switch phát sáng */
.brand-aura-img {
    position: absolute;
    top: 470px;
    /* Đẩy xuống ngang khu vực Hero */
    left: 50%;
    transform: translate(-50%, -50%) scale(3.5);
    filter: blur(10px);
    opacity: 0.6;
}

/* Tẩy trắng cái lồng Hero cũ của template */
.hero-section {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

html.dark .hero-section {
    background-color: transparent !important;
    border: none !important;
}

.hero-section::before {
    display: none !important;
}

/* Tôn Subtitle lên để không bị chìm vào nền kính mờ */
.hero-section .text-body-lg {
    color: var(--color-charcoal) !important;
    opacity: 0.85 !important;
    font-weight: 500 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.2px;
}

/* Đảm bảo khi bật Dark Mode chữ vẫn sáng bừng lên */
html.dark .hero-section .text-body-lg {
    color: #f0ede6 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* ── 28. Custom Scrollbar — Tàng hình bình thường, hiện khi hover ──────── */

/* Kích thước rãnh scrollbar (track) — trong suốt hoàn toàn khi nghỉ */
::-webkit-scrollbar {
    width: 8px;
    background-color: transparent;
}

/* Phần tay cầm scrollbar — cũng trong suốt khi nghỉ */
::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 10px;
    /* Transition để hiệu ứng mượt khi hiện/ẩn */
    transition: background-color 0.3s ease;
}

/* Khi hover vào vùng cuộn (mép phải trang) — tay cầm hiện ra màu xám */
::-webkit-scrollbar-thumb:hover {
    background-color: rgba(150, 150, 150, 0.8);
}

/* Track cũng nhẹ nhàng hiện nền khi hover để user biết vùng tương tác */
::-webkit-scrollbar-track:hover {
    background-color: rgba(150, 150, 150, 0.08);
}

/* ── 29. Game FAB & Modal ─────────────────────────────────────────────────── */

/* ─── Nút FAB (Floating Action Button) mở game ─────────────────────────── */
.game-fab {
    position: fixed;
    bottom: 82px;           /* Nằm ngay trên nút theme-toggle (24px + 48px + 10px gap) */
    right: 24px;
    z-index: 9998;          /* Ngay dưới theme-toggle (9999) */
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    /* Màu hồng brand — đồng bộ với progressColor waveform */
    background: linear-gradient(135deg, #fb7aec, #d946c8);
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(251, 122, 236, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Hover: phóng to nhẹ và tăng glow hồng */
.game-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(251, 122, 236, 0.7);
}

.game-fab:active {
    transform: scale(0.95);
}

/* ─── Overlay nền tối ────────────────────────────────────────────────────── */
.game-overlay {
    display: none;          /* Ẩn mặc định */
    position: fixed;
    inset: 0;               /* Phủ toàn màn hình */
    z-index: 10000;
    background: rgba(0, 0, 0, 0.82);
    /* Backdrop blur để nền mờ đẹp */
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    /* Animation fade-in */
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* Class .active được JS thêm khi mở */
.game-overlay.active {
    display: flex;
    opacity: 1;
}

/* ─── Container chứa game (glassmorphism) ────────────────────────────────── */
.game-container {
    position: relative;
    width: min(960px, 92vw);  /* Tối đa 960px, co lại trên màn nhỏ */
    aspect-ratio: 16 / 9;     /* Tỉ lệ chuẩn 16:9 cho game */
    border-radius: 16px;
    overflow: hidden;
    /* Kính mờ */
    background: rgba(20, 20, 25, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(251, 122, 236, 0.15); /* Viền hồng nhẹ theo brand */
    /* Animation scale-in khi xuất hiện */
    animation: gameContainerIn 0.25s ease forwards;
}

@keyframes gameContainerIn {
    from { transform: scale(0.93); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* ─── Nút X đóng modal ────────────────────────────────────────────────────── */
.game-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10001;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
}

.game-close-btn:hover {
    background: rgba(220, 50, 50, 0.75);
    transform: scale(1.1);
}

/* ─── Iframe game chiếm toàn bộ container ────────────────────────────────── */
.game-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ─── Dark mode: FAB giữ nguyên màu hồng (không cần override) ───────────── */
html.dark .game-fab {
    box-shadow: 0 4px 20px rgba(251, 122, 236, 0.6);
}