/*
 * Product Page Styles (Complete & Updated)
*/

/* --- 1. General & Helpers --- */
.js-hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.js-visible {
    opacity: 1;
    visibility: visible;
}

.product-detail-section {
    padding: var(--section-padding);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0 0.5rem;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.breadcrumbs::-webkit-scrollbar {
    display: none;
}

.breadcrumbs a {
    color: var(--primary-blue);
    flex-shrink: 0;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--text-light);
}

.breadcrumbs span {
    color: var(--text-muted);
    flex-shrink: 0;
}

.breadcrumbs i {
    font-size: 0.6em;
    opacity: 0.6;
}

/* --- 2. Main Grid Layout (Desktop) --- */
.product-grid-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    background-color: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

@media (min-width: 992px) {
    .product-grid-main {
        grid-template-columns: 1.2fr 1fr;
        gap: 3rem;
    }
}

@media (min-width: 1400px) {
    .product-grid-main {
        grid-template-columns: 1.5fr 1fr;
    }
}

/* --- 3. Gallery Section --- */
.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    position: relative;
}

.product-main-slider {
    width: 100%;
    border-radius: var(--border-radius-md);
    overflow: hidden !important;
    position: relative;
    background-color: var(--bg-dark);
    padding: 0;
    box-sizing: border-box;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .product-main-slider {
        aspect-ratio: 16 / 9;
        background-color: transparent;
        border: none;
    }
}

.product-main-slider img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* Video Player */
.video-slide-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    z-index: 20;
}

.video-slide-content iframe, 
.video-slide-content .aparat-video-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border: 0; pointer-events: auto !important; z-index: 30;
}

