:root {
    --primary: #38bdf8;
    --primary-dark: #0284c7;
    --primary-soft: #e0f2fe;
    --secondary: #7dd3fc;
    --bg: #f7fbff;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #dbeafe;
    --navbar-bg: rgba(255, 255, 255, .96);
    --footer-bg: #eef8ff;
    --footer-text: #475569;
}

body.dark {
    --primary: #38bdf8;
    --primary-dark: #0ea5e9;
    --primary-soft: #0c4a6e;
    --bg: #07111f;
    --card: #0f1d2e;
    --text: #e6f4ff;
    --muted: #94a3b8;
    --border: #1e3a54;
    --navbar-bg: rgba(15, 29, 46, .96);
    --footer-bg: #0b1828;
    --footer-text: #cbd5e1;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    transition: background-color .2s ease, color .2s ease;
}

/* โครงสร้าง 3 แถวทำให้ Footer อยู่ขอบล่างจริง แม้หน้าเว็บมีข้อมูลน้อย */
.site-body {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.site-main {
    width: 100%;
    min-width: 0;
}

.site-main > .container {
    min-height: 100%;
}

.site-navbar {
    background: var(--navbar-bg) !important;
    border-color: var(--border) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 18px rgba(14, 165, 233, .08);
}

.site-brand {
    display: inline-flex;
    align-items: center;
    margin-right: 2rem;
    padding: .25rem 0;
}

.site-logo {
    width: 190px;
    height: 48px;
    object-fit: contain;
    object-position: left center;
}

.nav-link {
    color: var(--text);
    font-weight: 600;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--primary-dark);
}

.navbar-search {
    width: min(100%, 320px);
}

.navbar-search .input-group-text,
.navbar-search .form-control {
    background: var(--card);
    color: var(--text);
    border-color: var(--border);
}

.navbar-search .form-control:focus {
    box-shadow: 0 0 0 .2rem rgba(56, 189, 248, .16);
    border-color: var(--primary);
}

.icon-btn {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
}

.hero {
    background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 55%, #0ea5e9 100%);
    color: #082f49;
    border-radius: 24px;
    padding: 64px 40px;
    box-shadow: 0 18px 50px rgba(14, 165, 233, .18);
}

.course-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(14, 165, 233, .08);
    height: 100%;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(14, 165, 233, .15);
}

.course-card img {
    height: 190px;
    object-fit: cover;
}

.price {
    font-weight: 800;
    font-size: 1.25rem;
}

.sidebar,
.stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.sidebar { padding: 16px; }
.stat { padding: 22px; box-shadow: 0 8px 20px rgba(14, 165, 233, .07); }

.btn-primary {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-primary:hover,
.btn-primary:focus {
    background: #0369a1;
    border-color: #0369a1;
}

.btn-outline-primary {
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #fff;
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.text-bg-primary {
    background-color: var(--primary-dark) !important;
}

.badge-free {
    background: #dcfce7;
    color: #166534;
}

.lesson-player {
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 18px;
    overflow: hidden;
}

.lesson-player iframe,
.lesson-player video { width: 100%; height: 100%; }

.site-footer {
    width: 100%;
    background: var(--footer-bg);
    color: var(--footer-text);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 30px rgba(14, 165, 233, .05);
}

.footer-logo {
    width: 180px;
    height: 44px;
    object-fit: contain;
    object-position: left center;
}

.footer-description {
    max-width: 480px;
    color: var(--footer-text);
    line-height: 1.7;
}

.footer-title {
    color: var(--text);
    font-weight: 800;
    margin-bottom: .75rem;
}

.footer-links li + li { margin-top: .45rem; }

.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    transition: color .2s ease, transform .2s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--primary-dark);
    transform: translateX(3px);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .9rem;
}

.empty-state {
    background: var(--card);
    border: 1px dashed #93c5fd;
    border-radius: 20px;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--primary-dark);
    background: var(--primary-soft);
    font-size: 1.8rem;
}

body.dark .navbar-toggler { border-color: var(--border); }
body.dark .navbar-toggler-icon { filter: invert(1); }
body.dark .form-control,
body.dark .form-select,
body.dark .input-group-text {
    background-color: var(--card);
    color: var(--text);
    border-color: var(--border);
}
body.dark .text-muted, body.dark small { color: var(--muted) !important; }
body.dark .site-footer .footer-logo { filter: brightness(0) invert(1); }

@media (max-width: 991.98px) {
    .site-brand { margin-right: 0; }
    .navbar-collapse { padding: 1rem 0 .5rem; }
    .navbar-search, .navbar-actions { width: 100%; }
}

@media (max-width: 575.98px) {
    .site-logo, .footer-logo { width: 155px; height: 40px; }
    .hero { padding: 38px 24px; border-radius: 18px; }
    .hero .display-4 { font-size: 2.1rem; }
}

