/* ============================================================
   Product – Shared variables
   ============================================================ */

:root {
    --sp-green:       #4a7c59;
    --sp-green-dark:  #3a6147;
    --sp-green-light: #e8f2ea;
    --sp-border:      #e2e2e2;
    --sp-text:        #333333;
    --sp-text-light:  #666666;
    --sp-radius:      4px;
    --sp-container:   1200px;
    --sp-sidebar-w:   220px;
    --sp-gap:         20px;
}

/* ============================================================
   Back button
   ============================================================ */

.sp-back-btn-wrap {
    padding: 0;
    margin: 36px auto 40px !important;
}

.sp-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.4;
    margin: 0;
    text-transform: none;
    color: #5E5E5E;
    cursor: pointer;
    text-decoration: none;
    min-height: unset;
}

/* ============================================================
   Breadcrumb
   ============================================================ */

.sp-breadcrumb {
    padding: 14px 0;
    font-size: 13px;
    color: var(--sp-text-light);
}

.sp-breadcrumb__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.sp-breadcrumb__list a {
    color: var(--sp-text-light);
    text-decoration: none;
}

.sp-breadcrumb__list a:hover {
    color: var(--sp-green);
    text-decoration: underline;
}

.sp-breadcrumb__sep {
    color: #bbb;
    margin: 0 2px;
}

/* ============================================================
   Archive – Layout
   ============================================================ */

.sp-archive {
    padding: 24px 0 60px;
}

.sp-archive__container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 255px 1fr;
    gap: 32px;
    align-items: start;
}

/* ============================================================
   Sidebar danh mục
   ============================================================ */
.sp-archive__sidebar {
  height: 100%;
}
.sp-sidebar {
    box-shadow: 0px 4px 20px 0px #00000014;
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
}

.sp-sidebar__nav {
    padding: 10px;
}

/* Link cha – mặc định: row xám với mũi tên ▼ */
.sp-sidebar__link--parent {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 15px;
    text-transform: none;
    margin: 0;
    min-height: unset;
    line-height: 1;
    width: 100%;
    font-size: 16px;
    font-weight: 600;
    color: #000000;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    gap: 8px;
    border-radius: 8px;
}

.sp-sidebar__link--parent:hover,
.sp-sidebar__link--parent.is-active {
    background: #004D21;
    color: #fff;
}

/* Link cha ACTIVE – green button nổi bật (giống screenshot) */
.sp-sidebar__item.is-active > .sp-sidebar__link--parent {
    background: var(--sp-green);
    color: #fff;
}

.sp-sidebar__item.is-active > .sp-sidebar__link--parent:hover {
    background: var(--sp-green-dark);
    color: #fff;
}

/* SVG arrow icon */
.sp-sidebar__arrow {
    flex-shrink: 0;
    transition: transform 0.25s;
    margin-left: auto;
}

/* Xoay mũi tên khi open */
.sp-sidebar__item.is-active > .sp-sidebar__link--parent .sp-sidebar__arrow,
.sp-sidebar__link--parent[aria-expanded="true"] .sp-sidebar__arrow {
    transform: rotate(180deg);
}

/* Danh sách con */
.sp-sidebar__children {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    display: none;
    background: #fff;
    border-top: 1px solid var(--sp-border);
    text-transform: none;
    min-height: unset;
    line-height: 1;
    width: 100%;
}

.sp-sidebar__children.is-open {
    display: block;
}

/* Link con */
.sp-sidebar__link--child {
    display: block;
    padding: 9px 9px 9px 30px;
    font-size: 16px;
    font-weight: 400;
    color: #868685;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    position: relative;
    text-transform: none;
    min-height: unset;
    width: 100%;
    text-align: left;
}

.sp-sidebar__link--child:hover,
.sp-sidebar__link--child.is-active {
    color: #3A6B00;
}

/* ============================================================
   Archive – Toolbar
   ============================================================ */

.sp-archive__toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.sp-archive__heading {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--sp-text);
}

