:root {
    color-scheme: dark;
    --brand-primary: #0ea5e9;
    --brand-secondary: #38bdf8;
    --page-bg: #030712;
    --page-text: #e2e8f0;
}

html,
body {
    min-height: 100%;
    background: var(--page-bg);
    color: var(--page-text);
    font-family: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Remove unwanted outline/border on headings */
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6,
.display-1,
.display-2,
.display-3,
.display-4,
.display-5,
.display-6 {
    outline: none;
    border: none;
}

h1:focus,
h2:focus,
h3:focus,
h4:focus,
h5:focus,
h6:focus,
.display-1:focus,
.display-2:focus,
.display-3:focus,
.display-4:focus,
.display-5:focus,
.display-6:focus {
    outline: none;
    border: none;
}

.text-secondary {
    color: rgba(226, 232, 240, 0.78) !important;
}

.text-secondary-emphasis {
    color: rgba(226, 232, 240, 0.88) !important;
}

.text-light-emphasis {
    color: rgba(241, 245, 249, 0.9) !important;
}

a {
    color: var(--brand-secondary);
    text-decoration: none;
}

a:hover {
    color: var(--brand-primary);
    text-decoration: underline;
}

/* Remove default purple selection/tap highlight and match brand */
::selection {
    background: rgba(56, 189, 248, 0.28);
    color: #0b1220;
}

::-moz-selection {
    background: rgba(56, 189, 248, 0.28);
    color: #0b1220;
}

/* On touch devices, disable the default purple tap highlight */
* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #22d3ee 100%);
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #14b8a6 100%);
}

.btn-outline-light {
    border-color: rgba(226, 232, 240, 0.25);
    color: var(--page-text);
}

.btn-outline-light:hover {
    background-color: rgba(226, 232, 240, 0.1);
}

.btn-glow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.85rem;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 16px 32px rgba(14, 165, 233, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(14, 165, 233, 0.28);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.85rem;
    border-radius: 999px;
    border: 1px solid rgba(226, 232, 240, 0.28);
    color: var(--page-text);
    background: rgba(15, 23, 42, 0.35);
    font-weight: 600;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.btn-ghost:hover {
    transform: translateY(-2px);
    background: rgba(226, 232, 240, 0.12);
    border-color: rgba(226, 232, 240, 0.4);
}

.btn-ghost.btn-sm {
    padding: 0.5rem 1.6rem 0.5rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge.chip--primary {
    background: rgba(56, 189, 248, 0.18) !important;
    color: #38bdf8 !important;
}

.badge.chip--muted {
    background: rgba(15, 23, 42, 0.7) !important;
    color: rgba(226, 232, 240, 0.82) !important;
}

.badge.chip--warning {
    background: rgba(250, 204, 21, 0.18) !important;
    color: #facc15 !important;
}

.badge.chip--success {
    background: rgba(34, 197, 94, 0.18) !important;
    color: #34d399 !important;
}

.badge.chip--danger {
    background: rgba(248, 113, 113, 0.2) !important;
    color: #f87171 !important;
}

.object-fit-cover {
    object-fit: cover;
}

.blazor-error-boundary {
    background: linear-gradient(135deg, #991b1b, #7f1d1d);
    color: #fee2e2;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
}

.blazor-error-boundary::after {
    content: "Đã xảy ra lỗi.";
}

body.video-modal-open {
    overflow: hidden;
}

.video-modal {
    position: fixed;
    inset: 0;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.video-modal[hidden] {
    display: none !important;
}

.video-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.86);
    backdrop-filter: blur(6px);
    z-index: 1;
}

.video-modal__dialog {
    position: relative;
    background: rgba(3, 7, 18, 0.98);
    border-radius: 0.75rem;
    /* Let JS compute exact width/height to preserve 16:9 ratio within viewport */
    max-width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
    overflow: hidden;
    z-index: 2;
}

.video-modal__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(15, 23, 42, 0.4);
    border-bottom: 1px solid rgba(226, 232, 240, 0.1);
}

.video-modal__body {
    position: relative;
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.video-modal__title {
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 0;
}

.video-modal__player {
    flex: 1;
    background: #000;
    border-radius: 0 0 0.75rem 0.75rem;
    overflow: hidden;
}

.video-modal__player iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.video-modal__close {
    position: relative;
    border: none;
    background: rgba(15, 23, 42, 0.85);
    color: #e2e8f0;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.video-modal__close:hover {
    background: rgba(56, 189, 248, 0.9);
    transform: scale(1.05);
}

@media (max-width: 767.98px) {
    .video-modal {
        padding: 0.75rem;
    }

    .video-modal__dialog {
        border-radius: 0.5rem;
    }

    .video-modal__header {
        padding: 1rem 1.25rem;
    }

    .video-modal__title {
        font-size: 1rem;
    }

    .video-modal__player {
        border-radius: 0 0 0.5rem 0.5rem;
    }

    .video-modal__close {
        width: 2.25rem;
        height: 2.25rem;
        min-width: 2.25rem;
        font-size: 1.1rem;
    }
}

/* Ensure the video carousel is horizontally scrollable on small screens */
.video-carousel {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.25rem;
    /* give space to avoid clipping shadows */
}

.video-carousel .video-card {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

/* Fix trắng lóa khi load backdrop trên mobile */
.detail-hero__backdrop {
    position: absolute;
    inset: 0;
    background: #030712;
    /* fallback màu nền tối */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    z-index: 0;
}

.detail-hero__backdrop.is-ready {
    opacity: 1;
}