:root {
    --product-blue: #55a6e9;
    --product-blue-dark: #1686d9;
    --product-blue-soft: #eff8ff;
    --product-border: #e5e7eb;
    --product-text: #111827;
    --product-muted: #667085;
    --product-page-bg: #f3f4f6;
    --product-white: #ffffff;
    --product-red: #ef1717;
    --product-radius: 8px;
    --product-transition: 0.18s ease;
}

.product-page,
.product-page * {
    box-sizing: border-box;
}

.product-page {
    min-height: 70vh;
    background: var(--product-page-bg);
    color: var(--product-text);
}

.product-page__container {
    width: min(1300px, calc(100% - 28px));
    margin: 0 auto;
    padding: 18px 0 38px;
}

.product-page__layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.product-content {
    min-width: 0;
}

/* =========================================================
   SIDEBAR DANH MỤC
========================================================= */

.product-sidebar {
    position: static;
    top: auto;
    align-self: start;
    max-height: none;
    overflow: visible;
}

.catalog-box {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--product-border);
    border-radius: 9px;
    background: var(--product-white);
}

.catalog-box__title {
    display: flex;
    align-items: center;
    min-height: 42px;
    margin: 0;
    padding: 10px 15px;
    border: 0;
    background: var(--product-blue);
    color: var(--product-white);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
}

.catalog-menu {
    max-height: 180px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 5px 0;
    background: var(--product-white);
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #8b929a #f3f4f6;
}

.catalog-menu::-webkit-scrollbar {
    width: 9px;
}

.catalog-menu::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.catalog-menu::-webkit-scrollbar-thumb {
    border: 2px solid #f3f4f6;
    border-radius: 999px;
    background: #8b929a;
}

.catalog-menu::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.catalog-menu__group,
.catalog-menu__row {
    border: 0;
}

.catalog-menu__row {
    position: relative;
    display: flex;
    align-items: stretch;
    background: transparent;
}

.catalog-menu__all,
.catalog-menu__link {
    display: flex;
    align-items: center;
    min-height: 34px;
    color: var(--product-text);
    font-size: 14px;
    line-height: 1.35;
    text-decoration: none;
    transition:
        color var(--product-transition),
        background-color var(--product-transition);
}

.catalog-menu__all {
    width: 100%;
    padding: 7px 14px 7px 15px;
    font-weight: 600;
}

.catalog-menu__link {
    flex: 1;
    min-width: 0;
    padding-top: 7px;
    padding-right: 10px;
    padding-bottom: 7px;
    font-weight: 400;
}

.catalog-menu__all:hover,
.catalog-menu__link:hover,
.catalog-menu__all.is-active,
.catalog-menu__link.is-active {
    background: var(--product-blue-soft);
    color: var(--product-blue-dark);
}

.catalog-menu__all.is-active,
.catalog-menu__link.is-active {
    font-weight: 600;
}

.catalog-menu__link--depth-0 {
    padding-left: 15px;
    font-weight: 600;
}

.catalog-menu__link--depth-1 {
    padding-left: 28px;
    font-weight: 500;
}

.catalog-menu__link--depth-2 {
    padding-left: 42px;
    font-size: 13px;
}

.catalog-menu__link--depth-3 {
    padding-left: 56px;
    font-size: 13px;
}

.catalog-menu__link--depth-4 {
    padding-left: 70px;
    font-size: 12px;
}

.catalog-menu__link--depth-5 {
    padding-left: 84px;
    font-size: 12px;
}

.catalog-menu__toggle {
    display: flex;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition:
        color var(--product-transition),
        background-color var(--product-transition);
}

.catalog-menu__toggle:hover {
    background: var(--product-blue-soft);
    color: var(--product-blue-dark);
}

.catalog-menu__toggle span {
    display: inline-block;
    transition: transform 0.2s ease;
}

.catalog-menu__group.is-open > .catalog-menu__row .catalog-menu__toggle span {
    transform: rotate(180deg);
}

.catalog-menu__children {
    display: none;
    padding: 2px 0 7px;
    background: #fafafa;
}

.catalog-menu__group.is-open > .catalog-menu__children {
    display: block;
}

.catalog-menu__children .catalog-menu__row {
    background: #fafafa;
}

.catalog-menu__empty {
    margin: 0;
    padding: 18px 15px;
    color: var(--product-muted);
    font-size: 13px;
    line-height: 1.5;
}

