/* =========================================
    SD NAVBAR - SHARED
========================================= */
#sd-section-nav {
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.15);
}
.sd-nav {
    width: 100%;
    z-index: 1000;
    transition: box-shadow 0.25s ease;
}
.sd-nav.is-sticky {
    position: fixed;
    top: 0;
    left: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.sd-nav-placeholder {
    display: none;
}
.sd-nav-placeholder.active {
    display: block;
}

/* =========================================
    DESKTOP NAV
========================================= */
.sd-nav-desktop {
    background: #fff;
    border-bottom: 1px solid #eee;
}
.sd-nav-desktop .sd-nav-inner {
    max-width: 1172px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 16px;
}
.sd-nav-desktop .sd-nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}
.sd-nav-desktop .sd-nav-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    height: 100%;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
    user-select: none;
}
.sd-nav-desktop .sd-nav-link:hover,
.sd-nav-desktop .sd-nav-link.open,
.sd-nav-desktop .sd-nav-link.active {
    color: #00A94F;
}
.sd-nav-desktop .sd-nav-link.active {
    border-bottom-color: #00A94F;
}
.sd-nav-desktop .sd-nav-link .sd-chevron {
    width: 12px;
    height: 12px;
    transition: transform 0.25s ease, opacity 0.2s ease;
    /* opacity: 0; */
    pointer-events: none;
    transform: rotate(0deg);
}
.sd-nav-desktop .sd-nav-link .sd-chevron path {
    fill: currentColor;
}
/* .sd-nav-desktop .sd-nav-link.open .sd-chevron,
.sd-nav-desktop .sd-nav-link:hover .sd-chevron {
    transform: rotate(180deg);
} */

/* --- Desktop Dropdown --- */
.sd-nav-dropdown {
    display: none;
    position: absolute;
    top: 110%;
    left: -20%;
    min-width: 380px;
    background: #fff;
    border: 1px solid #00A94F;
    border-radius: 24px;
    z-index: 1000;
    animation: sd-dropIn 0.2s ease;
    overflow: hidden;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.15);
}
.sd-nav-dropdown.show {
    display: block;
}
@keyframes sd-dropIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Dropdown simple links (ไม่มี subChildren) */
.sd-nav-dropdown > a {
    display: block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #999999;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sd-nav-dropdown > a:hover {
    background: #00A94F;
    color: #ffffff;
}
.sd-nav-dropdown > a.active {
    background: #00A94F;
    color: #ffffff;
}

@media screen and (min-width: 768px) {
    .sd-nav-desktop .sd-nav-inner {
        position: relative;
        z-index: 1000;
    }
}

/* =========================================
    DESKTOP DROPDOWN - ACCORDION (ระดับ 2)
    สำหรับ children ที่มี subChildren
========================================= */
/* .sd-dd-accordion {
    border-bottom: 1px solid #f0f0f0;
}
.sd-dd-accordion:last-child {
    border-bottom: none;
} */

/* Accordion header */
.sd-dd-acc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #999999;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    gap: 12px;
}
.sd-dd-acc-header:hover {
    color: #00A94F;
}
.sd-dd-acc-header.active,
.sd-dd-acc-header.open {
    background: #F4F4F4;
    color: #00A94F;
}

/* Accordion chevron */
.sd-dd-acc-header .sd-acc-chevron {
    width: 16px;
    height: 20px;
    margin-top: 3px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
    transform: rotate(0deg);
}
.sd-dd-acc-header .sd-acc-chevron path {
    fill: currentColor;
}
.sd-dd-acc-header.open .sd-acc-chevron {
    transform: rotate(180deg);
}

/* Accordion label */
.sd-dd-acc-label {
    flex: 1;
}