/* Sort dropdown wrapper */
.sp-archive__sort {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.sp-archive__sort select {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(118, 172, 42, 0.42);
    border-radius: var(--sp-radius);
    padding: 7px 36px 7px 12px;
    font-size: 16px;
    color: rgba(94, 94, 94, 1);
    background: rgba(118, 172, 42, 0.15);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

.sp-archive__sort select:focus {
    border-color: var(--sp-green);
}

/* Mũi tên sort ▼ */
.sp-sort__arrow {
    position: absolute;
    right: 10px;
    pointer-events: none;
    width: 0;
    height: 0;
    top: 18px;
    border-left:  4px solid transparent;
    border-right: 4px solid transparent;
    border-top:   5px solid var(--sp-text-light);
}

/* ============================================================
   Product grid (archive)
   ============================================================ */

.sp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ============================================================
   Product card
   ============================================================ */

.sp-card {
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s;
    padding: 12px;
    box-shadow: 2px 2px 12px 0px #00000014;
}

.sp-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.sp-card__inner {
    display: block;
    text-decoration: none;
    color: inherit;
}

.sp-card__thumb {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eee;
    border-radius: 8px;
}

.sp-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.sp-card:hover .sp-card__thumb img {
    transform: scale(1.04);
}

.sp-card__thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8f2ea 0%, #c8dece 100%);
}

.sp-card__body {
    padding: 0;
    margin-top: 15px;
}

.sp-card__title {
    font-size: 16px;
    font-weight: 400;
    margin: 0 0 6px;
    line-height: 1.4;
    color: #000000;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-card__excerpt {
    font-size: 12px;
    color: var(--sp-text-light);
    margin: 0;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   Archive – Pagination
   ============================================================ */

.sp-pagination {
    margin-top: 32px;
    text-align: center;
}

.sp-pagination .page-numbers {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--sp-border);
    margin: 0 2px;
    border-radius: var(--sp-radius);
    font-size: 14px;
    color: var(--sp-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.sp-pagination .page-numbers.current,
.sp-pagination .page-numbers:hover {
    background: var(--sp-green);
    border-color: var(--sp-green);
    color: #fff;
}

.sp-archive__empty {
    color: var(--sp-text-light);
    padding: 40px 0;
    text-align: center;
}

/* ============================================================
   Single – Container
   ============================================================ */

.sp-single {
    padding: 0 0 60px;
}

.sp-single__container .sp-section {
    max-width: var(--sp-container);
    margin: 0 auto;
    padding: 0 16px;
}

.sp-single__container .sp-section.sp-section-content {
    max-width: 996px;
}

/* ============================================================
   Single – Hero (Ảnh + Thông số)
   ============================================================ */

.sp-single__hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
    margin-bottom: 60px;
}

/* --- Media (cột ảnh) --- */
.sp-single__media {
    position: sticky;
    top: 80px;
}

.sp-single__main-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 10px;
}

.sp-single__main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.25s;
}

.sp-single__img-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8f2ea, #c8dece);
}

/* Gallery thumbnails */
.sp-single__thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sp-single__thumb-btn {
    width: 68px;
    height: 68px;
    border: 2px solid var(--sp-border);
    border-radius: var(--sp-radius);
    overflow: hidden;
    padding: 0;
    background: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.sp-single__thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sp-single__thumb-btn:hover,
.sp-single__thumb-btn.is-active {
    border-color: var(--sp-green);
}

/* --- Info (cột phải) --- */
.sp-single__title {
    font-size: 32px;
    font-weight: 400;
    line-height: 1.35;
    margin: 0 0 8px;
    text-align: center;
    color: #004D21;
}
.sp-single__title + svg {
    display: block;
    margin: 0 auto 16px;
}

/* ============================================================
   Specs table
   ============================================================ */

.sp-specs {
    border: 1px solid #99A1AF;
    border-radius: 12px;
    overflow: hidden;
}

.sp-specs__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border-color: #99A1AF;
    border-radius: 12px;
    margin-bottom: 0;
}

.sp-specs__row {
    border-bottom: 1px solid #99A1AF;
}

.sp-specs__row.sp-specs__row-header .sp-specs__label,
.sp-specs__row.sp-specs__row-header .sp-specs__value {
  text-align: center;
}

.sp-specs__row:last-child {
    border-bottom: none;
}

.sp-specs__label {
    width: 38%;
    padding: 16px !important;
    font-weight: 400;
    color: #0A0A0A;
    font-size: 16px;
    white-space: nowrap;
    text-align: center;
    text-transform: none;
    border-right: 1px solid #99A1AF;
    border-bottom: 0;
}

.sp-specs__label.is-sp-pack {
    background-color: #FEF2F2;
    color: #C41E3A;
}

.sp-specs__value {
    padding: 16px !important;
    font-weight: 400;
    color: #0A0A0A;
    font-size: 16px;
    text-transform: none;
    border-bottom: 0;
}

/* Hàng giá */
.sp-specs__row--price .sp-specs__value {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.sp-specs__price {
    font-weight: 700;
    font-size: 15px;
    color: var(--sp-green);
}

.sp-specs__contact-btn-wrapper {
  display: flex;
  justify-content: center;
}
.sp-specs__contact-btn-wrapper.left {
  justify-content: flex-start;
  margin-left: 34px;
}

.sp-specs__contact-btn {
    display: inline-block;
    padding: 12px 60px;
    background: #76AC2A;
    color: #fff;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 500;
    text-decoration: none;
    margin-top: 24px;
    transition: background 0.2s;
}

.sp-specs__contact-btn:hover {
    background: #5A8C23;
    color: #fff;
    text-decoration: none;
}

/* ============================================================
   Sections (nội dung hiển thị thẳng, không accordion)
   ============================================================ */

.sp-sections {
    max-width: 996px;
    margin: 0 auto;
}

.sp-sections__item {
    padding: 24px 0;
}

.sp-sections__heading {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    line-height: 1.4;
    font-weight: 500;
    color: #3A6B00;
    margin: 0 0 20px;
}

.sp-sections__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--sp-green);
    flex-shrink: 0;
    position: relative;
}

