/*
 * ==============================
 * Globals — รองรับทุกขนาดจอ เลื่อนได้ โหลดเบา
 * ==============================
 */
@font-face {
    font-family: Sukhumvit;
    src: url('../fonts/sukhumvit.ttf');
    font-display: swap;
}
html {
    overflow-x: hidden;
    overflow-x: clip;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    scroll-padding-top: var(--main-offset-top);
}
*, *::before, *::after {
    box-sizing: inherit;
}
body {
    margin: 0;
    font-family: Sukhumvit, serif;
    background: linear-gradient(to bottom, black, #290101);
    background-attachment: scroll;
    min-height: 100%;
    overflow-x: hidden;
    overflow-x: clip;
}

:root {
    --header-height: 90px;
    /* Fallback ถ้ายังไม่มี JS ซิงค์ — เว็บเลย์เอาต์จะตั้งเป็น header จริงแบบไดนามิก */
    --main-offset-top: calc(96px + env(safe-area-inset-top, 0px));
    --offcanvas-menu-active-color: #fff;
    --offcanvas-menu-active-bg: #2a5fd4;
    --footer-height: 320px
}
.movie-cards-container {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    height: auto;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 6px;
    padding: 0 2px;
    box-sizing: border-box;
}
/*
 * ==============================
 * Scrollbar
 * ==============================
 */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
*::-webkit-scrollbar-track {
    background: #333333;
}
*::-webkit-scrollbar-thumb {
    background-color: #8b8b8b;
    border-radius: 4px;
    border: 0;
}

/*
 * ==============================
 * Top Navbar
 * ==============================
 */
/* เฉพาะ header หลักของเว็บ — อย่าใช้ selector กว้าง `header` เพราะจะไปกับ <header> ในหน้าสมาชิกด้วย */
body > header {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: var(--header-height);
    height: auto;
    background: rgba(0, 0, 0, .6);
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    border: 1px solid #610000;
    border-width: 0 0 2px 0;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
}
.header-logo {
    width: min(220px, 38vw);
    height: auto;
    min-height: 44px;
    margin: 8px;
}
.header-logo img {
    max-width: 100%;
    height: auto;
}
.header-nav {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
}
.header-nav ul {
    list-style-type: none;
    padding: 0;
    margin: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2px 0;
}
.header-nav ul li {
    min-height: 42px;
    line-height: 1.35;
    font-size: clamp(14px, 2.1vw, 19px);
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
}
.header-nav ul li a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #fff;
    padding: 4px 4px;
}

.header-nav-member-wrap[hidden] {
    display: none !important;
}

.header-nav-member-wrap .header-nav-member-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #fff;
    padding: 4px 4px;
    white-space: nowrap;
}

.header-nav-member-wrap .header-nav-member-link--account:hover,
.header-nav-member-wrap .header-nav-member-link--login:hover {
    color: #8df7ff;
}

.header-nav-member-icon {
    flex-shrink: 0;
    font-size: 0.95em;
    line-height: 1;
}

.header-nav-member-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.2rem;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.05rem;
    text-align: center;
    color: #fff;
    background: #ef4444;
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    box-sizing: border-box;
}
/* ลดงานวาดซ้ำจาก CSS animation บนแถบหัว */
body > header .animate__infinite {
    animation-iteration-count: 6 !important;
}

.header-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    min-width: 44px;
    margin: 0;
    flex-shrink: 0;
    background: linear-gradient(160deg, #b01010 0%, #7a0000 100%);
    border: 1px solid rgba(255, 210, 140, 0.55);
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
    color: #fff;
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.header-search-btn:hover {
    background: linear-gradient(160deg, #e01818 0%, #a00000 100%);
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 230, 180, 0.35) inset;
}
.header-search-btn:focus-visible {
    outline: 2px solid #ffd27a;
    outline-offset: 2px;
}
.header-search-btn-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}
.header-search-label {
    font-size: clamp(13px, 1.9vw, 15px);
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.header-nav-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 8px 12px;
    flex-shrink: 0;
}

