/* استایل‌های اختصاصی برای صفحه جزئیات محصول */

/* بخش جزئیات محصول */
.product-detail-section {
    display: flex;
    flex-direction: row-reverse;
    gap: 40px;
    padding: 60px 40px;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    margin-top: 40px;
    min-height: 550px;
}

/* المان‌های تزئینی شبیه لنز */
.decorative-lens {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 70%),
                rgba(var(--primary-color), 0.08);
    backdrop-filter: blur(8px);
    animation: floatingLens 8s infinite ease-in-out;
    z-index: 0;
}

.decorative-lens.lens-1 {
    width: 250px;
    height: 250px;
    top: -80px;
    right: -100px;
    animation-delay: 0s;
}

.decorative-lens.lens-2 {
    width: 180px;
    height: 180px;
    bottom: -60px;
    left: -70px;
    animation-delay: 4s;
    opacity: 0.7;
}

@keyframes floatingLens {
    0% { transform: translate(0, 0) scale(0.9); opacity: 0.6; }
    25% { transform: translate(20px, -15px) scale(1); opacity: 0.7; }
    50% { transform: translate(0, 0) scale(0.9); opacity: 0.6; }
    75% { transform: translate(-20px, 15px) scale(1); opacity: 0.7; }
    100% { transform: translate(0, 0) scale(0.9); opacity: 0.6; }
}


/* بخش گالری تصاویر محصول */
.product-gallery {
    flex: 1;
    min-width: 380px;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 20px;
    background-color: var(--bg-light);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.main-image-wrapper {
    width: 100%;
    height: 400px;
    background-color: #fff;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
}

.main-image-wrapper img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.3s ease-out;
}

/* افکت بزرگنمایی (Magnifying Glass) */
.magnifying-lens {
    position: absolute;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    cursor: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    background-repeat: no-repeat;
    box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.85),
                0 0 10px rgba(0, 0, 0, 0.3);
    z-index: 10;
}
/* حالت نمایش لنز */
.magnifying-lens.active {
    opacity: 1;
}


.thumbnail-wrapper {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.thumbnail {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease, border 0.3s ease;
    border: 2px solid transparent;
    object-fit: cover;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.thumbnail:hover {
    opacity: 1;
    transform: translateY(-3px);
}

.thumbnail.active {
    opacity: 1;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);
    transform: scale(1.05);
}

/* بخش اطلاعات محصول */
.product-info {
    flex: 1.5;
    text-align: right;
    padding-top: 20px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.product-info h2 {
    font-size: 2.8rem;
    color: var(--text-color);
    margin-bottom: 15px;
    font-weight: 700;
}

.product-long-description {
    font-size: 1.1rem;
    color: var(--secondary-color);
    line-height: 1.8;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #eee;
}

.product-meta-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #eee;
    text-align: right;
}

.product-meta-details p {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-meta-details .attribute-value {
    font-weight: normal;
    color: var(--secondary-color);
    background-color: var(--bg-light);
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
}

/* Breadcrumbs (مسیر راهنما) */
.breadcrumbs {
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: var(--secondary-color);
}

.breadcrumbs ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    line-height: 1.2;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
}

.breadcrumbs li a {
    color: var(--secondary-color);
    transition: color var(--transition-speed) ease;
}

.breadcrumbs li a:hover {
    color: var(--primary-color);
}

.breadcrumbs .breadcrumb-separator {
    margin: 0 8px;
    color: #ccc;
    font-size: 0.8rem;
    transform: rotateY(180deg);
}
/* استایل آیکون‌ها در Breadcrumbs */
.breadcrumbs li a i, .breadcrumbs li span i {
    margin-left: 5px;
    color: var(--primary-color);
    font-size: 0.9rem;
}


.price-and-action {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: space-between; /* Keeps price wrapper and form separate */
    margin-top: auto;
}

/* Styles for prices on detail page */
.product-price-display-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align prices to the START (right in RTL) */
    line-height: 1.3;
    /* MODIFIED: Add flex-shrink to ensure it doesn't shrink too much */
    flex-shrink: 0;
}

.product-price-detail { /* Current (final) price */
    font-size: 2.2rem;
    color: var(--primary-color);
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.product-price-original-detail { /* Original price before discount */
    font-size: 1rem;
    color: #888;
    text-decoration: none;
    position: relative;
    display: inline-block;
    margin-bottom: 5px;
    white-space: nowrap;
}

.product-price-original-detail::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1.5px;
    background-color: #dc3545;
    transform: translateY(-50%) rotate(-5deg);
    transform-origin: center center;
}


.add-to-cart-form {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: flex-start; /* MODIFIED: Aligned to START (left in RTL) */
    margin-right: auto; /* MODIFIED: Pushes the form to the left, occupying remaining space */
    width: auto; /* Allow content to dictate width */
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-selector label {
    font-size: 1.1rem;
    color: var(--text-color);
    font-weight: bold;
    white-space: nowrap;
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.quantity-btn {
    background-color: var(--bg-light);
    border: none;
    padding: 8px 12px;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--primary-color);
    transition: background-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 45px;
    width: 45px;
}

.quantity-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-light);
    color: var(--secondary-color);
}

.quantity-value {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 0 5px;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-color);
    background-color: #fff;
    height: 45px;
}

.add-to-cart-btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.add-to-cart-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.25);
}

