/* Somsri Superstore — storefront navigation */
:root {
    --ss-red: #9b0707;
    --ss-red-dark: #760404;
    --ss-border: #e9e9ee;
    --ss-radius: 18px;
}
.ss-header,
.ss-header * {
    box-sizing: border-box;
}
.ss-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(110deg,#820505,#b10c0b 62%,#930606);
    color: #fff;
    box-shadow: 0 8px 24px #45080818;
    font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",Arial,sans-serif;
}
.ss-container {
    width: min(100% - 36px,1560px);
    margin-inline: auto;
}
.ss-announcement {
    background: #720303;
    border-bottom: 1px solid #ffffff20;
}
.ss-announcement-inner {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 12px;
    font-weight: 650;
}
.ss-main {
    display: flex;
    align-items: center;
    gap: clamp(10px,1.5vw,24px);
    padding-block: 15px;
    min-height: 88px;
}
.ss-logo {
    display: flex;
    flex: 0 0 auto;
    width: clamp(145px,16vw,232px);
    align-items: center;
    justify-content: flex-start;
    color: white;
    text-decoration: none;
}
.ss-logo img {
    width: 100%;
    max-height: 67px;
    object-fit: contain;
    object-position: left center;
}
.ss-logo-text {
    font-size: 21px;
    font-weight: 900;
    letter-spacing: -.04em;
}
.ss-nav {
    display: flex;
    gap: 3px;
    align-items: center;
    white-space: nowrap;
}
.ss-nav-link {
    border: 0;
    text-decoration: none;
    background: transparent;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 11px 9px;
    border-radius: 12px;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    cursor: pointer;
    line-height: 1.25;
}
.ss-nav-link:hover,
.ss-nav-link.active,
.ss-branch-trigger[aria-expanded="true"] {
    background: #ffffff23;
    color: #fff;
}
.ss-branch-dropdown {
    position: relative;
}
.ss-branch-menu {
    position: absolute;
    display: none;
    min-width: 240px;
    left: 0;
    top: calc(100% + 8px);
    padding: 8px;
    border: 1px solid #ececf0;
    border-radius: 16px;
    background: white;
    color: #273142;
    box-shadow: 0 18px 42px #2109092b;
    z-index: 1100;
}
.ss-branch-dropdown:hover .ss-branch-menu,
.ss-branch-dropdown:focus-within .ss-branch-menu,
.ss-branch-dropdown.is-open .ss-branch-menu {
    display: block;
}
.ss-branch-menu a {
    display: block;
    color: #273142;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    padding: 11px 13px;
    border-radius: 10px;
    white-space: normal;
}
.ss-branch-menu a:hover {
    background: #fff1f1;
    color: var(--ss-red);
}
.ss-search {
    min-width: 150px;
    max-width: 455px;
    flex: 1 1 260px;
    display: flex;
    align-items: center;
    gap: 9px;
    background: white;
    border-radius: 17px;
    padding: 5px 5px 5px 15px;
    color: #78869a;
    height: 54px;
}
.ss-search input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: #263348;
    font: inherit;
    font-size: 14px;
}
.ss-search input::placeholder {
    color: #9aa4b5;
}
.ss-search button {
    border: 0;
    border-radius: 12px;
    padding: 11px 17px;
    background: var(--ss-red);
    font-size: 13px;
    font-weight: 750;
    color: white;
    cursor: pointer;
    white-space: nowrap;
}
.ss-search button:hover {
    background: var(--ss-red-dark);
}
.ss-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.ss-action-dropdown {
    position: relative;
}
.ss-action-wrap {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 5px;
    justify-content: center;
    min-width: 48px;
    padding: 0;
    text-decoration: none;
    border: 0;
    background: transparent;
    color: white;
    cursor: pointer;
    font-family: inherit;
}
.ss-action {
    position: relative;
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    border-radius: 15px;
    background: #fff;
    color: var(--ss-red);
    font-size: 19px;
    transition: transform .18s;
}
.ss-action-wrap:hover .ss-action {
    transform: translateY(-2px);
}
.ss-action-label {
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    white-space: nowrap;
}
.ss-badge {
    position: absolute;
    top: -7px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 12px;
    background: #ffb900;
    border: 2px solid var(--ss-red);
    color: #6b0b0b;
    font-size: 10px;
    font-weight: 800;
    display: grid;
    place-items: center;
}
.ss-user-photo {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}
.ss-hover-panel {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(370px,calc(100vw - 28px));
    background: #fff;
    color: #243247;
    border: 1px solid #e8e9f0;
    border-radius: 20px;
    box-shadow: 0 18px 45px #32080830;
    z-index: 1101;
    overflow: hidden;
}
.ss-action-dropdown:hover .ss-hover-panel,
.ss-action-dropdown:focus-within .ss-hover-panel,
.ss-action-dropdown.is-open .ss-hover-panel {
    display: block;
}
.ss-panel-heading {
    padding: 15px 17px;
    border-bottom: 1px solid var(--ss-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
}
.ss-panel-heading > span {
    color: #8b94a4;
}
.ss-panel-content {
    max-height: 340px;
    overflow-y: auto;
    padding: 9px;
}
.ss-empty {
    min-height: 112px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #7c8798;
    text-align: center;
    font-size: 13px;
}
.ss-empty i {
    font-size: 22px;
    color: #aab3c0;
}
.ss-empty strong {
    color: #445266;
}
.ss-empty small {
    font-size: 11px;
}
.ss-panel-footer {
    padding: 14px 17px;
    background: #fff6f6;
    color: var(--ss-red);
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ss-cart-item {
    padding: 11px;
    border-bottom: 1px solid #f1f2f4;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.ss-cart-item small {
    color: #8994a3;
}
.ss-cart-total {
    padding: 14px 17px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    border-top: 1px solid var(--ss-border);
}
.ss-cart-total strong {
    color: var(--ss-red);
}
.ss-notice-item {
    padding: 12px;
    font-size: 13px;
}
.ss-notice-item p {
    font-size: 12px;
    color: #667085;
    margin-top: 5px;
}
.ss-menu-trigger {
    display: none;
}
.ss-mobile-menu {
    background: #fff;
    color: #17263c;
    border-top: 1px solid #ffffff25;
    padding: 8px 18px 18px;
    box-shadow: 0 22px 22px #0002;
}
.ss-mobile-menu[hidden],
.ss-mobile-branch-list[hidden] {
    display: none !important;
}
.ss-mobile-menu nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.ss-mobile-menu nav > a,
.ss-mobile-branch-toggle,
.ss-mobile-branch-list a {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    color: #283449;
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
}
.ss-mobile-menu nav > a:hover,
.ss-mobile-branch-list a:hover {
    background: #fff1f1;
    color: var(--ss-red);
}
.ss-mobile-branch-toggle {
    border: 0;
    background: #fff;
    justify-content: space-between;
    cursor: pointer;
}
.ss-mobile-branch-list {
    padding-left: 19px;
    border-left: 2px solid #f3e3e3;
    margin-left: 16px;
}
.ss-mobile-branch-list a {
    font-size: 13px;
}

/* Tablet */
@media (max-width: 1350px) {
    .ss-main {
        flex-wrap: wrap;
    }
    .ss-logo {
        width: 190px;
    }
    .ss-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    .ss-search {
        max-width: none;
    }
}

/* Mobile header */
@media (max-width: 820px) {
    .ss-container {
        width: min(100% - 26px,1560px);
    }
    .ss-main {
        min-height: 0;
        gap: 10px;
        padding: 12px 0;
    }
    .ss-logo {
        width: clamp(135px,30vw,190px);
    }
    .ss-logo img {
        max-height: 58px;
    }
    .ss-nav {
        display: none;
    }
    .ss-search {
        order: 3;
        flex: 1 0 100%;
        max-width: none;
        height: 46px;
    }
    .ss-actions {
        margin-left: auto;
        gap: 7px;
    }
    .ss-menu-trigger {
        display: flex;
    }
    .ss-action {
        width: 38px;
        height: 38px;
        border-radius: 13px;
        font-size: 18px;
    }
    .ss-action-label {
        font-size: 10px;
    }
    .ss-announcement-inner {
        font-size: 10px;
    }

    /* ใช้ส่วนหัวเป็นกรอบอ้างอิงแทนปุ่มไอคอน */
    #ss-header .ss-main {
        position: relative !important;
    }
    #ss-header .ss-actions,
    #ss-header #ssNotifyDropdown,
    #ss-header #ssCartDropdown {
        position: static !important;
    }

    /* แจ้งเตือนและตะกร้าอยู่ภายในความกว้างส่วนหัว */
    #ss-header #ssNotifyPanel,
    #ss-header #ssCartPanel {
        display: none !important;
        position: absolute !important;
        top: calc(100% + 8px) !important;
        right: 0 !important;
        left: auto !important;
        width: min(370px,100%) !important;
        max-width: 100% !important;
        min-width: 0 !important;
        max-height: max(
            120px,
            calc(100dvh - var(--ss-header-height,220px) - 96px)
        );
        box-sizing: border-box;
        transform: none !important;
        flex-direction: column;
        overflow: hidden;
    }

    /* เปิดด้วยปุ่ม เพื่อให้กดซ้ำหรือ Escape แล้วปิดได้ */
    #ss-header #ssNotifyDropdown.is-open > #ssNotifyPanel,
    #ss-header #ssCartDropdown.is-open > #ssCartPanel {
        display: flex !important;
    }

    #ss-header .ss-hover-panel .ss-panel-content {
        min-width: 0;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    #ss-header .ss-hover-panel :is(
        .ss-panel-heading,
        .ss-panel-footer,
        .ss-cart-total
    ) {
        flex-shrink: 0;
    }

    #ss-header .ss-hover-panel :is(strong,small,p) {
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* Small mobile */
@media (max-width: 430px) {
    .ss-announcement-inner {
        gap: 7px;
    }
    .ss-announcement-inner span:first-child {
        max-width: 52%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .ss-logo {
        width: 135px;
    }
    .ss-actions {
        gap: 5px;
    }
    .ss-action {
        width: 35px;
        height: 35px;
    }
    .ss-action-label {
        font-size: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ss-action {
        transition: none;
    }
}