/* =====================================================
   GLOBAL NAVBAR
====================================================== */

.topbar {
    background: linear-gradient(90deg, #e8560a 0%, #c94500 100%);
    text-align: center;
    padding: 9px 20px;
    font-family: 'Kanit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    letter-spacing: 0.3px;
}

.navbar {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 48px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* =====================================================
   LOGO
====================================================== */

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

.logo a {
    display: block;
    text-decoration: none;
    font-family: 'Kanit', sans-serif;
    font-size: 26px;
    font-weight: 900;
    color: #0d1b3e;
    letter-spacing: -1px;
}

.pyro-custom-logo {
    display: block;
    max-height: 45px;
    width: auto;
    object-fit: contain;
}

/* =====================================================
   NAV LINKS
====================================================== */

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links > li > a {
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a2e;
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links > li > a:hover {
    color: #e8560a;
}

/* =====================================================
   RIGHT SIDE
====================================================== */

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-search {
    display: flex;
    align-items: center;
    background: #f5f6fa;
    border: 1.5px solid #e8eaf0;
    border-radius: 50px;
    padding: 7px 14px;
    gap: 8px;
}

.nav-search form {
    display: flex;
    align-items: center;
    margin: 0;
}

.nav-search input {
    border: none;
    background: transparent;
    font-family: 'Sarabun', sans-serif;
    font-size: 14px;
    color: #1a1a2e;
    outline: none;
    width: 160px;
}

/* =====================================================
   CONTACT BUTTONS (แทนที่ตะกร้าสินค้า)
   ไอคอนเป็น inline SVG — ควบคุมขนาดด้วย width/height
   ไม่ใช้ font-size แบบ emoji อีกต่อไป
====================================================== */

.nav-contact {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-line-btn,
.nav-phone-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 50px;
    font-family: 'Kanit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-line-btn {
    background: #06C755;
    color: #fff;
}

.nav-line-btn:hover {
    background: #05a848;
}

.nav-phone-btn {
    background: #f5f6fa;
    color: #0d1b3e;
    border: 1.5px solid #e8eaf0;
}

.nav-phone-btn:hover {
    background: #e8560a;
    color: #fff;
    border-color: #e8560a;
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: block;
}

/* =====================================================
   NAV DROPDOWN — MEGA MENU
====================================================== */

.nav-has-dropdown {
    position: relative;
}

.nav-has-dropdown > a {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-has-dropdown > a::after {
    content: '▾';
    font-size: 11px;
    transition: transform 0.2s ease;
}

.nav-has-dropdown:hover > a::after {
    transform: rotate(180deg);
}

/* =====================================================
   DROPDOWN หลัก
====================================================== */

.nav-dropdown.pyro-category-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    width: min(900px, 90vw);
    min-width: 700px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 24px;
    background: #fff;
    border-top: 3px solid #e8560a;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 18px 45px rgba(13, 27, 62, 0.16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 99999;
    box-sizing: border-box;
}

.nav-has-dropdown:hover .nav-dropdown.pyro-category-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* =====================================================
   CAT หลัก
====================================================== */

.pyro-category-dropdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 24px;
}

.pyro-cat-group {
    position: static;
    min-width: 0;
    padding-bottom: 12px;
}

.pyro-cat-parent {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px !important;
    margin-bottom: 6px;
    background: #f5f7fb;
    border-radius: 8px;
    font-family: 'Kanit', sans-serif !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #0d1b3e !important;
    text-decoration: none !important;
    white-space: normal;
    transition: background 0.15s ease, color 0.15s ease;
}

.pyro-cat-parent:hover {
    background: #fff1e9 !important;
    color: #e8560a !important;
}

.pyro-cat-parent .pyro-cat-arrow {
    display: none;
}

/* =====================================================
   CAT ย่อย
====================================================== */

.pyro-cat-children {
    display: block !important;
    position: static !important;
    min-width: 0;
    padding: 0 !important;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.pyro-cat-child-group {
    position: static;
    margin: 0;
}

.pyro-cat-child {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px !important;
    font-family: 'Kanit', sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1a1a2e !important;
    text-decoration: none !important;
    white-space: normal;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.pyro-cat-child:hover {
    background: #f5f6fa !important;
    color: #e8560a !important;
}

.pyro-cat-child .pyro-cat-arrow {
    display: none;
}

.pyro-cat-grandchildren {
    display: block !important;
    position: static !important;
    min-width: 0;
    padding: 0 0 6px 14px !important;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* =====================================================
   CAT ระดับ 2
====================================================== */

.pyro-cat-grandchild {
    display: block !important;
    padding: 5px 10px !important;
    font-family: 'Kanit', sans-serif !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.45;
    color: #64748b !important;
    text-decoration: none !important;
    white-space: normal;
    border-left: 2px solid #e8eaf0;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.pyro-cat-grandchild:hover {
    color: #e8560a !important;
    border-left-color: #e8560a;
    background: #fff8f4;
}

/* =====================================================
   EMPTY CATEGORY
====================================================== */

.pyro-cat-empty {
    grid-column: 1 / -1;
    padding: 12px 18px;
    font-family: 'Kanit', sans-serif;
    font-size: 13px;
    color: #94a3b8;
}

/* =====================================================
   DROPDOWN SCROLLBAR
====================================================== */

.nav-dropdown.pyro-category-dropdown::-webkit-scrollbar {
    width: 6px;
}

.nav-dropdown.pyro-category-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.nav-dropdown.pyro-category-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.nav-dropdown.pyro-category-dropdown::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =====================================================
   MOBILE
   Desktop ไม่แตะ
====================================================== */

@media (max-width: 768px) {

    /* -----------------------------------------
       NAVBAR
    ----------------------------------------- */

    .navbar {
        padding: 10px 16px;
        gap: 10px;
        min-height: 64px;
        box-sizing: border-box;
    }

    /* -----------------------------------------
       LOGO
    ----------------------------------------- */

    .logo {
        flex: 0 0 auto;
        min-width: 0;
    }

    .pyro-custom-logo {
        max-height: 38px;
        max-width: 105px;
        width: auto;
    }

    /* -----------------------------------------
       ซ่อนเมนู Desktop บนมือถือ
    ----------------------------------------- */

    .nav-links {
        display: none !important;
    }

    /* -----------------------------------------
       RIGHT SIDE
    ----------------------------------------- */

    .nav-right {
        flex: 1 1 auto;
        min-width: 0;
        gap: 6px;
        justify-content: flex-end;
    }

    /* -----------------------------------------
       SEARCH
    ----------------------------------------- */

    .nav-search {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        padding: 6px 10px;
        gap: 6px;
    }

    .nav-search form {
        width: 100%;
        min-width: 0;
    }

    .nav-search input {
        width: 100%;
        min-width: 0;
        font-size: 13px;
    }

    /* -----------------------------------------
       CONTACT
    ----------------------------------------- */

    .nav-contact {
        flex: 0 0 auto;
        gap: 6px;
    }

    .nav-line-btn,
    .nav-phone-btn {
        width: 38px;
        height: 38px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        box-sizing: border-box;
    }

    .nav-contact-text {
        display: none !important;
    }

    .nav-icon {
        width: 17px;
        height: 17px;
    }

    /* -----------------------------------------
       CATEGORY DROPDOWN
       Mobile ใช้เมนูหลักแทน
    ----------------------------------------- */

    .pyro-category-dropdown {
        display: none !important;
    }

    .nav-dropdown.pyro-category-dropdown {
        display: none !important;
    }
}


/* =====================================================
   SMALL MOBILE
   เช่น iPhone / หน้าจอแคบมาก
====================================================== */

@media (max-width: 480px) {

    .navbar {
        padding: 9px 12px;
        gap: 8px;
    }

    .pyro-custom-logo {
        max-width: 92px;
        max-height: 34px;
    }

    .nav-right {
        gap: 5px;
    }

    .nav-search {
        padding: 5px 9px;
    }

    .nav-search input {
        font-size: 12px;
    }

    .nav-line-btn,
    .nav-phone-btn {
        width: 36px;
        height: 36px;
    }

    .nav-icon {
        width: 16px;
        height: 16px;
    }
}


/* =====================================================
   VERY SMALL MOBILE
   ====================================================== */

@media (max-width: 360px) {

    .pyro-custom-logo {
        max-width: 82px;
    }

    .nav-search input {
        font-size: 11px;
    }

    .nav-search {
        padding-left: 7px;
        padding-right: 7px;
    }

    .nav-line-btn,
    .nav-phone-btn {
        width: 34px;
        height: 34px;
    }
}