/* Frontend styling for Nam Product Features */

/* --- GALLERY SYSTEM --- */
.nam-product-gallery-container {
    max-width: 100%;
    margin-bottom: 25px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.nam-gallery-main-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background-color: #f7f7f7;
}

.nam-gallery-main-frame {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio default */
}

.nam-gallery-main-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), filter 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    filter: blur(0);
}

.nam-gallery-main-image.fade-out {
    opacity: 0.35;
    filter: blur(4px);
}

/* Overlay Controls */
.nam-gallery-control-btn {
    position: absolute;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.25s ease;
    z-index: 10;
}

.nam-gallery-control-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.nam-gallery-control-btn:hover {
    background: #fff;
    transform: scale(1.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.nam-gallery-control-btn.zoom {
    top: 15px;
    right: 15px;
}

.nam-gallery-control-btn.play {
    bottom: 15px;
    left: 15px;
}

/* Gallery Arrows */
.nam-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: #444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.85;
    pointer-events: auto;
    z-index: 10;
}

.nam-gallery-arrow:hover {
    background: #fff;
    color: #000;
    opacity: 1;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.nam-gallery-arrow.prev {
    left: 15px;
}

.nam-gallery-arrow.next {
    right: 15px;
}

.nam-gallery-arrow svg {
    width: 22px;
    height: 22px;
}

/* Thumbnails */
.nam-gallery-thumbnails-wrapper {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}

.nam-gallery-thumbnails {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
}

.nam-gallery-thumbnail-item {
    flex: 0 0 calc(25% - 8px);
    min-width: 60px;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.65;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.nam-gallery-thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nam-gallery-thumbnail-item:hover {
    opacity: 0.95;
    transform: translateY(-2px);
}

.nam-gallery-thumbnail-item.is-active {
    opacity: 1;
    border-color: #398D42; /* Matches the brand color profile */
    box-shadow: 0 4px 12px rgba(57, 141, 66, 0.2);
}

/* --- STAR RATING --- */
.nam-product-star-rating-container {
    display: inline-block;
    margin: 8px 0;
}

.nam-star-rating-stars {
    display: flex;
    gap: 2px;
}

.nam-star-item {
    font-size: 20px;
    line-height: 1;
}

.nam-star-item.filled {
    color: #FFD700; /* Bright yellow */
}

.nam-star-item.empty {
    color: #ccc;
}


/* --- PREV / NEXT NAVIGATION --- */
.nam-product-prev-next-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nam-prev-next-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #dcdcdc;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nam-prev-next-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    transition: transform 0.2s ease;
}

.nam-prev-next-btn:not(.disabled):hover {
    background: #f7f7f7;
    border-color: #999;
    color: #111;
}

.nam-prev-next-btn.prev:not(.disabled):hover svg {
    transform: translateX(-2px);
}

.nam-prev-next-btn.next:not(.disabled):hover svg {
    transform: translateX(2px);
}

.nam-prev-next-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #fdfdfd;
}


/* --- PDF DOWNLOAD LIST --- */
.nam-product-pdf-download-container {
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nam-pdf-download-item {
    display: block;
}

.nam-pdf-download-link {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    font-size: 16px;
    color: #38761d !important; /* Bold green color matching screenshot */
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.nam-pdf-download-link:hover {
    color: #275214 !important;
    text-decoration: underline;
}

/* Optionally show a small PDF download icon on hover */
.nam-pdf-download-link::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2338761d'%3E%3Cpath d='M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.nam-pdf-download-link:hover::before {
    transform: translateY(2px);
}


/* --- LIGHTBOX SYSTEM --- */
.nam-gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nam-gallery-lightbox.is-open {
    display: flex;
    opacity: 1;
}

.nam-lightbox-overlay-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.nam-lightbox-inner {
    position: relative;
    display: flex;
    width: 90%;
    max-width: 1050px;
    height: 80vh;
    max-height: 700px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 2;
    animation: namLightboxScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes namLightboxScaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.nam-lightbox-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #888;
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 10;
    line-height: 1;
}

.nam-lightbox-close:hover {
    color: #111;
    transform: scale(1.1);
}

.nam-lightbox-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fbfbfb;
    position: relative;
    height: 100%;
    border-right: 1px solid #f0f0f0;
}

.nam-lightbox-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.nam-lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.nam-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: #fff;
    width: 44px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 5;
}

.nam-lightbox-arrow:hover {
    background: rgba(0, 0, 0, 0.6);
}

.nam-lightbox-arrow.prev {
    left: 0;
    border-radius: 0 4px 4px 0;
}

.nam-lightbox-arrow.next {
    right: 0;
    border-radius: 4px 0 0 4px;
}

.nam-lightbox-arrow svg {
    width: 24px;
    height: 24px;
}

.nam-lightbox-right {
    width: 360px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-sizing: border-box;
    background: #fff;
    height: 100%;
}

.nam-lightbox-title {
    font-size: 18px;
    font-weight: 600;
    color: #222;
    margin-top: 0;
    margin-bottom: 24px;
    line-height: 1.4;
    padding-right: 30px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nam-lightbox-thumbs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    padding-bottom: 10px;
    align-content: start;
}

/* Custom scrollbar for thumbs grid */
.nam-lightbox-thumbs-grid::-webkit-scrollbar {
    width: 6px;
}
.nam-lightbox-thumbs-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.nam-lightbox-thumbs-grid::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.nam-lightbox-thumbs-grid::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.nam-lightbox-thumb {
    aspect-ratio: 1 / 1;
    border: 2px solid #eef0f2;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.nam-lightbox-thumb:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.nam-lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nam-lightbox-thumb.is-active {
    border-color: #00a859;
    box-shadow: 0 0 0 1px #00a859;
}

@media (max-width: 768px) {
    .nam-lightbox-inner {
        flex-direction: column;
        width: 95%;
        height: auto;
        max-height: 90vh;
    }
    .nam-lightbox-left {
        width: 100%;
        height: 60vh;
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }
    .nam-lightbox-right {
        display: none;
    }
    .nam-lightbox-close {
        color: #555;
        background: rgba(255, 255, 255, 0.8);
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        top: 15px;
        right: 15px;
        font-size: 24px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        z-index: 10;
        transform: none;
    }
    .nam-lightbox-close:hover {
        transform: scale(1.1);
        color: #111;
    }
    .nam-lightbox-arrow {
        width: 36px;
        height: 48px;
    }
}

/* --- PRODUCT DESCRIPTION --- */
.nam-product-description-container {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    margin: 15px 0;
}

.nam-product-description-container p {
    margin-top: 0;
    margin-bottom: 12px;
}

.nam-product-description-container p:last-child {
    margin-bottom: 0;
}

/* --- PRODUCT SHARE --- */
.nam-product-share-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 15px 0;
    font-family: inherit;
}