.sp-sections__icon::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top:    5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left:   6px solid #fff;
    margin-left: 2px;
}

.sp-sections__body {
    padding-left: 34px;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 400;
    color: #5E5E5E;
}

.sp-sections__body p {
    margin: 0 0 12px;
}

.sp-sections__body img {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 12px 0;
    aspect-ratio: 16 / 9;
}

/* ============================================================
   Accordion (giữ lại cho tương thích nếu dùng ở nơi khác)
   ============================================================ */

.sp-accordion {
    margin-bottom: 40px;
}

.sp-accordion__item {
    border-bottom: 1px solid var(--sp-border);
}

.sp-accordion__item:first-child {
    border-top: 1px solid var(--sp-border);
}

.sp-accordion__trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    color: var(--sp-text);
}

.sp-accordion__trigger:hover .sp-accordion__heading {
    color: var(--sp-green);
}

/* Icon ▶ */
.sp-accordion__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--sp-green);
    flex-shrink: 0;
    position: relative;
    transition: background 0.2s;
}

/* Mũi tên phải bằng border trick */
.sp-accordion__icon::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top:    5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left:   6px solid #fff;
    margin-left: 2px;
    transition: transform 0.25s;
}

.sp-accordion__trigger[aria-expanded="true"] .sp-accordion__icon::before {
    transform: rotate(90deg);
    margin-left: 0;
}

.sp-accordion__trigger[aria-expanded="true"] .sp-accordion__icon {
    background: var(--sp-green-dark);
}

.sp-accordion__panel {
    overflow: hidden;
}

.sp-accordion__panel[hidden] {
    display: none;
}

.sp-accordion__body {
    padding: 4px 4px 20px 34px;
    font-size: 14px;
    line-height: 1.75;
    color: var(--sp-text-light);
}

.sp-accordion__body p {
    margin: 0 0 12px;
}

/* ============================================================
   Related products
   ============================================================ */

.sp-related {
    padding: 50px 15px;
    margin-top: 60px;
    background-color: #FFF8DE;
}

.sp-related > svg {
    display: block;
    margin: 0 auto 30px;
}

.sp-related__heading {
    font-size: 36px;
    font-weight: 600; 
    line-height: 1.4;
    margin: 0 0 20px;
    color: #5E5E5E;
    text-align: center;
}
.sp-related__slider .blog-slider__slide {
    flex: 0 0 25%; /* 4 cột – giữ cho backward compat */
}

/* Swiper overrides cho related products */
.sp-related-swiper {
    padding-bottom: 8px;
}

.sp-related-swiper .swiper-button-prev,
.sp-related-swiper .swiper-button-next {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    top: 50%;
}

.sp-related-swiper .swiper-button-prev::after,
.sp-related-swiper .swiper-button-next::after {
    font-size: 14px;
    color: var(--sp-green);
    font-weight: 700;
}

.sp-related__card {
    display: block;
    text-decoration: none;
    color: #000000;
    background-color: #fff;
    border-radius: 8px;
    padding: 12px;
}

.sp-related__card:hover {
    text-decoration: none;
    color: inherit;
}

.sp-related__thumb {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 15px;
}

.sp-related__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.sp-related__card:hover .sp-related__thumb img {
    transform: scale(1.04);
}

.sp-related__title {
    font-size: 16px;
    font-weight: 400;
    margin: 0 0 4px;
    line-height: 1.4;
    color: #000000;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-related__excerpt {
    font-size: 12px;
    color: var(--sp-text-light);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1024px) {
    .sp-single__hero {
        grid-template-columns: 1fr;
    }

    .sp-single__media {
        position: static;
    }

    .sp-single__main-image {
        aspect-ratio: 16 / 9;
    }

    .sp-related__slider .blog-slider__slide {
        flex: 0 0 33.333%;
    }
}

@media (max-width: 860px) {
    .sp-archive__container {
        grid-template-columns: 1fr;
    }

    .sp-sidebar {
        display: none; /* Toggle mở trên mobile nếu cần mở rộng sau */
    }

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

@media (max-width: 560px) {
    .sp-grid {
        grid-template-columns: 1fr;
    }

    .sp-related__slider .blog-slider__slide {
        flex: 0 0 50%;
    }
}

/* ============================================================
   AJAX Loading Overlay
   ============================================================ */

/* Wrap chứa grid + overlay */
#sp-products-wrap {
    position: relative;
    min-height: 200px; /* tránh collapse khi grid rỗng */
}

/* Overlay mờ đè lên grid */
.sp-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--sp-radius);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

#sp-products-wrap.is-loading .sp-loading-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Spinner xoay */
.sp-spinner {
    display: block;
    width: 36px;
    height: 36px;
    border: 3px solid var(--sp-green-light);
    border-top-color: var(--sp-green);
    border-radius: 50%;
    animation: sp-spin 0.75s linear infinite;
}

@keyframes sp-spin {
    to { transform: rotate(360deg); }
}

/* Grid mờ khi loading */
#sp-products-wrap.is-loading .sp-grid,
#sp-products-wrap.is-loading .sp-archive__empty {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.2s;
}