/* Accordion panel (subChildren) */
.sd-dd-acc-panel {
    display: none;
    background: #ffffff;
}
.sd-dd-acc-panel.show {
    display: block;
    animation: sd-fadeIn 0.2s ease;
}
.sd-dd-acc-panel a {
    display: block;
    padding: 12px 24px;
    padding-left: 44px;
    font-size: 16px;
    font-weight: 600;
    color: #999999;
    background: #F4F4F4;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    position: relative;
}
.sd-dd-acc-panel a::before {
    content: '•';
    position: absolute;
    left: 32px;
    color: inherit;
}
.sd-dd-acc-panel a:hover,
.sd-dd-acc-panel a.active {
    background: #00A94F;
    color: #fff;
}

/* --- Desktop Overlay --- */
.sd-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
}
.sd-nav-overlay.show {
    display: block;
}

/* =========================================
    MOBILE NAV
========================================= */
.sd-nav-mobile {
    display: none;
}
.sd-nav-mobile-bar {
    background: #00A94F;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
    user-select: none;
    box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.3);
}
.sd-nav-mobile-bar .sd-bar-label {
    color: #fff;
    font-size: 18px;
    line-height: 24px;
    font-weight: 600;
}
.sd-nav-mobile-bar .sd-bar-toggle {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    /* font-size: 22px;
    font-weight: 300; */
    line-height: 1;
}
.sd-nav-mobile-bar .sd-bar-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* --- Mobile Panel --- */
.sd-nav-mobile-panel {
    display: none;
    background: #fff;
    border-top: 1px solid rgba(255,255,255,0.3);
    max-height: 70vh;
    overflow-y: auto;
}
.sd-nav-mobile-panel.show {
    display: block;
    animation: sd-slideDown 0.25s ease;
}
@keyframes sd-slideDown {
    from { opacity: 0; max-height: 0; }
    to   { opacity: 1; max-height: 70vh; }
}

.sd-nav-mobile-panel .sd-mob-header {
    padding: 32px 16px 16px 16px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    color: #111111;
    /* border-bottom: 1px solid #eee; */
}

/* Mobile nav items (ระดับ 1) */
/* .sd-mob-item .sd-mob-label {
    border-bottom: 1px solid #EEEEEE;
}
.sd-mob-item:last-child .sd-mob-label {
    border-bottom: none;
} */
.sd-mob-item:last-child .sd-mob-link-inner {
    border-bottom: unset;
}
.sd-mob-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    padding-bottom: 0;
    font-size: 16px;
    font-weight: 600;
    color: #666666;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.sd-mob-link:hover {
    background: #F4F4F4;
}
.sd-mob-link.active {
    color: #00A94F;
}
.sd-mob-link.open {
    background: #F4F4F4;
    color: #00A94F;
}
.sd-mob-link-inner {
    display: flex;
    width: 100%;
    border-bottom: 1px solid #EEEEEE;
    padding-bottom: 16px;
}
.sd-mob-link.open .sd-mob-link-inner {
    border-bottom: unset;
}
.sd-mob-item:has(.sd-mob-link.open) {
    border-top: 1px solid #EEEEEE;
    border-bottom: 1px solid #EEEEEE;
}
.sd-mob-link .sd-mob-icon {
    width: 24px;
    height: 24px;
    /* margin-right: 10px; */
    flex-shrink: 0;
}
.sd-mob-link .sd-mob-icon svg {
    width: 100%;
    height: 100%;
}
.sd-mob-link .sd-mob-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sd-mob-link .sd-mob-chevron {
    width: 16px;
    height: 16px;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    transform: rotate(0deg);
}
.sd-mob-link .sd-mob-chevron path {
    fill: currentColor;
}
.sd-mob-link.active .sd-mob-chevron path {
    fill: #00A94F;
}
.sd-mob-link.open .sd-mob-chevron {
    transform: rotate(180deg);
}

/* Mobile sub-items (ระดับ 2) */
.sd-mob-sub {
    display: none;
    padding: 0 20px 20px 48px;
}
.sd-mob-sub.show {
    display: block;
    background: #F4F4F4;
    animation: sd-fadeIn 0.2s ease;
}
@keyframes sd-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.sd-mob-sub > a {
    display: block;
    font-size: 16px;
    margin-bottom: 16px;
    font-weight: 600;
    color: #666666;
    text-decoration: none;
    transition: color 0.15s;
}
.sd-mob-sub > a:last-child {
    margin-bottom: 0;
}
.sd-mob-sub > a:hover,
.sd-mob-sub > a.active {
    color: #00A94F;
    text-decoration: underline;
    font-weight: 600;
}