.nam-share-label {
    font-size: 15px;
    font-weight: 600;
    color: #555;
}

.nam-share-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nam-share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.nam-share-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

/* Positive Design styles (colored lines/background on white, solid color on hover) */
.nam-share-btn.facebook {
    border: 1.5px solid #1877f2;
    color: #1877f2;
    background: #fff;
}

.nam-share-btn.facebook:hover {
    background: #1877f2;
    color: #fff;
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
}

.nam-share-btn.zalo {
    border: 1.5px solid #0068ff;
    color: #0068ff;
    background: #fff;
}

.nam-share-btn.zalo:hover {
    background: #0068ff;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 104, 255, 0.3);
}

.nam-share-btn.email {
    border: 1.5px solid #555;
    color: #555;
    background: #fff;
}

.nam-share-btn.email:hover {
    background: #555;
    color: #fff;
    box-shadow: 0 4px 12px rgba(85, 85, 85, 0.3);
}

.nam-share-btn:hover svg {
    transform: scale(1.1);
}


/* --- PRODUCT TABS SYSTEM --- */
.nam-product-tabs-container {
    margin: 40px 0;
    width: 100%;
    font-family: inherit;
}

.nam-tabs-header-wrapper {
    border-bottom: 2px solid #eaeaea;
    margin-bottom: 20px;
}

.nam-tabs-headers {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 35px;
}