.product-sidebar__mobile-header,
.product-sidebar-toggle,
.product-page__overlay {
    display: none;
}

/* =========================================================
   KHỐI GIỚI THIỆU DANH MỤC
========================================================= */

.product-category-hero {
    position: relative;
    min-height: 164px;
    margin-bottom: 20px;
    overflow: hidden;
    border-left: 4px solid var(--product-blue);
    background:
        linear-gradient(
            135deg,
            #ffffff 0%,
            #f7fbff 52%,
            #dceeff 100%
        );
}

.product-category-hero::after {
    position: absolute;
    right: -80px;
    bottom: -120px;
    width: 480px;
    height: 250px;
    background: rgb(96 165 250 / 12%);
    content: "";
    transform: rotate(34deg);
    pointer-events: none;
}

.product-category-hero__content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    padding: 28px 30px;
}

.product-category-hero__title {
    margin: 0;
    color: #172033;
    font-size: 25px;
    font-weight: 700;
    line-height: 1.35;
}

.product-category-hero__description {
    max-width: 620px;
    margin: 14px 0 0;
    color: #334155;
    font-size: 15px;
    line-height: 1.7;
}

/* =========================================================
   TÌM KIẾM VÀ SẮP XẾP
========================================================= */

.product-search {
    margin-bottom: 10px;
    padding: 10px;
    background: var(--product-white);
}

.product-search__field {
    display: flex;
}

.product-search__field input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 13px;
    border: 1px solid #d8dde4;
    border-right: 0;
    border-radius: 4px 0 0 4px;
    outline: 0;
    background: var(--product-white);
    color: var(--product-text);
    font: inherit;
}

.product-search__field input:focus {
    border-color: var(--product-blue);
    box-shadow: 0 0 0 2px rgb(85 166 233 / 14%);
}

.product-search__field button {
    flex: 0 0 auto;
    padding: 0 20px;
    border: 0;
    border-radius: 0 4px 4px 0;
    background: var(--product-blue);
    color: var(--product-white);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color var(--product-transition);
}

.product-search__field button:hover {
    background: var(--product-blue-dark);
}

.product-sort-tabs {
    display: flex;
    align-items: center;
    min-height: 42px;
    margin-bottom: 10px;
    padding: 0 14px;
    overflow-x: auto;
    background: var(--product-white);
    border-top: 3px solid #dbeeff;
    scrollbar-width: thin;
}

.product-sort-tabs a {
    position: relative;
    display: block;
    flex: 0 0 auto;
    padding: 11px 16px 10px;
    color: #6b4f40;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
}

.product-sort-tabs a:hover,
.product-sort-tabs a.is-active {
    color: var(--product-text);
}

.product-sort-tabs a.is-active {
    font-weight: 700;
}

.product-sort-tabs a.is-active::after {
    position: absolute;
    right: 16px;
    bottom: -1px;
    left: 16px;
    height: 2px;
    background: #1fa0f2;
    content: "";
}

.product-filter-summary {
    margin-bottom: 10px;
    padding: 10px 13px;
    background: var(--product-white);
    color: #475467;
    font-size: 13px;
}

.product-filter-summary a {
    margin-left: 8px;
    color: var(--product-blue-dark);
    text-decoration: none;
}

/* =========================================================
   DANH SÁCH SẢN PHẨM
========================================================= */

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    background: #ededed;
}

.product-card {
    display: flex;
    min-width: 0;
    min-height: 355px;
    flex-direction: column;
    background: var(--product-white);
}

.product-card__image-link {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--product-white);
}

.product-card__image,
.product-card__image-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
}

.product-card__image {
    display: block;
    padding: 7px;
    object-fit: contain;
    transition: transform 0.25s ease;
}

.product-card:hover .product-card__image,
.product-card:focus-within .product-card__image {
    transform: scale(1.035);
}

.product-card__image-placeholder {
    display: grid;
    place-items: center;
    background: #f5f5f5;
    color: #98a2b3;
    font-size: 13px;
}

.product-card__discount,
.product-card__status {
    position: absolute;
    top: 14px;
    z-index: 2;
    border-radius: 10px;
    color: var(--product-white);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.product-card__discount {
    left: 16px;
    padding: 6px 8px;
    background: var(--product-red);
}

.product-card__status {
    right: 10px;
    padding: 6px 9px;
    background: var(--product-text);
}

.product-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 10px 14px 16px;
}

