:root {
    --bg-dark: #0f0f0f;
    --panel: #121212;
    --card: #1a1a1a;
    --gold: #ffcc33;
    --gold-dark: #ffdb4d;
    --muted: #9a9a9a;
}

body {
    background: #000;
    color: #fff;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    /* 1. แก้ไขหลัก: ป้องกันการเลื่อนซ้ายขวาที่ไม่ต้องการ */
    overflow-x: hidden;
}

/* Top bar */
.topbar {
    background: #000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
}
.topbar a {
    color: #ddd;
    text-decoration: none;
}
.topbar a:hover {
    color: var(--gold);
}

/* Main navbar */
.main-nav {
    background: var(--panel);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: relative; /* for centered brand on large screens */
    padding: 0.6rem 1rem;
}

/* Brand styling */
.navbar-brand {
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 1.35rem;
    z-index: 3;
}
.navbar-brand .gold {
    color: var(--gold);
}
.navbar-brand .light {
    color: #fff;
}

/* left + right nav lists for desktop */
.nav-left,
.nav-right {
    gap: 1.25rem;
}
.nav-left .nav-link,
.nav-right .nav-link {
    color: #e9e9e9;
    padding: 0.35rem 0;
}
.nav-left .nav-link:hover,
.nav-right .nav-link:hover {
    color: var(--gold);
}

/* Buttons */
.btn-gold {
    background: var(--gold);
    color: #111;
    border: none;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
}
.btn-gold:hover {
    background: var(--gold-dark);
}

.btn-outline-light {
    padding: 0.25rem 0.5rem;
}

/* Center brand only on large screens */
@media (min-width: 992px) {
    .navbar-brand {
        position: absolute;
        left: 50%;
        /* แก้ไข: ใช้ transform: translate(-50%, -50%); สำหรับจัดกึ่งกลางที่สมบูรณ์ */
        transform: translate(-50%, -50%);
        top: 50%;
    }
    /* ensure the desktop navs don't overlap the centered brand */
    .nav-left {
        margin-right: 10rem;
    } /* give space for brand */
    .nav-right {
        margin-left: 10rem;
    } /* give space for brand */
}

/* mobile brand centered in normal flow, toggler at right */
@media (max-width: 991.98px) {
    .navbar-brand {
        position: static;
        transform: none;
        text-align: center;
        width: 100%;
    }
    .nav-left,
    .nav-right {
        display: none !important;
    } /* hide desktop lists */

    /* 2. แก้ไขปัญหาโลโก้ล้นจอ: ลบ margin-right ติดลบ */
    .head-logo {
        width: 22vw !important;
        height: auto !important;
        margin-right: -1rem;
        margin-top: 0px !important;
    }
    .topbar {
        display: none;
    }
}

/* small visual tweaks */
.dropdown-menu-dark {
    background: #151515;
    border: 1px solid rgba(255, 255, 255, 0.03);
}
.section-title {
    border-left: 4px solid var(--gold);
    padding-left: 10px;
    margin-bottom: 1rem;
    font-weight: 600;
}
.card {
    background: var(--card);
    border: none;
    border-radius: 0.5rem;
}
/* Custom style for sidebar widgets to override default card padding/margin */
.sidebar-widget-card {
    padding: 0 !important;
    margin: 0 !important;
}
footer.footer {
    background: var(--panel);
    color: #cfcfcf;
    padding: 2rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.text-white2 {
    color: #ffffffcc;
}
/* Custom button for Show More */
.btn-outline-dark-custom {
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e9e9e9;
    background-color: transparent;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
}
.btn-outline-dark-custom:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Back to Top Button */
#backToTop {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    background-color: #d4af37; /* สีทอง */
    color: #000;
    border: none;
    width: 45px;
    height: 45px;
    font-size: 1.25rem;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#backToTop.show {
    display: inline-block;
    opacity: 1;
    transform: scale(1);
}

#backToTop:hover {
    background-color: #fff;
    color: #000;
}

/* Hero Section Base Style (ปรับแก้ background-size ให้เป็น cover เป็นค่าเริ่มต้น) */
.hero-section {
    background-size: contain;
    background-position: 25% center;
}

/* --- ANIMATION STYLES (PURE CSS for Hover) --- (ไม่มีการเปลี่ยนแปลง) */
.card,
.btn,
.badge,
.animation-hover-lift,
.animation-logo-hover,
.animation-card-hover {
    transition: all 0.3s ease-in-out;
}
.animation-card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(255, 193, 7, 0.15) !important;
}
.animation-button-hover:hover {
    transform: scale(1.03);
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.5) !important;
}
.animation-logo-hover:hover img {
    transform: scale(1.1);
    opacity: 0.9;
}
.animation-hover-lift:hover {
    transform: translateX(5px);
    color: #fff !important;
}
.animation-gold-glow {
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.2);
    animation: pulse-glow 3s infinite alternate;
}
.main-nav {
    margin-top: 2.5rem;
}
.head-logo {
    height: 120px; /* ลองใช้ค่าที่ต้องการ เช่น 60px หรือ 70px */
    width: auto; /* ให้ความกว้างปรับตามความสูงโดยอัตโนมัติ */
    /* ลบ margin-top: 10px; ออก แล้วใช้ flexbox ช่วยจัดกึ่งกลางแทน */
}
@keyframes pulse-glow {
    from {
        box-shadow: 0 0 8px rgba(255, 193, 7, 0.2);
    }
    to {
        box-shadow: 0 0 15px rgba(255, 193, 7, 0.4);
    }
}

/* ------------------------------------------- */
/* --- ปรับสำหรับหน้าจอขนาดเล็ก (มือถือ) --- */
/* ------------------------------------------- */
@media (max-width: 768px) {
    /* Hero Section - ปรับตำแหน่งทองคำ */
    .hero-section {
        background-size: cover;
        background-position: left center; /* เน้นก้อนทองทางซ้าย */
        min-height: 60vh !important;
    }

    /* Back to Top - ปรับตำแหน่งให้เข้ามาในจอ */
    #backToTop {
        right: 15px;
        bottom: 15px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}