/* =========================================
    MOBILE - ACCORDION ระดับ 2 (subChildren)
    สำหรับ children ที่มี subChildren
========================================= */
/* .sd-mob-acc {
    border-bottom: 1px solid #f0f0f0;
}
.sd-mob-acc:last-child {
    border-bottom: none;
} */

/* Accordion header (ระดับ 2 ใน mobile) */
.sd-mob-acc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    /* padding: 10px 0; */
    font-size: 16px;
    font-weight: 600;
    color: #666666;
    cursor: pointer;
    transition: color 0.15s;
    user-select: none;
    gap: 8px;
    margin-bottom: 16px;
}
.sd-mob-acc:last-child .sd-mob-acc-header,
.sd-mob-acc:only-child .sd-mob-acc-header {
    margin-bottom: 0;
}
.sd-mob-acc-header:hover {
    color: #00A94F;
}
.sd-mob-acc-header.active,
.sd-mob-acc-header.open {
    color: #00A94F;
}

/* Accordion chevron (ระดับ 2 ใน mobile) */
.sd-mob-acc-header .sd-acc-chevron {
    width: 16px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 3px;
    transition: transform 0.25s ease;
    transform: rotate(0deg);
}
.sd-mob-acc-header .sd-acc-chevron path {
    fill: currentColor;
}
.sd-mob-acc-header.active .sd-acc-chevron path,
.sd-mob-acc-header.open .sd-acc-chevron path {
    fill: #00A94F;
}
.sd-mob-acc-header.open .sd-acc-chevron {
    transform: rotate(180deg);
}

/* Accordion panel (subChildren ใน mobile) */
.sd-mob-acc-panel {
    display: none;
    padding-left: 12px;
    margin-top: 16px;
}
.sd-mob-acc-panel.show {
    display: block;
    animation: sd-fadeIn 0.2s ease;
}
.sd-mob-acc-panel a {
    display: block;
    /* padding: 8px 0; */
    font-size: 16px;
    font-weight: 600;
    color: #666666;
    text-decoration: none;
    transition: color 0.15s;
    position: relative;
    padding-left: 14px;
    margin-bottom: 16px;
}
/* .sd-mob-acc-panel a:last-child {
    margin-bottom: 0;
} */
.sd-mob-acc-panel a::before {
    content: '•';
    position: absolute;
    left: 0;
    color: inherit;
}
.sd-mob-acc-panel a:hover,
.sd-mob-acc-panel a.active {
    color: #00A94F;
    text-decoration: underline;
}

/* =========================================
    KBANK HEADER ANIMATION
    ซ่อน #navigation-header ด้วย slide-up เมื่อ nav ใหม่ sticky
========================================= */
@media (min-width: 768px) {
    #navigation-header {
        transition: transform 0.3s ease;
    }
    #navigation-header.sd-header-hidden {
        transform: translateY(-100%);
    }
}

/* =========================================
    RESPONSIVE
========================================= */
@media (max-width: 767px) {
    .sd-nav-desktop { display: none !important; }
    .sd-nav-mobile  { display: block !important; }

    /* Mobile: fixed ตั้งแต่แรก อยู่ใต้ header 60px */
    .sd-nav {
        position: fixed;
        top: 60px;
        left: 0;
        box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    }
    .sd-nav-placeholder {
        display: block !important;
    }
    #sd-section-nav-placeholder {
        margin-top: -22px;
    }
    .sd-mob-acc:last-child .sd-mob-acc-panel.show a:last-child {
        margin-bottom: 0;
    }
}
@media (min-width: 768px) {
    .sd-nav-desktop { display: block !important; }
    .sd-nav-mobile  { display: none !important; }
}