/* =========================
   RESET เฉพาะ NAVBAR
========================= */

.premium-navbar,
.premium-navbar * {
    box-sizing: border-box;
}

/* =========================
   NAVBAR หลัก
========================= */

.premium-navbar {
    width: 100%;
    background: #111827;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 9999;
    font-family: 'Sarabun', sans-serif;
}

.p-nav-top {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.p-nav-logo {
    color: #ffffff;
    text-decoration: none;
    font-size: 20px;
    font-weight: 800;
    white-space: nowrap;
}

.p-nav-logo:hover {
    color: #ffffff;
}

.p-nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =========================
   ปุ่ม Dark / Light Mode
========================= */

.p-theme-btn {
    height: 36px;
    padding: 0 15px;
    border-radius: 999px;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    background: #111827;
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
    box-shadow: none;
    transition: all 0.22s ease;
}

.p-theme-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #ffffff;
    transform: translateY(-1px);
}

.p-theme-icon {
    width: 15px;
    height: 15px;
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-1px);
}

#themeText {
    line-height: 1;
}

body.dark .p-theme-btn {
    background: rgba(16, 185, 129, 0.08);
    border-color: #10b981;
    color: #10b981;
}

body.dark .p-theme-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: #34d399;
    color: #34d399;
}

/* =========================
   ปุ่ม 3 ขีด
========================= */

.p-menu-btn {
    display: none;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    background: transparent;
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    cursor: pointer;
    font-size: 22px;
    align-items: center;
    justify-content: center;
    transition: 0.2s ease;
}

.p-menu-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #ffffff;
}

.p-menu-icon {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-1px);
}

/* =========================
   หมวดหมู่บนคอม
========================= */

.p-nav-categories {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 12px;
    display: flex;
    align-items: center;
    gap: 28px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.p-nav-categories::-webkit-scrollbar {
    display: none;
}

.p-nav-categories a {
    color: #d1d5db;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    padding: 8px 0;
    transition: 0.2s ease;
}

.p-nav-categories a:hover,
.p-nav-categories a.active {
    color: #22c55e;
}

/* =========================
   Dark Mode Navbar
========================= */

body.dark .premium-navbar {
    background: #0f172a;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark .p-nav-categories {
    background: #0f172a;
}

/* =========================
   Responsive มือถือ
========================= */

@media (max-width: 768px) {
    .premium-navbar {
        position: sticky;
        top: 0;
        z-index: 9999;
        background: #111827;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .p-nav-top {
        width: 100%;
        max-width: none;
        min-height: 62px;
        padding: 10px 12px 10px 16px;
        gap: 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .p-nav-logo {
        font-size: 17px;
        max-width: calc(100vw - 128px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .p-nav-actions {
        margin-left: auto;
        flex-shrink: 0;
        gap: 8px;
    }

    .p-theme-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        padding: 0;
        border-radius: 13px;
        font-size: 0;
    }

    .p-theme-icon {
        width: 18px;
        height: 18px;
        font-size: 19px;
    }

    .p-theme-btn span#themeText {
        display: none;
    }

    .p-menu-btn {
        display: flex;
        width: 40px;
        height: 40px;
        min-width: 40px;
        border-radius: 13px;
        font-size: 22px;
    }

    /*
       เมนูมือถือ
       - เต็มขอบซ้ายและขวา
       - ไม่เบลอ
       - ไม่ดันข่าวลง
       - ขยายใหญ่ขึ้น
       - แสดงหมวดหมู่ทั้งหมด
    */
    .p-nav-categories {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;

        width: 100%;
        max-width: none;
        margin: 0;
        padding: 10px 12px 12px;

        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 5px;

        background: #111827;
        border-top: 2px solid #10b981;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        border-left: none;
        border-right: none;
        border-radius: 0 0 16px 16px;

        white-space: normal;

        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-4px);

        box-shadow: 0 18px 35px rgba(0, 0, 0, 0.35);

        backdrop-filter: none;
        -webkit-backdrop-filter: none;

        transition:
            max-height 0.25s ease,
            opacity 0.18s ease,
            transform 0.18s ease,
            visibility 0.18s ease;
    }

    .p-nav-categories.show {
        max-height: 850px;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
        overflow: visible;
    }

    .p-nav-categories a {
        display: flex;
        align-items: center;

        width: 100%;
        min-height: 43px;
        padding: 10px 14px;

        border-radius: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.045);

        color: #e5e7eb;
        background: transparent;

        font-size: 15px;
        font-weight: 800;
        line-height: 1.3;

        text-decoration: none;
        transition: 0.18s ease;
    }

    .p-nav-categories a:last-child {
        border-bottom: none;
    }

    .p-nav-categories a:hover {
        color: #34d399;
        background: rgba(16, 185, 129, 0.08);
    }

    .p-nav-categories a.active {
        color: #34d399;
        background: rgba(16, 185, 129, 0.12);
        border: 1px solid rgba(16, 185, 129, 0.35);
        box-shadow: inset 4px 0 0 #10b981;
    }

    body.dark .premium-navbar {
        background: #0f172a;
    }

    body.dark .p-nav-categories {
        background: #0f172a;
    }
}

/* =========================
   มือถือจอเล็กมาก
========================= */

@media (max-width: 420px) {
    .p-nav-top {
        min-height: 58px;
        padding: 9px 10px 9px 14px;
    }

    .p-nav-logo {
        font-size: 16px;
        max-width: calc(100vw - 118px);
    }

    .p-theme-btn,
    .p-menu-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        border-radius: 12px;
    }

    .p-menu-btn {
        font-size: 21px;
    }

    .p-nav-categories {
        left: 0;
        right: 0;
        width: 100%;
        padding: 9px 10px 11px;
        border-radius: 0 0 15px 15px;
    }

    .p-nav-categories.show {
        max-height: 850px;
        overflow: visible;
    }

    .p-nav-categories a {
        min-height: 41px;
        padding: 9px 13px;
        font-size: 14.5px;
        border-radius: 11px;
    }
}