.header-smarttv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 36px;
    min-width: 36px;
    flex-shrink: 0;
    background: linear-gradient(160deg, #0ea5c9 0%, #0369a1 52%, #0b3d6e 100%);
    border: 1px solid rgba(140, 240, 255, 0.72);
    border-radius: 9px;
    padding: 4px 10px;
    cursor: pointer;
    color: #f0fdff;
    text-decoration: none;
    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.45),
        0 0 18px rgba(56, 214, 255, 0.32),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    animation: header-smarttv-softpulse 3.5s ease-in-out infinite;
}

.header-smarttv-btn:hover {
    color: #fff;
    background: linear-gradient(160deg, #22d3ee 0%, #0284c7 52%, #0c4a6e 100%);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.5),
        0 0 26px rgba(96, 230, 255, 0.45),
        0 0 0 1px rgba(220, 250, 255, 0.28) inset;
}

.header-smarttv-btn:focus-visible {
    outline: 2px solid #9ff4ff;
    outline-offset: 2px;
}

.header-smarttv-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.header-smarttv-icon-wrap::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(126, 240, 255, 0.42) 0%, rgba(126, 240, 255, 0) 72%);
    pointer-events: none;
}

.header-smarttv-icon {
    position: relative;
    z-index: 1;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 5px rgba(120, 240, 255, 0.5));
}

.header-smarttv-label {
    font-size: clamp(12px, 1.75vw, 14px);
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
@media (max-width: 991px) {
    .header-search-label,
    .header-smarttv-label {
        display: none;
    }
    /* ไอคอนอย่างเดียว แต่ใหญ่ขึ้น + โฟกัสชัด เห็นได้จากพื้นแถบเข้ม */
    .header-search-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        padding: 11px;
        border-radius: 12px;
        border-width: 2px;
    }
    .header-smarttv-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
        padding: 8px;
        border-radius: 11px;
        border-width: 2px;
    }
    .header-search-btn {
        border-color: rgba(255, 220, 150, 0.75);
        box-shadow:
            0 2px 14px rgba(0, 0, 0, 0.55),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset,
            0 0 22px rgba(255, 60, 50, 0.28);
    }
    .header-smarttv-btn {
        border-color: rgba(160, 245, 255, 0.82);
        box-shadow:
            0 2px 14px rgba(0, 0, 0, 0.55),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset,
            0 0 22px rgba(56, 214, 255, 0.34);
    }
    .header-search-btn svg.header-search-btn-icon,
    .header-smarttv-btn svg.header-smarttv-icon {
        width: 28px !important;
        height: 28px !important;
    }
    .header-smarttv-icon-wrap {
        width: 26px;
        height: 26px;
    }
}

