/* ============================================
   Hub Nav Bar - Frontend Styles
   Theme: Black & Gold Luxury (เข้าชุดกับ Hub Grid Post)
   ============================================ */

.hnb-bar {
    /* ============================================
       จุดควบคุมสีทั้งหมด — เปลี่ยนแค่ 2 ค่านี้พอ (--hnb-bg, --hnb-gold)
       ตัวอื่นคำนวณ/derive จากสองค่านี้เพื่อให้ยังคุมโทนเดียวกันเสมอ
       สลับไปใช้เว็บอื่นแค่แก้ 2 บรรทัดนี้ ทุกจุดในปลั๊กอินจะเปลี่ยนตาม
       ============================================ */
    --hnb-bg: #0a0a0a;             /* พื้นหลังหลัก (ดำ) */
    --hnb-gold: #c9a961;           /* สีเน้นหลัก (ทอง) */
    --hnb-gold-rgb: 201, 169, 97;  /* ค่า RGB ของสีทองด้านบน (แก้คู่กันเสมอ) ใช้กับ rgba() */

    /* เฉดที่ derive มาจาก 2 ค่าบน - ไม่ต้องแก้ตรงนี้ตามปกติ */
    --hnb-gold-light: color-mix(in srgb, var(--hnb-gold) 55%, white);
    --hnb-gold-dark: color-mix(in srgb, var(--hnb-gold) 65%, black);
    --hnb-white: #f5f5f5;
    --hnb-bg-card: color-mix(in srgb, var(--hnb-bg) 85%, white);
    --hnb-bg-card-dark: color-mix(in srgb, var(--hnb-bg) 92%, white);
    --hnb-bg-darker: color-mix(in srgb, var(--hnb-bg) 96%, black);

    background: var(--hnb-bg);
    border-bottom: 2px solid var(--hnb-gold);
    box-shadow: 0 2px 16px rgba(var(--hnb-gold-rgb), 0.15);
    position: relative;
    z-index: 9999;
    font-family: 'Segoe UI', 'Sarabun', -apple-system, sans-serif;
}

.hnb-bar a {
    text-decoration: none !important;
}

.hnb-bar-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 20px;
}

/* ============================================
   โลโก้
   ============================================ */

.hnb-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.hnb-logo img {
    height: 42px;
    width: auto;
    display: block;
}

.hnb-logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--hnb-gold-dark), var(--hnb-gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   เมนูคัสตอม (เฉพาะ PC)
   ============================================ */

.hnb-custom-menu {
    display: none; /* ซ่อนบนมือถือ default */
    flex: 1;
    justify-content: center;
}

.hnb-custom-menu-list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.hnb-menu-item {
    position: relative;
}

.hnb-menu-item > a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    color: var(--hnb-white);
    font-size: 14px;
    font-weight: 600;
    border-radius: 20px;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.hnb-menu-item > a:hover {
    background: rgba(var(--hnb-gold-rgb), 0.12);
    color: var(--hnb-gold-light);
}

.hnb-menu-item.hnb-highlighted > a {
    background: linear-gradient(135deg, var(--hnb-gold-dark), var(--hnb-gold));
    color: var(--hnb-bg);
}

.hnb-menu-item.hnb-highlighted > a:hover {
    background: linear-gradient(135deg, var(--hnb-gold), var(--hnb-gold-light));
    color: var(--hnb-bg);
}

.hnb-menu-icon {
    font-size: 15px;
    line-height: 1;
}

.hnb-dropdown-caret {
    font-size: 9px;
    margin-left: 2px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.hnb-has-dropdown:hover .hnb-dropdown-caret {
    transform: rotate(180deg);
}

/* Dropdown */
.hnb-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--hnb-bg-card);
    border: 1px solid rgba(var(--hnb-gold-rgb), 0.4);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    list-style: none;
    margin: 8px 0 0;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.hnb-has-dropdown:hover .hnb-dropdown-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.hnb-dropdown-list li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    color: var(--hnb-white);
    font-size: 13px;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.hnb-dropdown-list li a:hover {
    background: rgba(var(--hnb-gold-rgb), 0.15);
    color: var(--hnb-gold-light);
}

/* ============================================
   ปุ่มแฮมเบอร์เกอร์
   ============================================ */

.hnb-hamburger {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(var(--hnb-gold-rgb), 0.4);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.hnb-hamburger:hover {
    border-color: var(--hnb-gold);
    background: rgba(var(--hnb-gold-rgb), 0.08);
}

.hnb-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--hnb-gold);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.hnb-hamburger.hnb-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hnb-hamburger.hnb-active span:nth-child(2) {
    opacity: 0;
}

.hnb-hamburger.hnb-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   Mobile Menu Panel (เมนู WordPress ที่กางออกมา)
   ============================================ */

.hnb-mobile-menu-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    background: var(--hnb-bg-darker);
    border-top: 0 solid rgba(var(--hnb-gold-rgb), 0.3);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    transition: max-height 0.3s ease, border-top-width 0.3s ease;
    z-index: 9998;
}