.nam-tab-header-item {
    font-size: 16px;
    font-weight: 700;
    color: #888;
    cursor: pointer;
    position: relative;
    padding: 12px 0;
    transition: all 0.25s ease;
    user-select: none;
}

.nam-tab-header-item:hover {
    color: #333;
}

.nam-tab-header-item.is-active {
    color: #398D42; /* Active Tab Color matching brand color */
}

.nam-tab-header-item.is-active::after {
    content: "";
    position: absolute;
    bottom: -2px; /* Line overlay */
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #398D42;
    animation: nam-tab-line-grow 0.2s ease-out forwards;
}

@keyframes nam-tab-line-grow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.nam-tabs-panels {
    min-height: 100px;
}

.nam-tab-panel {
    display: none;
    line-height: 1.6;
    color: #444;
}

.nam-tab-panel.is-active {
    display: block;
    animation: nam-tab-fade-in 0.3s ease-out forwards;
}

@keyframes nam-tab-fade-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.nam-no-content {
    color: #999;
    font-style: italic;
}


/* --- REVIEWS DISPLAY TAB (Fake Reviews Layout) --- */
.nam-reviews-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-top: 0;
    margin-bottom: 25px;
    line-height: 1.3;
}

.nam-reviews-list {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.nam-review-item {
    display: flex;
    gap: 20px;
    padding-bottom: 25px;
    margin-bottom: 25px;
    border-bottom: 1px dashed #e5e5e5;
}

.nam-review-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.nam-review-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #e6e6e6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.nam-review-avatar svg {
    width: 34px;
    height: 34px;
    fill: #b3b3b3;
    margin-top: 8px; /* Standard Gravatar head alignment */
}

.nam-review-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nam-review-rating {
    display: flex;
    gap: 2px;
}

.nam-review-meta {
    font-size: 14px;
    font-weight: 700;
    color: #444;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.nam-reviewer-name {
    color: #555;
}

.nam-review-separator {
    color: #bbb;
    font-weight: 400;
}

.nam-review-date {
    font-weight: 400;
    color: #888;
}

.nam-review-content {
    font-style: italic;
    font-size: 14.5px;
    line-height: 1.5;
    color: #666;
    margin-top: 6px;
}

.nam-no-reviews {
    color: #999;
    font-style: italic;
}

/* --- SWIPER GALLERY DETAILS SLIDER --- */
.swiper-gallery-layout {
    width: 100%;
    margin-bottom: 25px;
}

.swiper-gallery-layout .gallery-top {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
}

.swiper-gallery-layout .gallery-top .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: zoom-in;
}

.swiper-gallery-layout .gallery-top .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.swiper-gallery-layout .gallery-top .swiper-button-next,
.swiper-gallery-layout .gallery-top .swiper-button-prev {
    color: var(--wp--preset--color--primary, #398D42);
    background: rgba(255, 255, 255, 0.9);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.25s ease;
}

.swiper-gallery-layout .gallery-top .swiper-button-next::after,
.swiper-gallery-layout .gallery-top .swiper-button-prev::after {
    font-size: 18px;
    font-weight: 700;
}

.swiper-gallery-layout .gallery-top .swiper-button-next:hover,
.swiper-gallery-layout .gallery-top .swiper-button-prev:hover {
    background: #ffffff;
    transform: scale(1.08);
}

.swiper-gallery-layout .gallery-thumbs {
    margin-top: 12px;
    width: 100%;
    padding: 2px 0;
}

.swiper-gallery-layout .gallery-thumbs .swiper-slide {
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.55;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.swiper-gallery-layout .gallery-thumbs .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.swiper-gallery-layout .gallery-thumbs .swiper-slide:hover {
    opacity: 0.95;
    transform: translateY(-2px);
}

.swiper-gallery-layout .gallery-thumbs .swiper-slide.swiper-slide-thumb-active {
    opacity: 1;
    border-color: var(--wp--preset--color--primary, #398D42);
    box-shadow: 0 4px 12px rgba(57, 141, 66, 0.2);
}

.swiper-gallery-layout .gallery-thumbs.justify-center .swiper-wrapper {
    justify-content: center !important;
}