/* มือถือจอเล็ก: โลโก้ซ้าย · ปุ่มไอคอนขวา · เมนูเลื่อนแนวนอนแถวเดียว */
@media (max-width: 640px) {
    body > header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas:
            "logo smarttv search"
            "nav nav nav";
        gap: 6px;
        align-items: center;
        padding:
            max(6px, env(safe-area-inset-top, 0px))
            max(8px, env(safe-area-inset-right, 0px))
            8px
            max(8px, env(safe-area-inset-left, 0px));
    }

    .header-logo {
        grid-area: logo;
        flex: none;
        width: min(132px, 36vw);
        min-height: 36px;
        margin: 0;
        justify-self: start;
        align-self: center;
        display: flex;
        align-items: center;
    }

    .header-nav {
        display: contents;
    }

    .header-nav-actions {
        display: contents;
    }

    .header-smarttv-btn {
        grid-area: smarttv;
        justify-self: end;
    }

    .header-search-btn {
        grid-area: search;
        justify-self: end;
    }

    .header-search-label,
    .header-smarttv-label {
        display: none !important;
    }

    .header-search-btn,
    .header-smarttv-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
        gap: 0;
        border-radius: 10px;
        border-width: 2px;
        animation: none;
    }

    .header-search-btn {
        border-color: rgba(255, 220, 150, 0.75);
        box-shadow:
            0 2px 10px rgba(0, 0, 0, 0.5),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset,
            0 0 16px rgba(255, 60, 50, 0.22);
    }

    .header-smarttv-btn {
        border-color: rgba(160, 245, 255, 0.82);
        box-shadow:
            0 2px 10px rgba(0, 0, 0, 0.5),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset,
            0 0 16px rgba(56, 214, 255, 0.28);
    }

    .header-search-btn svg.header-search-btn-icon,
    .header-smarttv-btn svg.header-smarttv-icon {
        width: 22px !important;
        height: 22px !important;
    }

    .header-smarttv-icon-wrap {
        width: 22px;
        height: 22px;
    }

    .header-nav ul {
        grid-area: nav;
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        gap: 6px;
        margin: 0;
        padding: 2px 2px 4px;
        justify-content: flex-start;
        width: 100%;
        min-width: 0;
        mask-image: linear-gradient(90deg, transparent 0, #000 6px, #000 calc(100% - 14px), transparent 100%);
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6px, #000 calc(100% - 14px), transparent 100%);
    }

    .header-nav ul::-webkit-scrollbar {
        display: none;
        height: 0;
    }

    .header-nav ul li {
        flex: 0 0 auto;
        min-height: 34px;
        padding: 0;
        font-size: 12px;
    }

    .header-nav ul li a {
        padding: 6px 11px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.07);
        border: 1px solid rgba(255, 255, 255, 0.12);
        font-size: 12px;
        white-space: nowrap;
        min-height: 34px;
        line-height: 1.2;
    }

    .header-nav ul li a:active {
        background: rgba(255, 255, 255, 0.15);
    }

    .header-nav-member-label {
        display: none;
    }

    .header-nav-member-wrap .header-nav-member-link {
        padding: 6px 10px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.07);
        border: 1px solid rgba(255, 255, 255, 0.12);
        min-height: 34px;
    }

    .header-nav-tv-icon {
        position: static;
        top: auto;
        margin-right: 4px;
    }

    .header-nav ul li a img {
        max-height: 18px;
    }

    main {
        padding-left: clamp(6px, 2vw, 16px);
        padding-right: clamp(6px, 2vw, 16px);
    }

    :root {
        --main-offset-top: calc(clamp(96px, 26vw, 118px) + env(safe-area-inset-top, 0px));
    }
}

@keyframes header-smarttv-softpulse {
    0%, 100% {
        box-shadow:
            0 2px 12px rgba(0, 0, 0, 0.45),
            0 0 16px rgba(56, 214, 255, 0.28),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    }
    50% {
        box-shadow:
            0 4px 16px rgba(0, 0, 0, 0.5),
            0 0 28px rgba(96, 230, 255, 0.42),
            0 0 0 1px rgba(220, 250, 255, 0.2) inset;
    }
}

@keyframes header-smarttv-mobile-softpulse {
    0%, 100% {
        box-shadow:
            0 3px 0 #08344a,
            0 10px 26px rgba(0, 0, 0, 0.55),
            0 0 22px rgba(56, 214, 255, 0.32),
            0 0 0 1px rgba(255, 255, 255, 0.12) inset;
    }
    50% {
        box-shadow:
            0 3px 0 #08344a,
            0 12px 30px rgba(0, 0, 0, 0.55),
            0 0 34px rgba(120, 240, 255, 0.48),
            0 0 0 1px rgba(220, 250, 255, 0.2) inset;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-search-btn,
    .header-smarttv-btn {
        animation: none !important;
    }
}


/* Modal: ฟอร์มค้นหา */
.search-modal-form .form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 0.25rem;
}
.search-modal-form .form-control,
.search-modal-form .form-select {
    background-color: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.search-modal-form .form-control::placeholder {
    color: rgba(255, 255, 255, 0.45);
}
.search-modal-form .form-control:focus,
.search-modal-form .form-select:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}
.offcanvas-category-ul {
    list-style-type: none;
}
.offcanvas-category-ul li {
    display: inline-block;
    width: 100%;
    height: 40px;
    margin: 0;

}
.offcanvas-category-ul li a {
    display: inline-block;
    color: #fff;
    text-decoration: none;
    width: 100%;
    height: 100%;
    line-height: 2.6em;
    border-radius: 8px;
    padding: 0 10px;
}
.offcanvas-category-ul li a:hover {
    background: #1c0000;
}
.offcanvas-bg {
    background: linear-gradient(to top, black, #331b1b);
    background-attachment: scroll;
}

/*
 * ==============================
 * Body
 * ==============================
 */
main {
    margin-top: var(--main-offset-top);
    width: 100%;
    max-width: 100%;
    min-height: calc((100vh - var(--main-offset-top)) - var(--footer-height));
    display: flex;
    justify-content: flex-start;
    padding: 20px clamp(8px, 2vw, 20px);
    flex-wrap: wrap;
    align-items: stretch;
    flex-direction: column;
    box-sizing: border-box;
}
main>h1 {
    display: block;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    padding: 0 clamp(4px, 2vw, 12px);
    font-size: clamp(1.1rem, 3.8vw, 1.85rem);
    max-width: min(920px, 100%);
    margin-left: auto;
    margin-right: auto;
}

/* แถบคำโปรยใต้ h1 — ไม่เกินความกว้างอ่านสบาย */
.site-intro-strip {
    max-width: min(54rem, 100%);
    margin-left: auto;
    margin-right: auto;
    padding: clamp(0.4rem, 2vw, 0.95rem) clamp(0.5rem, 3vw, 1.25rem);
    font-size: clamp(13px, 2.35vw, 17px);
    line-height: 1.52;
    color: #eaeaea;
}

/* แบนเนอร์รูปกลางใต้เพลย์ / กลางเนื้อหา — อย่าเกินความกว้างคอนเทนต์ */
.promo-banner-below-player {
    width: 100%;
    max-width: min(728px, 100%);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}
.promo-banner-below-player a {
    display: block;
    max-width: 100%;
}
.promo-banner-below-player img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: min(28vh, 200px);
    object-fit: contain;
    margin: 0 auto;
    display: block;
}
/* เรียงเนื้อหาเป็นคอลัมน์เดียว — หลีกเลี่ยง space-between แนวนอนที่ทำให้บล็อกห่างกันยาวโล่งบนหน้า play/list */
.content-container {
    width: min(1210px, 100%);
    max-width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    box-sizing: border-box;
    gap: 12px;
    margin-inline: auto;
    align-self: center;
}