/* ===== Homepage 2026 redesign ===== */
.home-hero {
    position: relative;
    border: 1px solid rgba(14, 165, 233, .14);
    border-radius: 32px;
    padding: 72px 58px;
    background:
        radial-gradient(circle at 90% 10%, rgba(125, 211, 252, .45), transparent 32%),
        radial-gradient(circle at 15% 95%, rgba(186, 230, 253, .72), transparent 30%),
        linear-gradient(135deg, #f8fdff 0%, #eef9ff 52%, #e0f2fe 100%);
    box-shadow: 0 28px 70px rgba(2, 132, 199, .13);
}
.home-hero::before,
.home-hero::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    filter: blur(2px);
    pointer-events: none;
}
.home-hero::before { width: 220px; height: 220px; right: -70px; top: -85px; background: rgba(56, 189, 248, .18); }
.home-hero::after { width: 150px; height: 150px; left: -55px; bottom: -75px; background: rgba(14, 165, 233, .12); }
.hero-eyebrow,
.section-kicker {
    display: inline-flex;
    align-items: center;
    color: #0369a1;
    font-size: .88rem;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.hero-title {
    margin: 0;
    color: #0f172a;
    font-size: clamp(2.7rem, 5vw, 4.7rem);
    line-height: 1.08;
    letter-spacing: -.045em;
    font-weight: 900;
}
.hero-title span {
    background: linear-gradient(90deg, #0284c7, #38bdf8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-copy { max-width: 650px; color: #475569; font-size: 1.08rem; line-height: 1.85; }
.hero-search {
    max-width: 610px;
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 8px 8px 20px;
    background: rgba(255, 255, 255, .97);
    border: 1px solid #bae6fd;
    border-radius: 18px;
    box-shadow: 0 16px 38px rgba(2, 132, 199, .12);
}
.hero-search > i { color: #0284c7; font-size: 1.1rem; }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #0f172a; font-size: 1rem; }
.hero-search button { border: 0; border-radius: 13px; padding: 13px 20px; background: #0284c7; color: #fff; font-weight: 800; white-space: nowrap; transition: .2s ease; }
.hero-search button:hover { background: #0369a1; transform: translateY(-1px); }
.btn-hero-secondary { border: 1px solid #7dd3fc; background: rgba(255,255,255,.78); color: #075985; font-weight: 700; }
.btn-hero-secondary:hover { border-color: #0284c7; background: #fff; color: #0369a1; }
.hero-trust { display: flex; flex-wrap: wrap; gap: 12px 20px; color: #475569; font-size: .92rem; }
.hero-trust i { color: #0ea5e9; }
.hero-visual { position: relative; min-height: 430px; display: grid; place-items: center; }
.visual-glow { position: absolute; inset: 50% auto auto 50%; width: 380px; height: 380px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(56,189,248,.36), rgba(125,211,252,.06) 62%, transparent 70%); }
.learning-window { position: relative; z-index: 2; width: min(100%, 455px); overflow: hidden; border: 1px solid rgba(255,255,255,.9); border-radius: 25px; background: rgba(255,255,255,.94); box-shadow: 0 35px 70px rgba(3,105,161,.22); transform: rotate(1deg); }
.learning-window-top { height: 50px; display: flex; align-items: center; gap: 8px; padding: 0 18px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.learning-window-top span { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; }
.learning-window-top span:first-child { background: #38bdf8; }
.learning-window-top small { margin-left: auto; color: #64748b; font-weight: 700; }
.learning-window-body { padding: 18px; }
.video-preview { position: relative; min-height: 185px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 17px; background: linear-gradient(145deg, #075985, #0ea5e9 52%, #7dd3fc); }
.video-preview::before { content: ""; position: absolute; width: 210px; height: 210px; right: -75px; top: -90px; border-radius: 50%; background: rgba(255,255,255,.15); }
.video-lines { position: absolute; left: 20px; bottom: 18px; width: 56%; display: grid; gap: 7px; }
.video-lines b,.video-lines span { height: 7px; border-radius: 10px; background: rgba(255,255,255,.85); }
.video-lines span { width: 76%; background: rgba(255,255,255,.42); }
.video-lines span:last-child { width: 46%; }
.play-button { position: relative; z-index: 2; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #0284c7; box-shadow: 0 14px 30px rgba(15,23,42,.24); }
.lesson-row { margin-top: 11px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 13px; background: #f8fafc; color: #64748b; font-size: .9rem; }
.lesson-row.active { background: #e0f2fe; color: #075985; }
.lesson-row b { font-size: .78rem; }
.floating-card { position: absolute; z-index: 3; display: flex; align-items: center; gap: 10px; min-width: 165px; padding: 12px 15px; border: 1px solid rgba(255,255,255,.9); border-radius: 15px; background: rgba(255,255,255,.94); box-shadow: 0 16px 36px rgba(15,23,42,.14); backdrop-filter: blur(10px); }
.floating-card > i { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: #e0f2fe; color: #0284c7; }
.floating-card strong,.floating-card small { display: block; }
.floating-card strong { color: #0f172a; font-size: 1rem; }
.floating-card small { color: #64748b; font-size: .72rem; }
.card-rating { left: -10px; top: 58px; }
.card-rating > i { color: #f59e0b; background: #fef3c7; }
.card-students { right: -12px; bottom: 55px; }
.floating-badge { position: absolute; z-index: 4; right: 16px; top: 28px; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: #0f172a; color: #7dd3fc; font-size: 1.45rem; box-shadow: 0 18px 35px rgba(15,23,42,.22); transform: rotate(7deg); }
.trust-strip { display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 22px; background: #e2e8f0; box-shadow: 0 14px 35px rgba(15,23,42,.06); }
.trust-item { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 25px 20px; background: #fff; }
.trust-item > i { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: #e0f2fe; color: #0284c7; font-size: 1.15rem; }
.trust-item strong,.trust-item span { display: block; }
.trust-item strong { color: #0f172a; font-size: 1.1rem; }
.trust-item span { color: #64748b; font-size: .82rem; }
.home-section { padding-top: 10px; }
.section-heading { max-width: 100%; }
.section-heading h2 { margin: 7px 0 5px; color: #0f172a; font-size: clamp(1.9rem, 3vw, 2.55rem); font-weight: 900; letter-spacing: -.025em; }
.section-heading p { margin: 0; color: #64748b; }
.section-link { color: #0284c7; text-decoration: none; font-weight: 800; white-space: nowrap; }
.section-link i { margin-left: 5px; transition: transform .2s ease; }
.section-link:hover i { transform: translateX(4px); }
.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.category-card { min-height: 98px; display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 13px; padding: 18px; border: 1px solid #e2e8f0; border-radius: 18px; background: #fff; color: inherit; text-decoration: none; box-shadow: 0 10px 25px rgba(15,23,42,.045); transition: .22s ease; }
.category-card:hover { border-color: #7dd3fc; transform: translateY(-4px); box-shadow: 0 18px 35px rgba(2,132,199,.11); }
.category-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(145deg,#e0f2fe,#bae6fd); color: #0369a1; font-size: 1.2rem; }
.category-text strong,.category-text small { display: block; }
.category-text strong { color: #0f172a; line-height: 1.35; }
.category-text small { margin-top: 4px; color: #64748b; }
.category-arrow { color: #94a3b8; font-size: .85rem; }
.home-course-card { border-radius: 19px; }
.course-thumb { position: relative; display: block; min-height: 178px; overflow: hidden; background: #e0f2fe; }
.course-placeholder { min-height: 178px; display: grid; place-items: center; align-content: center; gap: 8px; background: linear-gradient(145deg,#075985,#0ea5e9 55%,#7dd3fc); color: #fff; }
.course-placeholder i { font-size: 2rem; }
.course-placeholder span { font-weight: 800; }
.course-badge { position: absolute; left: 12px; top: 12px; padding: 7px 10px; border-radius: 10px; font-size: .75rem; font-weight: 900; }
.course-badge.free { background: #dcfce7; color: #166534; }
.course-badge.bestseller { background: #fef3c7; color: #92400e; }
.course-card-body { padding: 17px; }
.course-category { color: #0284c7; font-size: .78rem; font-weight: 800; }
.course-card-body h3 { min-height: 50px; margin: 8px 0; font-size: 1.02rem; line-height: 1.5; font-weight: 800; }
.course-card-body h3 a { color: #0f172a; text-decoration: none; }
.course-instructor { margin-bottom: 10px; color: #64748b; font-size: .82rem; }
.course-meta { display: flex; gap: 14px; color: #64748b; font-size: .82rem; }
.course-meta .fa-star { color: #f59e0b; }
.course-card-footer { margin-top: 15px; padding-top: 13px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #e2e8f0; }
.course-price strong { color: #0f172a; font-size: 1.05rem; }
.course-price del { margin-left: 6px; color: #94a3b8; font-size: .78rem; }
.course-card-footer > a { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: #e0f2fe; color: #0284c7; text-decoration: none; }
.feature-panel { padding: 54px 44px; border: 1px solid #dbeafe; border-radius: 28px; background: linear-gradient(180deg,#f8fdff,#eef8ff); }
.feature-panel .section-heading { max-width: 700px; }
.feature-card { height: 100%; padding: 28px; border: 1px solid #e2e8f0; border-radius: 20px; background: #fff; text-align: center; box-shadow: 0 12px 30px rgba(15,23,42,.05); }
.feature-card > span { width: 64px; height: 64px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 18px; background: #e0f2fe; color: #0284c7; font-size: 1.45rem; }
.feature-card h3 { color: #0f172a; font-size: 1.1rem; font-weight: 850; }
.feature-card p { margin: 0; color: #64748b; line-height: 1.7; }
.instructor-cta { position: relative; overflow: hidden; padding: 46px 48px; border-radius: 28px; background: linear-gradient(135deg,#0f172a,#0c4a6e 60%,#0369a1); color: #fff; box-shadow: 0 24px 55px rgba(15,23,42,.22); }
.instructor-cta::after { content: ""; position: absolute; width: 240px; height: 240px; right: -85px; top: -105px; border-radius: 50%; background: rgba(125,211,252,.16); }
.instructor-cta > .row { position: relative; z-index: 1; }
.instructor-cta h2 { margin: 8px 0; font-weight: 900; }
.instructor-cta p { margin: 0; color: #cbd5e1; }
.section-kicker.light { color: #7dd3fc; }

/* Dark, high-contrast footer */
.site-footer { background: #0b1220; color: #cbd5e1; border-top: 0; box-shadow: none; }
.footer-main { position: relative; }
.footer-description { max-width: 500px; color: #94a3b8; }
.footer-title { color: #fff; font-size: .95rem; }
.footer-links li + li { margin-top: .62rem; }
.footer-links a { color: #94a3b8; }
.footer-links a:hover { color: #7dd3fc; }
.footer-social { display: flex; gap: 10px; }
.footer-social a { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #243247; border-radius: 11px; color: #cbd5e1; text-decoration: none; transition: .2s ease; }
.footer-social a:hover { border-color: #38bdf8; background: #0c4a6e; color: #fff; transform: translateY(-2px); }
.footer-bottom-wrap { border-top: 1px solid #1e293b; background: #080e19; }
.footer-bottom { border: 0; color: #64748b; }
.footer-bottom strong { color: #94a3b8; }
.footer-logo { filter: none !important; }

body.dark .home-hero { border-color: #1e3a54; background: radial-gradient(circle at 90% 10%,rgba(14,165,233,.18),transparent 30%),linear-gradient(135deg,#0b1828,#0f1d2e); }
body.dark .hero-title, body.dark .section-heading h2, body.dark .category-text strong, body.dark .course-card-body h3 a, body.dark .course-price strong, body.dark .feature-card h3 { color: #e6f4ff; }
body.dark .hero-copy, body.dark .section-heading p, body.dark .category-text small, body.dark .course-instructor, body.dark .course-meta, body.dark .feature-card p { color: #94a3b8; }
body.dark .trust-strip { border-color: #1e3a54; background: #1e3a54; }
body.dark .trust-item, body.dark .category-card, body.dark .feature-card { background: #0f1d2e; border-color: #1e3a54; }
body.dark .feature-panel { background: #0b1828; border-color: #1e3a54; }
body.dark .hero-search, body.dark .learning-window { background: #0f1d2e; border-color: #1e3a54; }
body.dark .hero-search input { color: #e6f4ff; }
body.dark .learning-window-top, body.dark .lesson-row { background: #0b1828; border-color: #1e3a54; }
body.dark .lesson-row.active { background: #0c4a6e; color: #bae6fd; }

@media (max-width: 1199.98px) {
    .home-hero { padding: 58px 42px; }
    .category-grid { grid-template-columns: repeat(2,1fr); }
    .card-rating { left: 0; }
    .card-students { right: 0; }
}
@media (max-width: 991.98px) {
    .home-hero { padding: 48px 34px; }
    .hero-visual { margin-top: 10px; min-height: 390px; }
    .trust-strip { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 575.98px) {
    .home-hero { padding: 34px 22px; border-radius: 23px; }
    .hero-title { font-size: 2.45rem; }
    .hero-search { display: grid; grid-template-columns: auto 1fr; padding: 12px 14px; }
    .hero-search button { grid-column: 1 / -1; width: 100%; }
    .hero-trust { display: grid; gap: 8px; }
    .hero-visual { min-height: 350px; }
    .learning-window { width: 100%; }
    .floating-card { min-width: 145px; padding: 9px 11px; }
    .card-rating { top: 30px; left: -5px; }
    .card-students { right: -5px; bottom: 28px; }
    .floating-badge { right: 4px; top: 18px; }
    .trust-strip { grid-template-columns: 1fr; }
    .trust-item { justify-content: flex-start; }
    .category-grid { grid-template-columns: 1fr; }
    .feature-panel, .instructor-cta { padding: 34px 22px; border-radius: 22px; }
}