.product-card__name {
    display: -webkit-box;
    min-height: 44px;
    margin: 0;
    overflow: hidden;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.65;
    -webkit-box-orient: vertical;
}

.product-card__name a {
    color: var(--product-text);
    text-decoration: none;
}

.product-card__name a:hover {
    color: var(--product-blue-dark);
}

.product-card__sku {
    margin: 14px 0 0;
    color: var(--product-muted);
    font-size: 12px;
}

.product-card__sku strong {
    color: #475467;
    font-weight: 500;
}

.product-card__price {
    display: flex;
    min-height: 45px;
    flex-direction: column;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 5px;
}

.product-card__price strong {
    color: #ef0f5a;
    font-size: 18px;
    line-height: 1.35;
}

.product-card__price del {
    margin-top: 2px;
    color: #98a2b3;
    font-size: 13px;
}

.product-pagination {
    margin-top: 18px;
    padding: 14px;
    background: var(--product-white);
}

.product-empty {
    padding: 60px 20px;
    background: var(--product-white);
    text-align: center;
}

.product-empty__icon {
    font-size: 44px;
}

.product-empty h2 {
    margin: 12px 0 7px;
}

.product-empty p {
    margin: 0 0 20px;
    color: var(--product-muted);
}

.product-empty a {
    display: inline-block;
    padding: 11px 18px;
    border-radius: 5px;
    background: var(--product-blue);
    color: var(--product-white);
    font-weight: 700;
    text-decoration: none;
    transition: background-color var(--product-transition);
}

.product-empty a:hover {
    background: var(--product-blue-dark);
}

/* =========================================================
   FOCUS VÀ HỖ TRỢ BÀN PHÍM
========================================================= */

.catalog-menu__all:focus-visible,
.catalog-menu__link:focus-visible,
.catalog-menu__toggle:focus-visible,
.product-search__field button:focus-visible,
.product-sort-tabs a:focus-visible,
.product-empty a:focus-visible,
.product-sidebar__close:focus-visible,
.product-sidebar-toggle:focus-visible {
    outline: 2px solid var(--product-blue-dark);
    outline-offset: 2px;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1100px) {
    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .product-page__container {
        width: min(100% - 20px, 760px);
    }

    .product-page__layout {
        display: block;
    }

    .product-sidebar-toggle {
        display: flex;
        width: 100%;
        align-items: center;
        gap: 9px;
        margin-bottom: 10px;
        padding: 12px 14px;
        border: 0;
        border-radius: 5px;
        background: var(--product-blue);
        color: var(--product-white);
        font: inherit;
        font-weight: 700;
        cursor: pointer;
    }

    .product-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 90;
        display: block;
        width: min(330px, 88vw);
        padding: 0 12px 18px;
        overflow-y: auto;
        background: #f4f4f4;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
    }

    .product-sidebar.is-open {
        transform: translateX(0);
    }

    .product-sidebar__mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 56px;
    }

    .product-sidebar__close {
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 50%;
        background: #e5e7eb;
        color: var(--product-text);
        font-size: 24px;
        cursor: pointer;
    }

    .product-page__overlay {
        position: fixed;
        inset: 0;
        z-index: 80;
        background: rgb(0 0 0 / 48%);
    }

    body.product-sidebar-open {
        overflow: hidden;
    }

    .catalog-menu {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .product-category-hero {
        min-height: auto;
    }

    .product-category-hero__content {
        padding: 22px 20px;
    }

    .product-category-hero__title {
        font-size: 22px;
    }

    .product-category-hero__description {
        font-size: 14px;
    }
}

@media (max-width: 680px) {
    .product-search__field button {
        padding: 0 13px;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .product-card {
        min-height: 310px;
    }

    .product-card__body {
        padding: 9px 10px 13px;
    }

    .product-card__name {
        min-height: 40px;
        font-size: 13px;
        line-height: 1.55;
    }

    .product-card__sku {
        margin-top: 9px;
        font-size: 11px;
    }

    .product-card__price strong {
        font-size: 15px;
    }
}

@media (max-width: 390px) {
    .product-page__container {
        width: min(100% - 16px, 360px);
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .product-card__image,
    .product-card__image-placeholder {
        aspect-ratio: 4 / 3;
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-page *,
    .product-page *::before,
    .product-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}