.hnb-mobile-menu-panel.hnb-open {
    max-height: 80vh;
    overflow-y: auto;
    border-top-width: 1px;
}

/* Backdrop มืดครึ่งจอด้านหลังเมนู - ให้เห็นชัดว่าเมนูลอยทับเนื้อหาอยู่
   และเป็นพื้นที่กดปิดเมนูได้สะดวก (คลิกที่ไหนก็ได้นอกกรอบเมนู) */
.hnb-mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    z-index: 9997;
}

.hnb-mobile-menu-backdrop.hnb-open {
    opacity: 1;
    visibility: visible;
}

.hnb-wp-menu-list {
    list-style: none;
    margin: 0;
    padding: 16px 20px;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* การ์ดเมนูระดับบนสุด - กรอบทอง พื้นหลังเข้มกว่าพื้นรวม */
.hnb-wp-menu-list > li {
    background: var(--hnb-bg-card-dark);
    border: 1px solid rgba(var(--hnb-gold-rgb), 0.5);
    border-radius: 12px;
    overflow: hidden;
}

.hnb-wp-menu-list > li > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    color: var(--hnb-white);
    font-size: 15px;
    font-weight: 600;
    border-bottom: none;
    transition: background 0.2s ease;
}

.hnb-wp-menu-list > li > a:hover {
    background: rgba(var(--hnb-gold-rgb), 0.08);
    color: var(--hnb-white);
    padding-left: 16px;
}

/* จุดกลมทองหน้าข้อความ */
.hnb-wp-menu-list > li > a::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hnb-gold);
    flex-shrink: 0;
    box-shadow: 0 0 5px rgba(var(--hnb-gold-rgb), 0.7);
}

/* ลูกศรขวาสุด เฉพาะเมนูที่มีลูก (dropdown) */
.hnb-wp-menu-list > li.menu-item-has-children > a {
    position: relative;
}

.hnb-wp-menu-list > li.menu-item-has-children > a::after {
    content: '\25BC';
    margin-left: auto;
    font-size: 10px;
    color: var(--hnb-gold);
    transition: transform 0.25s ease;
}

.hnb-wp-menu-list > li.menu-item-has-children.hnb-submenu-open > a::after {
    transform: rotate(180deg);
}

/* เมนูย่อย (accordion กางลงมาข้างใน การ์ดเดียวกัน) */
.hnb-wp-menu-list ul.sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
    transition: max-height 0.3s ease;
}

.hnb-wp-menu-list > li.hnb-submenu-open > ul.sub-menu {
    max-height: 500px;
}

.hnb-wp-menu-list ul.sub-menu li a {
    display: block;
    padding: 12px 16px 12px 34px;
    color: #ccc;
    font-size: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.hnb-wp-menu-list ul.sub-menu li a:hover {
    color: var(--hnb-gold-light);
    padding-left: 38px;
}

.hnb-menu-notice {
    padding: 16px 20px;
    color: #999;
    font-size: 13px;
    margin: 0;
}

/* ============================================
   Responsive
   ============================================ */

@media (min-width: 900px) {
    .hnb-custom-menu {
        display: flex;
    }
}

@media (max-width: 899px) {
    .hnb-bar-inner {
        padding: 10px 16px;
    }
    .hnb-logo img {
        height: 34px;
    }
}
