/* --- Global Theme --- */
:root {
    --bg-dark: #0a0a0a;
    --card-bg: #1a1a1a;
    --primary-yellow: #f5c518;
    --nav-green: #1b5e20;
}

body {
    background-color: var(--bg-dark);
    color: #ffffff;
    font-family: 'Kanit', sans-serif;
    overflow-x: hidden;
}

.navbar {
    background: linear-gradient(180deg, #1b5e20 0%, #144416 100%) !important;
    padding: 12px 0 !important;
    border-bottom: 3px solid #ffc107 !important; /* เส้นขอบทองด้านล่างเพิ่มความหรู */
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

/* ปรับแต่งตัวอักษรเมนู */
.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 400;
    margin: 0 8px;
    padding: 8px 15px !important;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

/* เอฟเฟกต์ตอน Hover (เอาเมาส์ชี้) */
.navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffc107 !important; /* เปลี่ยนเป็นสีทอง */
    transform: translateY(-2px);
}

/* เมนูที่กำลังใช้งานอยู่ (Active) */
.navbar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffc107 !important;
    font-weight: 600;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

/* ปรับแต่งโลโก้ฝั่งซ้าย */
.navbar-brand {
    font-size: 1.5rem !important;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* ปรับแต่งปุ่ม Badge LIVE NOW */
.badge.bg-danger.pulse {
    padding: 8px 15px !important;
    border-radius: 50px !important;
    font-weight: 600;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
    border: 1px solid rgba(255,255,255,0.2);
}

/* สำหรับมือถือ: ปรับปุ่ม Hamburger */
.navbar-toggler {
    border: none !important;
    padding: 0;
}
.navbar-toggler:focus {
    box-shadow: none !important;
}

/* --- Category Chips --- */
.category-section {
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 1020;
}

.sticky-top-categories {
    position: sticky;
    top: 56px;
}

.no-scrollbar::-webkit-scrollbar { display: none; }

.chip {
    background: #222;
    color: #eee;
    border: 1px solid #333;
    padding: 8px 20px;
    border-radius: 50px;
    white-space: nowrap;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.chip:hover, .chip.active {
    background: var(--primary-yellow);
    color: #000;
    border-color: var(--primary-yellow);
    font-weight: 500;
}

/* --- Movie Cards --- */
.movie-card {
    background: none;
    border: none;
    padding: 0;
    width: 100%;
    text-align: left;
    transition: transform 0.3s;
    margin-bottom: 1.5rem;
}

.movie-poster-box {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border: 1px solid #333;
}

.movie-poster-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.movie-card:hover {
    transform: translateY(-8px);
}

.movie-card:hover img {
    transform: scale(1.1);
}

.movie-name {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #ddd;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}

/* --- Modal Selection Buttons --- */
.res-btn, .audio-btn {
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 5px 15px;
    border-radius: 5px;
    font-size: 0.8rem;
}

.res-btn.active, .audio-btn.active {
    background: var(--primary-yellow);
    color: #000;
    border-color: var(--primary-yellow);
    font-weight: 600;
}

/* --- Fullscreen Player Overlay --- */
.player-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    z-index: 2000;
    display: none;
    flex-direction: column;
}

.player-overlay.show { display: flex; }

.player-header {
    background: rgba(0,0,0,0.8);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-close-player {
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
}

.player-box {
    flex-grow: 1;
    width: 100%;
    height: 100%;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

#moviesContainer {
    animation: fadeIn 0.5s ease-out;
}

/* --- เพิ่มเติมจาก CSS เดิมของคุณ --- */

.scroll-container-desktop {
    cursor: grab; /* เปลี่ยนเมาส์เป็นรูปมือเวลาชี้ */
    user-select: none; /* ป้องกันการคลุมดำเวลาลาก */
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* ให้เลื่อนลื่นๆ ในมือถือ */
}

.scroll-container-desktop:active {
    cursor: grabbing; /* เปลี่ยนมือเป็นรูปกำเวลาลาก */
}

/* ซ่อน Scrollbar แต่ยังเลื่อนได้ */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- Hero Banner Style --- */
.hero-banner {
    width: 100%;
    overflow: hidden;
    border-bottom: 3px solid var(--primary-yellow);
}

.hero-img {
    height: 400px; /* ปรับความสูงตามชอบ */
    object-fit: cover;
    object-position: top;
    transition: transform 0.5s ease;
}

.hero-img:hover {
    transform: scale(1.02);
}

/* --- Ads Banner Style --- */
.custom-ads-movie {
    max-width: 782px;
    width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: 0.3s;
}

.custom-ads-movie:hover {
    filter: brightness(1.1);
    transform: translateY(-3px);
}

/* ปรับระยะขยับของส่วน Categories */
.sticky-top-categories {
    top: 56px; /* ให้ตรงกับความสูง Navbar */
    background: rgba(10, 10, 10, 0.95) !important;
}

/* Responsive สำหรับมือถือ */
@media (max-width: 768px) {
    .hero-img {
        height: 250px;
    }
}

/* --- Sidebar Ads for Movies Page --- */
.movie-sidebar-ads {
    position: fixed;
    top: 100px; /* ระยะห่างจากด้านบน */
    width: 300px;
    height: 600px;
    z-index: 1050; /* ให้อยู่เหนือเนื้อหาแต่ใต้ Modal */
    transition: 0.3s;
}

.movie-sidebar-ads.left {
    left: 10px;
}

.movie-sidebar-ads.right {
    right: 10px;
}

.movie-sidebar-ads img {
    width: 300px;
    height: 600px;
    object-fit: cover;
    border: 2px solid #333;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* ปุ่มปิดสไตล์มินิมอล */
.close-movie-ads {
    position: absolute;
    top: -12px;
    width: 30px;
    height: 30px;
    background: #f51818; /* สีเหลืองทองเดียวกับธีมเว็บ */
    color: #ffffff;
    border: 2px solid #fff;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    font-weight: bold;
    z-index: 1051;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.movie-sidebar-ads.left .close-movie-ads { right: -15px; }
.movie-sidebar-ads.right .close-movie-ads { left: -15px; }

.close-movie-ads:hover {
    background: #000000;
    transform: scale(1.1);
}

/* ซ่อนในมือถือหรือหน้าจอเล็กกว่า 1400px เพื่อไม่ให้ทับเนื้อหาหนัง */
@media (max-width: 1450px) {
    .movie-sidebar-ads {
        display: none !important;
    }
}