/* Slider Buttons */
.product-main-slider .swiper-button-prev,
.product-main-slider .swiper-button-next {
    color: var(--primary-blue);
    width: 45px; height: 45px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.product-main-slider .swiper-button-prev::after,
.product-main-slider .swiper-button-next::after {
    font-size: 1.1rem;
    font-weight: bold;
}

/* Thumbnail Slider */
.product-thumb-slider {
    width: 100%;
    height: 70px;
    box-sizing: border-box;
    overflow: hidden !important;
    margin-top: 0.5rem;
}

.product-thumb-slider .swiper-slide {
    width: 70px !important;
    height: 70px;
    opacity: 0.5;
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    padding: 4px;
    background-color: var(--bg-card);
}

.product-thumb-slider .swiper-slide img {
    width: 100%; height: 100%; object-fit: contain;
}

.product-thumb-slider .swiper-slide-thumb-active {
    opacity: 1;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(62, 105, 254, 0.2);
}

/* --- 4. Info Section --- */
.product-info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.product-brand {
    font-size: 0.85rem;
    color: var(--primary-blue);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    background: rgba(62, 105, 254, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    align-self: flex-start;
}

.product-title {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    font-weight: 800;
    line-height: 1.4;
    color: var(--text-light);
    margin: 0;
}

/* Rating */
.product-rating-summary {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.product-rating-summary .stars i {
    color: #FFC107;
    font-size: 1rem;
}

.product-rating-summary .rating-text {
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 500;
}

.product-rating-summary .reviews-count-link {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.2s;
}
.product-rating-summary .reviews-count-link:hover {
    color: var(--primary-blue);
}

/* Price */
.product-price-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.5rem;
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.product-price-block .price-line {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-price-block .old-price {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-decoration: line-through;
    opacity: 0.7;
}

.product-price-block .discount-badge-large {
    background-color: var(--danger-red);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
}

.product-price-block .current-price,
.product-price-block .current-price-only {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-blue);
    text-shadow: 0 0 15px rgba(62, 105, 254, 0.2);
}

/* --- 5. Action Buttons (New Layout) --- */
.product-actions {
    display: flex;
    flex-direction: column; /* چیدمان عمودی برای همه حالت‌ها */
    gap: 1rem;
    margin-top: 1.5rem;
    width: 100%;
}

.add-to-cart-btn {
    width: 100%;
    background-color: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(62, 105, 254, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.add-to-cart-btn:hover {
    background-color: #2e5ae6;
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(62, 105, 254, 0.4);
}

/* دکمه‌های ثانویه (علاقه و اشتراک) */
.secondary-actions {
    display: flex;
    gap: 1rem;
}

.action-icon-btn {
    flex: 1; /* تقسیم فضا به صورت مساوی */
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.action-icon-btn i {
    font-size: 1.2rem;
}

.action-icon-btn:hover {
    background-color: rgba(62, 105, 254, 0.05);
    color: var(--text-light);
    border-color: var(--primary-blue);
}

.add-to-wishlist-btn.liked {
    color: var(--danger-red);
    background-color: rgba(230, 57, 70, 0.1);
    border-color: var(--danger-red);
}

.add-to-wishlist-btn.liked i {
    animation: heartBeat 0.4s forwards;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* --- 6. Tabs Section --- */
.product-tabs {
    margin-top: 3rem;
    background-color: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.tabs-header {
    display: flex;
    width: 100%;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
    gap: 0; 
    overflow-x: auto;
    scrollbar-width: none; 
}

.tabs-header::-webkit-scrollbar {
    display: none;
}

.tab-button {
    flex: 1; 
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1rem 0;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    text-align: center;
    transition: color 0.3s;
}

.tab-button:hover { color: var(--text-light); }
.tab-button.active { color: var(--primary-blue); }

.tab-button.active::after {
    content: '';
    position: absolute; bottom: -2px; left: 0; width: 100%; height: 3px;
    background-color: var(--primary-blue);
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -2px 10px rgba(62, 105, 254, 0.5);
}

.tabs-content .tab-pane {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.tabs-content .tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-pane div {
    font-size: 1.05rem; color: var(--text-muted); line-height: 2; text-align: justify;
}
.tab-pane div h2, .tab-pane div h3 {
    color: var(--text-light); margin-top: 1.5rem; margin-bottom: 1rem; font-weight: 700;
}
.tab-pane div ul, .tab-pane div ol { padding-right: 1.5rem; margin-bottom: 1.5rem; }
.tab-pane div li { margin-bottom: 0.5rem; }

/* ==========================================================================
   Responsive - Mobile Optimization (App Style)
   ========================================================================== */

@media (max-width: 768px) {
    /* 1. تنظیمات کلی */
    .product-detail-section {
        padding: 1rem 0;
        padding-bottom: 2rem; /* حذف فضای اضافه پایین */
    }

    .container {
        width: 100%;
        padding: 0 15px;
    }

    /* 2. شکستن گرید به کارت‌های زیر هم */
    .product-grid-main {
        display: flex;
        flex-direction: column;
        background-color: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        gap: 1rem;
    }

    /* 3. کارت گالری */
    .product-gallery {
        background-color: var(--bg-card);
        padding: 1rem;
        border-radius: 20px;
        border: 1px solid var(--border-color);
    }

    .product-main-slider {
        border: none;
        background-color: transparent;
        padding: 0;
        border-radius: 12px;
    }
    
    .product-main-slider .swiper-button-prev,
    .product-main-slider .swiper-button-next {
        display: none;
    }

    /* 4. کارت اطلاعات */
    .product-info-sidebar {
        background-color: var(--bg-card);
        padding: 1.5rem;
        border-radius: 20px;
        border: 1px solid var(--border-color);
    }

    .product-title {
        font-size: 1.4rem;
        text-align: right;
    }

    .product-rating-summary {
        width: 100%;
        justify-content: flex-start;
    }

    /* 5. کارت توضیحات */
    .product-tabs {
        margin-top: 1rem;
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    .tab-button {
        font-size: 1rem;
        padding: 0.8rem 0;
    }

    /* 6. دکمه‌ها در موبایل (عادی و غیرچسبان) */
    .product-actions {
        position: static;
        background-color: transparent;
        backdrop-filter: none;
        padding: 0;
        margin-top: 1.5rem;
        border: none;
        box-shadow: none;
    }

    .add-to-cart-btn {
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    .action-icon-btn {
        padding: 0.8rem;
    }
}

@media (max-width: 380px) {
    .product-price-block .current-price, 
    .product-price-block .current-price-only {
        font-size: 1.6rem;
    }
    .add-to-cart-btn {
        font-size: 0.9rem;
    }
}