/* ===== جزییات محصول - Product Detail Page ===== */

.product-detail-page {
    padding-top: 100px;
    padding-bottom: 60px;
}

/* Product Layout */
.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

/* Product Images */
.pd-images {
    position: relative;
}

.pd-main-image {
    width: 100%;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
    cursor: pointer;
}

.pd-main-image img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    display: block;
    border-radius: 15px;
}

.pd-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.pd-thumb {
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    aspect-ratio: 1;
}

.pd-thumb:hover {
    border-color: var(--primary-color);
    opacity: 0.8;
}

.pd-thumb.active {
    border-color: var(--primary-color);
}

.pd-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pd-thumb-more {
    position: relative;
}

.pd-thumb-more .thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border-radius: 10px;
}

/* Product Info */
.pd-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pd-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.4;
}

.pd-short-desc {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.7;
}

.pd-price-section {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
}

.pd-price-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pd-price-current {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-color);
}

.pd-price-original {
    font-size: 1rem;
    color: #999;
    text-decoration: line-through;
}

/* Variant Selectors */
.pd-variants {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pd-variant-group h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.pd-color-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pd-color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #e0e0e0;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pd-color-swatch:hover,
.pd-color-swatch.active {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.pd-color-text {
    font-size: 10px;
    font-weight: 700;
}

.pd-size-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pd-size-btn {
    padding: 8px 20px;
    border: 2px solid #e0e0e0;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition);
}

.pd-size-btn:hover,
.pd-size-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* Actions */
.pd-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.pd-btn-cart {
    width:100%;
    flex: 1;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.4);
}

.pd-btn-cart:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.6);
}

.pd-btn-wishlist {
    padding: 14px 50px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    transition: var(--transition);
    font-weight: 700;
    font-size: 1rem;
}

.pd-btn-wishlist:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Features */
.pd-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.pd-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.pd-feature i {
    font-size: 1.3rem;
    color: var(--primary-color);
}

/* Tabs */
.pd-tabs-section {
    margin-top: 50px;
}

.pd-tabs {
    display: flex;
    gap: 5px;
    border-bottom: 3px solid #eee;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.pd-tab-btn {
    padding: 12px 25px;
    background: none;
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
    transition: var(--transition);
}

.pd-tab-btn:hover {
    color: var(--primary-color);
}

.pd-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.pd-tab-content {
    display: none;
    line-height: 1.8;
}

.pd-tab-content.active {
    display: block;
}

/* Tab content RTL alignment */
.pd-tab-inner {
    text-align: right;
    direction: rtl;
}

.pd-tab-inner p,
.pd-tab-inner li {
    margin-bottom: 0.75em;
}

.pd-tab-content h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

/* Attributes List */
.pd-attrs-list {
    list-style: none;
    padding: 0;
}

.pd-attrs-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
}

.pd-attrs-list li:last-child {
    border-bottom: none;
}

/* Comments */
.pd-comments-section {
    margin-top: 30px;
}

.pd-comment {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid #eee;
}

.pd-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.pd-comment-author {
    font-weight: 700;
    color: var(--text-dark);
}

.pd-comment-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.pd-comment-rating {
    display: flex;
    gap: 2px;
    color: #ffc107;
}

.pd-comment-body {
    font-size: 0.9rem;
    line-height: 1.7;
    color: #555;
}

.pd-comment-replies {
    margin-top: 15px;
    margin-right: 25px;
}

.pd-comment-reply {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border-right: 3px solid var(--primary-color);
}

/* Comment Form */
.pd-comment-form-section {
    margin-top: 30px;
    background: #f8f8f8;
    border-radius: 15px;
    padding: 25px;
}

.pd-comment-form-section h3 {
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.pd-form-field {
    margin-bottom: 15px;
}

.pd-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.pd-form-field input,
.pd-form-field textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.pd-form-field input:focus,
.pd-form-field textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

.pd-form-field textarea {
    resize: vertical;
    min-height: 120px;
}

.pd-star-rating {
    display: flex;
    flex-direction: row-reverse;
    gap: 5px;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.pd-star-rating .star {
    font-size: 28px;
    color: #e0e0e0;
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    user-select: none;
}

.pd-star-rating .star:hover,
.pd-star-rating .star:hover ~ .star {
    color: #ffc107;
    transform: scale(1.1);
}

.pd-star-rating .star.active,
.pd-star-rating .star.active ~ .star {
    color: #ffc107;
}

.pd-rating-text {
    font-size: 0.85rem;
    color: var(--text-light);
}

.pd-submit-btn {
    padding: 12px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.pd-submit-btn:hover {
    background: var(--primary-dark);
}

/* Related Products */
.pd-related-section {
    margin-top: 50px;
    width: 100%;
}

.pd-related-section h2 {
    font-size: 1.8rem;
    color: var(--secondary-color);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Grid: 4 columns desktop, 2 tablet, 1 mobile - fixed layout so items don't stack wrong */
.pd-related-section .products-grid,
.pd-related-section .menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 0;
    width: 100%;
}

/* Each card: flex column, same height, no overflow */
.pd-related-section .product-card-ht {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.pd-related-section .product-card-ht:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* Image container: fixed aspect ratio, no stretch */
.pd-related-section .product-card-ht .card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f5f5f5;
}

.pd-related-section .product-card-ht .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.pd-related-section .product-card-ht:hover .card-image img {
    transform: scale(1.05);
}

/* Card body: padding, flex grow */
.pd-related-section .product-card-ht .card-body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.pd-related-section .product-card-ht .card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pd-related-section .product-card-ht .card-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0;
    direction: ltr;
    text-align: right;
}

/* Image Gallery Modal */
.pd-gallery-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.95);
}

.pd-gallery-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pd-gallery-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    padding: 2rem;
}

.pd-gallery-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
    z-index: 2;
}

.pd-gallery-close:hover {
    background: rgba(255,255,255,0.4);
}

.pd-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
    z-index: 2;
}

.pd-gallery-nav:hover {
    background: rgba(255,255,255,0.4);
}

.pd-gallery-prev { right: -60px; }
.pd-gallery-next { left: -60px; }

.pd-gallery-main img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
}

.pd-gallery-thumbs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    overflow-x: auto;
    padding: 10px 0;
}

.pd-gallery-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.pd-gallery-thumb.active {
    border-color: white;
}

.pd-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Empty Comments */
.pd-comments-empty {
    text-align: center;
    padding: 40px;
    background: #f8f8f8;
    border-radius: 12px;
    color: var(--text-light);
    border: 2px dashed #e0e0e0;
}

/* Responsive */
@media (max-width: 992px) {
    .pd-related-section .products-grid,
    .pd-related-section .menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .product-detail-layout {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .pd-title {
        font-size: 1.4rem;
    }
    
    .pd-features {
        grid-template-columns: 1fr;
    }
    
    .pd-actions {
        flex-direction: column;
    }
    
    .pd-gallery-prev { right: 0; }
    .pd-gallery-next { left: 0; }

    .pd-related-section .products-grid,
    .pd-related-section .menu-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .pd-related-section h2 {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .pd-related-section .product-card-ht .card-body {
        padding: 0.875rem 1rem;
    }
    .pd-related-section .product-card-ht .card-title {
        font-size: 0.95rem;
    }
    .pd-related-section .product-card-ht .card-price {
        font-size: 1rem;
    }
}
