/* ==========================================================
   Performance CSS - Trắc Nghiệm Tin Học
   Tối ưu Core Web Vitals (LCP, CLS, FID)
   ========================================================== */

/* --- Font Display Optimization --- */
@font-face {
    font-display: swap !important;
}

/* --- Lazy Image Placeholder (Reduce CLS) --- */
img[loading="lazy"] {
    background-color: #f1f5f9;
    transition: opacity 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Content Visibility for Below-Fold Content --- */
.ad-zone,
.ad-wrapper,
.footer-ad-wrapper,
.ad-wing {
    content-visibility: auto;
    contain-intrinsic-size: auto 250px;
}

footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 400px;
}

/* --- Reduce Layout Shift for AdSense --- */
ins.adsbygoogle {
    min-height: 50px;
}

.ad-leaderboard {
    min-height: 90px;
}

/* --- Smooth Scroll --- */
html {
    scroll-behavior: smooth;
}

/* --- Reduce Motion for Accessibility --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Print Styles --- */
@media print {
    .ad-zone, .ad-wrapper, .ad-wing, .footer-ad-wrapper,
    .ad-leaderboard, ins.adsbygoogle,
    nav.navbar, footer,
    .dropdown, #fcm_modal {
        display: none !important;
    }
    body {
        background: white !important;
        color: black !important;
    }
    .container {
        max-width: 100% !important;
    }
}

/* --- Focus Visible for Accessibility --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* --- Touch Target Size for Mobile (min 44x44px) --- */
@media (max-width: 768px) {
    .navbar-nav > li > a,
    .dropdown-menu > li > a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* --- Skeleton Loading for Dynamic Content --- */
.skeleton-loading {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

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