/*
 * ==============================
 * Footer area
 * ==============================
 */
footer {
    width: 100%;
    min-height: var(--footer-height);
    height: auto;
    background: rgba(0, 0, 0, .4);
    display: flex;
    justify-content: center;
    padding: 16px 0;
    box-sizing: border-box;
}
.footer-inner {
    width: min(1200px, 100%);
    max-width: 100%;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 16px;
    box-sizing: border-box;
}
.footer-left-section {
    width: min(420px, 100%);
    min-height: auto;
    height: auto;
    text-align: center;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-site-logo {
    max-width: min(260px, 78vw);
    width: auto;
    height: auto;
}

.footer-left-section > div > p {
    max-width: 38rem;
    margin-left: auto;
    margin-right: auto;
    font-size: clamp(12px, 2.1vw, 15px);
    line-height: 1.58;
    padding: 0 clamp(6px, 2.5vw, 14px);
    color: #ddd;
}
.footer-right-section {
    width: min(685px, 100%);
    flex: 1 1 min(100%, 280px);
    min-height: 200px;
    height: auto;
    text-align: center;
    padding: 20px;
    border: 2px dashed #242222;
    border-width: 0 0 0 2px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}
.footer-category {
    width: 100%;
    list-style-type: none;
    padding: 0;
    margin: 0;
}
.footer-category li {
    display: inline-block;
    margin: 8px;
}
.footer-category li a {
    padding: 10px 14px;
    background: #282828;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: clamp(14px, 1.8vw, 16px);
}

.footer-category li a:hover {
    text-decoration: none;
    background: #000;
}

@media (max-width: 700px) {
    .footer-right-section {
        border-width: 2px 0 0 0;
        padding-top: 16px;
    }
}

@media (pointer: coarse) {
    .header-nav ul li {
        min-height: 44px;
    }
}

@media (max-width: 900px) {
    :root {
        /* แถบหัวมักขึ้น 2 แถวขึ้นไปเมื่อความกว้างพอๆ JS จะ override ให้ตรงความจริง */
        --main-offset-top: calc(clamp(104px, 18vw + 76px, 200px) + env(safe-area-inset-top, 0px));
    }
}
.header-nav-tv-icon {
    position: relative;
    top: -7px;
    margin-right: 5px;
}

.header-nav ul li a img {
    max-height: clamp(22px, 5.5vw, 36px);
    width: auto;
    vertical-align: middle;
    object-fit: contain;
}
