/* ============================================================
   Product Show Page
   ============================================================ */

/* Layout */
.product-page { padding-top: 24px; padding-bottom: 48px; }
.product-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 48px;
    align-items: start;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* Gallery */
.product-gallery { position: relative; }
.main-img {
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f8f9fa;
    cursor: zoom-in;
}
.main-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    pointer-events: none;
}
.main-img:hover img { transform: scale(1.04); }

.thumb-list { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumb {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    flex-shrink: 0;
}
.thumb.active, .thumb:hover { border-color: var(--kgm-green-500); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* Product Info */
.product-header-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.product-cat-link { font-size: 13px; color: var(--kgm-green-500); font-weight: 600; }
.product-title { font-size: 28px; font-weight: 800; color: var(--kgm-green-900); margin-bottom: 12px; line-height: 1.3; }
.product-rating { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.product-rating-stars { color: var(--kgm-gold-400); font-size: 16px; }
.product-rating-score { font-weight: 700; font-size: 15px; }
.product-rating-count { color: #888; font-size: 13px; }

.product-price { margin-bottom: 20px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.product-price-current { font-size: 36px; font-weight: 800; color: var(--kgm-green-600); }
.product-price-old { font-size: 18px; color: #aaa; text-decoration: line-through; }
.product-desc { font-size: 15px; color: #555; line-height: 1.8; margin-bottom: 20px; }

/* Variants */
.variant-section { margin-bottom: 16px; }
.variant-section-color { margin-bottom: 20px; }
.variant-label { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.variant-label-value { color: var(--kgm-green-600); }
.variant-options { display: flex; gap: 8px; flex-wrap: wrap; }
.variant-btn {
    padding: 8px 18px;
    border-radius: 999px;
    border: 2px solid #e8ecef;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    font-family: inherit;
}
.variant-btn:hover, .variant-btn.active {
    border-color: var(--kgm-green-500);
    background: var(--kgm-green-600);
    color: white;
}
.variant-btn.sold-out { opacity: 0.5; cursor: not-allowed; }
.variant-btn.error-highlight { border-color: #ef4444; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}
.shake { animation: shake 0.4s ease; }

/* Quantity */
.qty-row { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.qty-ctrl {
    display: flex;
    align-items: center;
    border: 2px solid #e8ecef;
    border-radius: 999px;
    overflow: hidden;
}
.qty-btn {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--kgm-green-600);
    transition: all 0.2s;
}
.qty-btn:hover { background: var(--kgm-green-100); }
.qty-input {
    width: 52px;
    text-align: center;
    border: none;
    outline: none;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
}
.qty-stock { font-size: 13px; color: #888; }

/* Actions */
.product-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.product-actions .btn-primary,
.product-actions .btn-gold { flex: 1; justify-content: center; min-width: 140px; }
.wishlist-btn {
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.wishlist-btn.active { border-color: #e74c3c; color: #e74c3c; }

/* Meta info */
.product-meta {
    border-top: 1px solid #eee;
    padding-top: 16px;
    font-size: 13px;
    color: #888;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.product-meta i { color: var(--kgm-green-500); margin-right: 6px; }
.product-meta .sku-icon { color: #aaa; }

/* Tabs */
.product-tabs { margin-top: 48px; }
.tab-list {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e8ecef;
    margin-bottom: 20px;

}
.tab-btn {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    background: none;
    cursor: pointer;
    color: #888;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}
.tab-btn.active { color: var(--kgm-green-700); border-bottom-color: var(--kgm-green-600); }
.tab-panel {
    background: white;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.tab-empty { text-align: center; color: #aaa; padding: 32px 0; }

/* Reviews */
.review-item { padding: 16px 0; border-bottom: 1px solid #f5f7f5; }
.review-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.review-avatar {
    width: 36px;
    height: 36px;
    background: var(--kgm-green-500);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}
.review-name { font-weight: 700; font-size: 14px; }
.review-stars { color: var(--kgm-gold-400); font-size: 13px; }
.review-date { margin-left: auto; font-size: 12px; color: #aaa; }
.review-title { font-weight: 700; margin-bottom: 4px; }
.review-body { font-size: 14px; color: #555; line-height: 1.7; }

/* Review form */
.review-form { margin-top: 24px; }
.review-form h4 { font-weight: 700; margin-bottom: 16px; }
.rating-row { margin-bottom: 12px; }
.rating-row label.rating-heading { font-weight: 600; font-size: 14px; display: block; margin-bottom: 6px; }
.rating-stars { display: flex; gap: 4px; font-size: 28px; }
.rating-stars label { cursor: pointer; color: #d1d5db; transition: color .15s; }
.rating-stars label i.bi-star-fill { color: var(--kgm-gold-400); }

/* Related products */
.related-section { margin-top: 48px; }
.related-title { font-size: 22px; font-weight: 800; color: var(--kgm-green-800); margin-bottom: 20px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .product-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .product-title { font-size: 22px; }
    .product-price-current { font-size: 28px; }
    .product-price-old { font-size: 15px; }

    .thumb { width: 56px; height: 56px; }

    .product-actions { flex-direction: column; }
    .product-actions .btn-primary,
    .product-actions .btn-gold { flex: unset; width: 100%; }
    .wishlist-btn { width: 100%; height: 44px; border-radius: 999px; }

    .tab-panel { padding: 18px; }

    .qty-row { gap: 10px; }

    .related-title { font-size: 18px; }
}