.add-to-cart-btn.clicked {
    animation: buttonClickFeedback 0.3s ease-in-out;
}

@keyframes buttonClickFeedback {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}


/* بخش محصولات مشابه */
.related-products-section {
    padding: 60px 0;
    background-color: var(--bg-light);
    text-align: center;
    margin-top: 40px;
    border-top: 1px solid #eee;
}

.related-products-section .section-title {
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: var(--primary-color);
    text-align: center;
}


/* انیمیشن‌های ورود */
.animated-fade-in {
    opacity: 0;
    animation: fadeIn 1s ease-out forwards;
}

.animated-slide-right {
    opacity: 0;
    transform: translateX(50px);
    animation: fadeInRight 1s ease-out forwards;
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}


.animated-slide-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1s ease-out forwards;
}

/* تاخیر در انیمیشن‌ها برای ظاهر شدن پشت سر هم */
.product-info h2.animated-slide-right { animation-delay: 0.2s; }
.product-info .breadcrumbs.animated-slide-right { animation-delay: 0s; }
.product-info .product-meta-details.animated-fade-in { animation-delay: 0.4s; }
.product-info .product-long-description.animated-fade-in { animation-delay: 0.6s; }
.product-info .price-and-action.animated-slide-up { animation-delay: 0.8s; }


/* ریسپانسیو بودن برای صفحه جزئیات محصول - تنظیمات برای تبلت (اغلب 769px تا 992px) */
@media (max-width: 992px) {
    .product-detail-section {
        flex-direction: column;
        align-items: center;
        padding: 40px 15px;
        gap: 30px;
        min-height: unset;
    }

    .product-info {
        order: 2;
        padding-top: 0;
        text-align: center;
    }
    .product-gallery {
        order: 1;
        padding-top: 0;
    }

    .product-gallery, .product-info {
        min-width: unset;
        width: 100%;
    }

    .product-info h2 {
        font-size: 2.2rem;
    }

    .product-meta-details {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .product-meta-details p {
        justify-content: center;
    }

    .price-and-action {
        flex-direction: column; /* MODIFIED: Stack price wrapper and form vertically */
        gap: 20px;
        justify-content: center; /* MODIFIED: Center items when stacked */
    }

    /* Price display alignment for smaller screens */
    .product-price-display-wrapper {
        align-items: center; /* Center prices for mobile/tablet */
        /* margin-left: 0; REMOVED: With flex-direction: column and justify-content: center on parent, this is no longer needed */
    }

    .add-to-cart-form {
        flex-direction: column;
        width: 100%;
        align-items: center;
        gap: 20px;
        margin-right: 0; /* REMOVED: Reset margin for full width on mobile/tablet */
    }

    .quantity-selector {
        width: auto;
        justify-content: center;
    }

    .product-price-detail {
        font-size: 2rem;
    }

    .add-to-cart-btn {
        width: 80%;
        max-width: 300px;
    }

    .decorative-lens.lens-1 {
        width: 180px;
        height: 180px;
        top: 10px;
        right: -50px;
    }

    .decorative-lens.lens-2 {
        width: 120px;
        height: 120px;
        bottom: 10px;
        left: -30px;
    }

    .breadcrumbs ul {
        justify-content: center;
    }
}

/* تغییرات جدید برای سایزهای کوچک‌تر گوشی (زیر 768px) */
@media (max-width: 768px) {
    .product-detail-section {
        flex-direction: column;
        padding-top: 20px;
    }

    .product-gallery {
        order: 1;
        padding-top: 0;
    }

    .product-info {
        order: 2;
        padding-top: 20px;
    }

    .breadcrumbs {
        display: none;
    }

    .main-image-wrapper {
        height: 350px;
    }
    .product-info h2 {
        font-size: 1.8rem;
    }
    .product-long-description {
        font-size: 1rem;
    }
    .add-to-cart-btn {
        padding: 12px 25px;
        font-size: 1.1rem;
        width: 90%;
    }
    .product-price-detail {
        font-size: 1.8rem;
    }
    .thumbnail-wrapper {
        gap: 10px;
    }
    .thumbnail {
        width: 70px;
        height: 70px;
    }
    /* Mobile quantity button adjustments */
    .quantity-btn {
        height: 40px;
        width: 40px;
        font-size: 1.1rem;
    }
    .quantity-value {
        min-width: 45px;
        height: 40px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .main-image-wrapper {
        height: 280px;
    }
    .product-info h2 {
        font-size: 1.6rem;
    }
    .product-long-description {
        font-size: 0.9rem;
    }
    .add-to-cart-btn {
        padding: 10px 20px;
        font-size: 1rem;
        width: 95%;
    }
    .product-price-detail {
        font-size: 1.6rem;
    }
    .thumbnail-wrapper {
        gap: 8px;
    }
    .thumbnail {
        width: 60px;
        height: 60px;
    }
    .decorative-lens.lens-1 {
        width: 120px;
        height: 120px;
        top: 5px;
        right: -30px;
    }
    .decorative-lens.lens-2 {
        width: 80px;
        height: 80px;
        bottom: 5px;
        left: -20px;
    }
    /* Further mobile quantity button adjustments */
    .quantity-btn {
        height: 35px;
        width: 35px;
        font-size: 1rem;
    }
    .quantity-value {
        min-width: 40px;
        height: 35px;
        font-size: 0.9rem;
    }
}