/* =====================================================================
   Trang chủ phong cách Moodle/Edumy (tham chiếu hoccungai.net)
   Áp dụng cho <html data-page="home" data-ui="k12">.
   ===================================================================== */
html[data-page="home"] {
    --mx-bg: #ffffff;
    --mx-soft: #f8fafc;
    --mx-text: #1f2937;
    --mx-muted: #6b7280;
    --mx-border: #e5e7eb;
    --mx-card: #ffffff;
    --mx-primary: #4f46e5;
    --mx-primary-strong: #4338ca;
    --mx-grad: linear-gradient(120deg, #2563eb 0%, #4f46e5 45%, #7c3aed 100%);
    --mx-radius: 20px;
}
html[data-page="home"][data-theme="dark"] {
    --mx-bg: #0e1116;
    --mx-soft: #1b202a;
    --mx-text: #e7eaf0;
    --mx-muted: #98a2b3;
    --mx-border: #262c37;
    --mx-card: #161a21;
}
html[data-page="home"][data-theme],
html[data-page="home"][data-theme] body { background: var(--mx-bg) !important; color: var(--mx-text); }
html[data-page="home"] .k12-main,
html[data-page="home"] #k12-main { padding: 0 0 64px !important; max-width: none; }

.mx-wrap { max-width: 100%; margin: 0; padding: 0 28px; width: 100%; }

/* ---------- Top utility bar ---------- */
.mx-topbar { background: #1f2937; color: #cbd5e1; font-size: 12.5px; }
.mx-topbar .mx-wrap { display: flex; align-items: center; justify-content: space-between; min-height: 40px; gap: 12px; }
.mx-topbar a, .mx-topbar button { color: #e5e7eb; }
.mx-topbar-left { display: flex; align-items: center; gap: 16px; }
.mx-topbar-right { display: flex; align-items: center; gap: 10px; }
.mx-topbar .mx-btn { padding: 5px 12px; font-size: 12.5px; border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08); color: #fff; }
.mx-topbar .mx-btn:hover { background: rgba(255, 255, 255, .18); }
html[data-page="home"] #authFab { display: inline-flex !important; z-index: 58; }
html[data-page="home"] #themeSwitcher { left: 16px !important; right: auto !important; }
/* sessionPanel nằm trong navbar chính (không còn trong topbar) */
html[data-page="home"] .mx-nav-actions #sessionPanel:not(.hidden) { display: inline-flex; align-items: center; gap: 8px; }
html[data-page="home"] .mx-nav-actions #sessionPanel { background: transparent; border: 0; border-radius: 0; padding: 0; }
html[data-page="home"] .mx-nav-row:has(#sessionPanel:not(.hidden)) #navRegisterBtn { display: none !important; }
html[data-page="home"] body:has(#sessionPanel:not(.hidden)) .mx-login-inline { display: none !important; }
.mx-topbar .k12-userchip { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); color: #fff; }
.mx-topbar .k12-user-name span { color: #cbd5e1 !important; }

/* ---------- Navbar ---------- */
.mx-nav { position: sticky; top: 0; z-index: 40; background: var(--mx-card); border-bottom: 1px solid var(--mx-border); }
.mx-nav-row { display: flex; align-items: center; gap: 18px; min-height: 66px; }
.mx-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--mx-text); font-weight: 800; }
.mx-logo { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; overflow: hidden; color: #fff; font-weight: 800; background: var(--mx-grad); }
.mx-logo img { width: 100%; height: 100%; object-fit: contain; }
.mx-brand-name { font-size: 18px; }
.mx-menu { display: flex; align-items: center; gap: 4px; margin-left: 14px; flex-wrap: wrap; min-width: 0; }
.mx-menu a { color: var(--mx-muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.mx-menu a:hover { color: var(--mx-primary); background: var(--mx-soft); }
.mx-nav-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---------- Nút ---------- */
.mx-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: 999px; border: 1px solid var(--mx-border);
    background: var(--mx-card); color: var(--mx-text); font-size: 14px; font-weight: 700;
    cursor: pointer; text-decoration: none; transition: .15s;
}
.mx-btn:hover { border-color: var(--mx-primary); color: var(--mx-primary); }
.mx-btn-primary { background: var(--mx-primary); border-color: var(--mx-primary); color: #fff; box-shadow: 0 10px 24px -12px rgba(79, 70, 229, .8); }
.mx-btn-primary:hover { background: var(--mx-primary-strong); border-color: var(--mx-primary-strong); color: #fff; }
.mx-btn-lg { padding: 14px 26px; font-size: 15px; }

/* ---------- Hero ---------- */
.mx-hero { padding: 26px 28px 0; }
.mx-hero-card {
    max-width: 100%; margin: 0; border-radius: 26px; overflow: hidden; position: relative;
    background: var(--mx-grad); color: #fff; padding: 48px 56px;
}
.mx-hero-inner { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 30px; align-items: center; }
.mx-tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); font-size: 12.5px; font-weight: 700; }
a.mx-tag { text-decoration: none; color: inherit; cursor: pointer; transition: background .15s ease, transform .15s ease; }
a.mx-tag:hover { background: rgba(255, 255, 255, .30); transform: translateY(-1px); }
.mx-hero h1 { font-size: clamp(30px, 4vw, 46px); font-weight: 900; line-height: 1.1; letter-spacing: -.02em; margin: 18px 0 0; }
.mx-hero h1 .hl { background: linear-gradient(90deg, #fde68a, #fca5a5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mx-hero p { margin: 14px 0 0; font-size: 16px; opacity: .94; max-width: 520px; }
.mx-hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.mx-hero .mx-btn-primary { background: #fff; border-color: #fff; color: var(--mx-primary); box-shadow: none; }
.mx-hero .mx-btn-primary:hover { background: #eef2ff; border-color: #eef2ff; color: var(--mx-primary-strong); }
.mx-hero .mx-btn-outline { background: transparent; border-color: rgba(255, 255, 255, .55); color: #fff; }
.mx-hero .mx-btn-outline:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.mx-hero-search { display: flex; align-items: center; gap: 6px; margin-top: 26px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-radius: 16px; padding: 6px 6px 6px 18px; max-width: 520px; }
.mx-hero-search input { flex: 1; min-width: 0; border: 0; outline: none; font-size: 15px; background: transparent; color: #fff; padding: 10px 0; }
.mx-hero-search input::placeholder { color: rgba(255, 255, 255, .82); }
.mx-hero-search button { border: 0; cursor: pointer; background: var(--mx-primary); color: #fff; width: 46px; height: 46px; border-radius: 12px; font-size: 17px; }

.mx-hero-art { position: relative; min-height: 300px; }
.mx-float {
    position: absolute; display: grid; place-items: center; border-radius: 22px; color: #fff;
    font-size: 40px; box-shadow: 0 24px 50px -20px rgba(0, 0, 0, .6);
}
.mx-float.f1 { width: 120px; height: 120px; background: linear-gradient(135deg, #f59e0b, #ef4444); left: 6%; top: 46%; }
.mx-float.f2 { width: 150px; height: 150px; background: linear-gradient(135deg, #6366f1, #8b5cf6); left: 34%; top: 12%; }
.mx-float.f3 { width: 104px; height: 104px; background: linear-gradient(135deg, #06b6d4, #3b82f6); right: 6%; top: 26%; }
.mx-float.f4 { width: 88px; height: 88px; background: linear-gradient(135deg, #10b981, #22c55e); right: 22%; bottom: 4%; font-size: 34px; }

/* ---------- Carousel (hero) ---------- */
.mx-carousel { position: relative; min-height: 300px; }
.mx-slide { display: none; }
.mx-slide.is-active { display: block; animation: mxFade .45s ease; }
@keyframes mxFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.mx-slide h1 { font-size: clamp(28px, 3.4vw, 44px); font-weight: 900; line-height: 1.12; letter-spacing: -.02em; margin: 18px 0 0; }
.mx-carousel-ctrl { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.mx-arrow {
    width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 22px; line-height: 1;
    border: 1px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .12); color: #fff;
    display: grid; place-items: center;
}
.mx-arrow:hover { background: rgba(255, 255, 255, .25); }
.mx-dots { display: flex; gap: 8px; }
.mx-dot { width: 9px; height: 9px; border-radius: 999px; border: 0; cursor: pointer; background: rgba(255, 255, 255, .45); padding: 0; transition: .2s; }
.mx-dot.is-active { width: 26px; background: #fff; }

/* ---------- Dải tính năng ---------- */
.mx-features { padding: 22px 22px 0; }
.mx-features-card { max-width: 1240px; margin: 0 auto; border-radius: 22px; padding: 22px; background: linear-gradient(120deg, #4f46e5, #7c3aed 55%, #2563eb); color: #fff; }
.mx-features-card #homeStats > div { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.mx-features .mx-feat { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 12px 8px; }
.mx-features .mx-feat-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: rgba(255, 255, 255, .18); }
.mx-features .mx-feat b { font-size: 18px; }
.mx-features .mx-feat span { font-size: 12px; opacity: .85; }

/* ---------- Section chung ---------- */
.mx-section { max-width: 100%; margin: 0; padding: 46px 28px 0; }
.mx-head { text-align: center; margin-bottom: 26px; }
.mx-head h2 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 900; letter-spacing: -.02em; }
.mx-head p { color: var(--mx-muted); margin-top: 6px; }
.mx-center { text-align: center; margin-top: 26px; }

/* ---------- Danh mục ---------- */
.mx-cats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.mx-cat { background: var(--mx-card); border: 1px solid var(--mx-border); border-radius: 16px; padding: 18px; cursor: pointer; transition: .15s; }
.mx-cat:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .35); border-color: var(--mx-primary); }
.mx-cat-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; color: #fff; margin-bottom: 12px; }
.mx-cat b { font-size: 15px; }
.mx-cat span { display: block; color: var(--mx-muted); font-size: 12.5px; margin-top: 3px; }

/* ---------- Lưới khoá học (catalog) ---------- */
.mx-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin-bottom: 22px; }
.mx-filters select { background: var(--mx-card); color: var(--mx-text); border: 1px solid var(--mx-border); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }
html[data-page="home"][data-theme] select option { background: var(--mx-card); color: var(--mx-text); }

/* ---------- Đánh giá ---------- */
.mx-quotes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mx-quote { background: var(--mx-card); border: 1px solid var(--mx-border); border-radius: 16px; padding: 22px; }
.mx-quote .stars { color: #f59e0b; letter-spacing: 2px; font-size: 14px; }
.mx-quote p { margin: 10px 0 16px; font-size: 14.5px; line-height: 1.55; }
.mx-quote .who { display: flex; align-items: center; gap: 12px; }
.mx-quote .who .av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; background: var(--mx-grad); }
.mx-quote .who b { display: block; font-size: 14px; }
.mx-quote .who span { font-size: 12.5px; color: var(--mx-muted); }

/* ---------- Giảng viên ---------- */
.mx-teachers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.mx-teacher { background: var(--mx-card); border: 1px solid var(--mx-border); border-radius: 16px; padding: 22px; text-align: center; }
.mx-teacher .av { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 26px; background: var(--mx-grad); }
.mx-teacher b { font-size: 15px; }
.mx-teacher span { display: block; color: var(--mx-muted); font-size: 12.5px; margin-top: 3px; }

/* ---------- Footer ---------- */
.mx-footer { margin-top: 56px; background: #1f2937; color: #cbd5e1; }
.mx-footer .mx-wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; padding-top: 40px; padding-bottom: 30px; }
.mx-footer h4 { color: #fff; font-size: 14px; font-weight: 800; margin-bottom: 12px; text-transform: uppercase; letter-spacing: .04em; }
.mx-footer a { color: #cbd5e1; text-decoration: none; display: block; padding: 5px 0; }
.mx-footer a:hover { color: #fff; }
.mx-footer .mx-copy { border-top: 1px solid rgba(255, 255, 255, .12); text-align: center; padding: 16px; font-size: 12.5px; color: #94a3b8; }

/* ---------- Đồng bộ thẻ do JS sinh ra (featured/shop/catalog) ---------- */
html[data-page="home"] .mx-main-cards > * {
    background: var(--mx-card) !important; border: 1px solid var(--mx-border) !important; border-radius: 16px !important;
}
html[data-page="home"] #siteMenu .text-indigo-200,
html[data-page="home"] #siteMenu .text-indigo-100 { color: var(--mx-muted) !important; }
html[data-page="home"] #siteMenu .hover\:bg-white\/10:hover { background: var(--mx-soft) !important; }
html[data-page="home"] #siteMenu .bg-indigo-600,
html[data-page="home"] #siteMenu .bg-indigo-600\/30 { background: var(--mx-primary) !important; color: #fff !important; }

/* Nút/nhãn nhấn theo màu indigo (thay cho màu thương hiệu cũ) trên trang chủ */
html[data-page="home"][data-theme] .bg-indigo-600,
html[data-page="home"][data-theme] .bg-indigo-500,
html[data-page="home"][data-theme] .hover\:bg-indigo-700:hover,
html[data-page="home"][data-theme] .hover\:bg-indigo-600:hover { background-color: var(--mx-primary) !important; color: #fff !important; }
html[data-page="home"][data-theme] .text-indigo-300,
html[data-page="home"][data-theme] .text-indigo-400 { color: var(--mx-primary) !important; }
html[data-page="home"][data-theme] .border-indigo-400\/40,
html[data-page="home"][data-theme] .hover\:border-indigo-400\/40:hover { border-color: var(--mx-primary) !important; }
html[data-page="home"] .mx-features-card #homeStats .bg-white\/5 {
    background: rgba(255, 255, 255, .10) !important; border-color: rgba(255, 255, 255, .25) !important;
}
html[data-page="home"] .mx-features-card #homeStats * { color: #fff !important; -webkit-text-fill-color: #fff !important; }
html[data-page="home"] .mx-features-card #homeStats .bg-clip-text { background: none !important; color: #fff !important; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .mx-hero-inner { grid-template-columns: minmax(0, 1fr); }
    .mx-hero-art { display: none; }
    .mx-hero-card { padding: 38px 26px; }
    .mx-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mx-quotes { grid-template-columns: minmax(0, 1fr); }
    .mx-teachers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mx-features-card #homeStats > div { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .mx-menu { display: none; }
    .mx-footer .mx-wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
    .mx-cats, .mx-teachers, .mx-features-card #homeStats > div { grid-template-columns: minmax(0, 1fr); }
    .mx-topbar-left { display: none; }
}
/* Ẩn thanh topbar (header > div[1]: tagline + đăng nhập) ở mọi kích thước */
html[data-page="home"] .mx-nav > .mx-topbar { display: none !important; }
/* Mobile: ẩn chip người dùng + nút "Vào học" trong navbar (chỉ giữ Đăng xuất) */
@media (max-width: 640px) {
    html[data-page="home"] .mx-nav-actions #sessionPanel .k12-userchip,
    html[data-page="home"] .mx-nav-actions #sessionPanel #sessionGo { display: none !important; }
}

/* ---------- Thẻ bài giảng AI (bài soạn công khai) ---------- */
.nl-card { display: flex; flex-direction: column; overflow: hidden; cursor: pointer; }
.nl-thumb { position: relative; height: 140px; display: grid; place-items: center; font-size: 44px; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); background-size: cover; background-position: center; }
.nl-badge { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.nl-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nl-title { font-weight: 800; font-size: 15px; line-height: 1.3; }
.nl-meta { color: var(--mx-muted); font-size: 12px; }
.nl-prompt { color: var(--mx-muted); font-size: 12.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nl-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; }
#haModal { position: fixed; inset: 0; z-index: 100; background: rgba(2,6,23,.85); display: none; flex-direction: column; }
#haModal.show { display: flex; }
