:root {
    --product-primary: #4f46e5;
    --product-primary-dark: #4338ca;
    --product-secondary: #7c3aed;

    --product-background: #f5f7fb;
    --product-card: #ffffff;

    --product-text: #172033;
    --product-muted: #64748b;
    --product-border: #e5e9f0;

    --product-gradient:
        linear-gradient(
            135deg,
            var(--product-primary),
            var(--product-secondary)
        );

    --product-shadow:
        0 12px 40px rgba(15, 23, 42, 0.07);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--product-background);
    color: var(--product-text);
    font-family: 'IRAN-Rounded', Tahoma, Arial, sans-serif;
}

button,
input,
textarea,
select {
    font-family: inherit;
}

.product-details-page {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 45px 20px 70px;
    direction: rtl;
}

/* اطلاعات اصلی محصول */

.product-main-card {
    display: grid;
    grid-template-columns:
        minmax(0, 0.9fr)
        minmax(0, 1.1fr);

    gap: 38px;

    padding: 28px;

    border: 1px solid var(--product-border);
    border-radius: 24px;

    background: var(--product-card);
    box-shadow: var(--product-shadow);
}

/* تصویر محصول */

.product-gallery {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 440px;
    overflow: hidden;

    border: 1px solid #edf0f4;
    border-radius: 20px;

    background:
        linear-gradient(
            145deg,
            #f8fafc,
            #eef2f7
        );
}

.product-gallery img {
    display: block;

    width: 100%;
    height: 440px;
    padding: 20px;

    object-fit: contain;
    object-position: center;

    transition: transform 0.4s ease;
}

.product-gallery:hover img {
    transform: scale(1.04);
}

.product-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 31px;
    padding: 0 12px;

    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.92);
    color: var(--product-primary);

    font-size: 11px;
    font-weight: 900;

    box-shadow:
        0 7px 20px rgba(15, 23, 42, 0.12);

    backdrop-filter: blur(10px);
}

/* اطلاعات */

.product-information {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 8px 0;
}

.product-title {
    margin: 0 0 13px;

    color: var(--product-text);

    font-size: 28px;
    font-weight: 900;
    line-height: 1.7;
}

.product-description {
    margin: 0 0 22px;

    color: var(--product-muted);

    font-size: 13px;
    line-height: 2;
}

.product-price-box {
    display: flex;
    align-items: baseline;
    gap: 7px;

    margin-bottom: 24px;
    padding: 17px 19px;

    border: 1px solid #e0e7ff;
    border-radius: 15px;

    background:
        linear-gradient(
            135deg,
            #eef2ff,
            #f5f3ff
        );
}

.product-price-number {
    color: var(--product-primary);

    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.7px;
}

.product-price-unit {
    color: var(--product-muted);

    font-size: 12px;
    font-weight: 800;
}

/* اطلاعات برند و دسته‌بندی */

.product-meta-list {
    margin: 0 0 25px;
    padding: 0;
    overflow: hidden;

    border: 1px solid #e7eaf0;
    border-radius: 16px;

    list-style: none;
}

.product-meta-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;

    min-height: 54px;
    padding: 10px 16px;

    border-bottom: 1px solid #edf0f4;

    font-size: 13px;
}

.product-meta-item:last-child {
    border-bottom: 0;
}

.product-meta-title {
    color: var(--product-muted);
    font-weight: 700;
}

.product-meta-value {
    color: var(--product-text);
    font-weight: 900;
}

.product-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.product-category {
    display: inline-flex;
    align-items: center;

    min-height: 29px;
    padding: 0 10px;

    border-radius: 999px;

    background: #eef2ff;
    color: var(--product-primary);

    font-size: 10px;
    font-weight: 800;
}

/* موجودی */

.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    color: #16a34a;
}

.stock-status::before {
    width: 8px;
    height: 8px;

    border-radius: 50%;
    background: #22c55e;

    content: "";

    box-shadow:
        0 0 0 4px rgba(34, 197, 94, 0.12);
}

.stock-status.out-of-stock {
    color: #dc2626;
}

.stock-status.out-of-stock::before {
    background: #ef4444;

    box-shadow:
        0 0 0 4px rgba(239, 68, 68, 0.12);
}

/* دکمه‌های محصول */

.product-actions {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 11px;
    margin-top: auto;
}

.product-actions form {
    margin: 0;
}

.btn-add-to-cart,
.btn-favorite {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 49px;
    padding: 0 16px;

    border-radius: 13px;

    font-size: 13px;
    font-weight: 900;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

.btn-add-to-cart {
    border: 0;

    background: var(--product-gradient);
    color: #ffffff;

    box-shadow:
        0 10px 24px rgba(79, 70, 229, 0.24);
}

.btn-add-to-cart:hover {
    color: #ffffff;

    box-shadow:
        0 15px 30px rgba(79, 70, 229, 0.32);

    transform: translateY(-2px);
}

.btn-add-to-cart:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.btn-favorite {
    border: 1px solid #dce1e9;

    background: #ffffff;
    color: #475569;
}

.btn-favorite:hover {
    border-color: #ef4444;

    background: #fff1f2;
    color: #dc2626;

    transform: translateY(-2px);
}

/* کارت بخش‌ها */

.details-section {
    margin-top: 30px;
    padding: 25px;

    border: 1px solid var(--product-border);
    border-radius: 20px;

    background: var(--product-card);
    box-shadow: var(--product-shadow);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;

    margin-bottom: 22px;
    padding-bottom: 17px;

    border-bottom: 1px solid #edf0f4;
}

.section-header h2 {
    margin: 0;

    color: var(--product-text);

    font-size: 19px;
    font-weight: 900;
}

.section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 30px;
    padding: 0 11px;

    border-radius: 999px;

    background: #eef2ff;
    color: var(--product-primary);

    font-size: 11px;
    font-weight: 900;
}

/* مشخصات */

.specifications-list {
    overflow: hidden;

    border: 1px solid var(--product-border);
    border-radius: 15px;
}

.specification-row {
    display: grid;
    grid-template-columns:
        minmax(150px, 30%)
        1fr;

    min-height: 55px;

    border-bottom: 1px solid #e9ecf1;
}

.specification-row:last-child {
    border-bottom: 0;
}

.specification-title,
.specification-value {
    display: flex;
    align-items: center;

    padding: 13px 16px;

    font-size: 12px;
    line-height: 1.8;
}

.specification-title {
    background: #f8fafc;
    color: #334155;
    font-weight: 900;
}

.specification-value {
    color: var(--product-muted);
}

/* نظرات */

.comments-list {
    display: grid;
    gap: 13px;
}

.comment-card {
    padding: 18px;

    border: 1px solid #e8ebf1;
    border-radius: 15px;

    background: #fafbfc;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 11px;

    margin-bottom: 12px;
}

.comment-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;
    flex-shrink: 0;

    border-radius: 50%;

    background: var(--product-gradient);
    color: #ffffff;

    font-size: 16px;
    font-weight: 900;
}

.comment-user-name {
    margin: 0 0 4px;

    color: var(--product-text);

    font-size: 13px;
    font-weight: 900;
}

.comment-label {
    color: #94a3b8;
    font-size: 10px;
}

.comment-content {
    margin: 0;
    padding-right: 53px;

    color: var(--product-muted);

    font-size: 12px;
    line-height: 2;
}

/* فرم نظر */

.comment-form {
    margin-top: 18px;
    padding: 20px;

    border: 1px solid var(--product-border);
    border-radius: 16px;

    background: #f8fafc;
}

.comment-form label {
    display: block;
    margin-bottom: 9px;

    color: #334155;

    font-size: 13px;
    font-weight: 900;
}

.comment-form textarea {
    width: 100%;
    min-height: 130px;
    padding: 13px 15px;

    resize: vertical;

    border: 1px solid #dce2ea;
    border-radius: 12px;

    background: #ffffff;
    color: var(--product-text);

    font-size: 13px;
    line-height: 1.9;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.comment-form textarea:focus {
    border-color: #6366f1;

    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn-submit-comment {
    min-height: 43px;
    margin-top: 12px;
    padding: 0 20px;

    border: 0;
    border-radius: 11px;

    background: var(--product-primary);
    color: #ffffff;

    font-size: 12px;
    font-weight: 900;

    cursor: pointer;
}

.btn-submit-comment:hover {
    background: var(--product-primary-dark);
}

.success-message {
    margin-top: 15px;
    padding: 12px 15px;

    border: 1px solid #bbf7d0;
    border-radius: 11px;

    background: #f0fdf4;
    color: #15803d;

    font-size: 12px;
    font-weight: 800;
}

/* محصولات مشابه */

.related-products-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 17px;
}

.related-product-card {
    overflow: hidden;

    border: 1px solid var(--product-border);
    border-radius: 16px;

    background: #ffffff;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.related-product-card:hover {
    box-shadow:
        0 14px 35px rgba(79, 70, 229, 0.13);

    transform: translateY(-5px);
}

.related-product-image {
    display: block;

    width: 100%;
    height: 180px;

    overflow: hidden;

    background: #f1f4f8;
}

.related-product-image img {
    display: block;

    width: 100%;
    height: 100%;
    padding: 10px;

    object-fit: contain;

    transition: transform 0.35s ease;
}

.related-product-card:hover
.related-product-image img {
    transform: scale(1.06);
}

.related-product-content {
    padding: 15px;
}

.related-product-content h3 {
    margin: 0 0 9px;
    overflow: hidden;

    color: var(--product-text);

    font-size: 13px;
    font-weight: 900;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-product-price {
    display: flex;
    align-items: baseline;
    gap: 5px;

    margin-bottom: 13px;

    color: var(--product-primary);
}

.related-product-price strong {
    font-size: 15px;
    font-weight: 900;
}

.related-product-price span {
    font-size: 10px;
    font-weight: 700;
}

.related-product-link {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 39px;

    border: 1px solid #c7d2fe;
    border-radius: 10px;

    color: var(--product-primary);

    font-size: 11px;
    font-weight: 900;
    text-decoration: none;
}

.related-product-link:hover {
    background: var(--product-primary);
    color: #ffffff;
}

/* حالت خالی */

.empty-state {
    padding: 35px 15px;

    color: #94a3b8;

    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.related-empty {
    grid-column: 1 / -1;

    border: 2px dashed #dce1ea;
    border-radius: 15px;
}

/* تبلت */

@media (max-width: 1000px) {
    .product-main-card {
        grid-template-columns: 1fr;
    }

    .product-gallery {
        min-height: 380px;
    }

    .product-gallery img {
        height: 380px;
    }

    .related-products-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

/* موبایل */

@media (max-width: 650px) {
    .product-details-page {
        padding: 25px 12px 45px;
    }

    .product-main-card {
        gap: 22px;
        padding: 16px;
        border-radius: 17px;
    }

    .product-gallery {
        min-height: 290px;
    }

    .product-gallery img {
        height: 290px;
    }

    .product-title {
        font-size: 22px;
    }

    .product-price-number {
        font-size: 23px;
    }

    .product-actions {
        grid-template-columns: 1fr;
    }

    .details-section {
        padding: 17px;
        border-radius: 16px;
    }

    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .comment-content {
        padding-right: 0;
    }

    .related-products-grid {
        grid-template-columns: 1fr;
    }

    .related-product-image {
        height: 220px;
    }

    .specification-row {
        grid-template-columns: 1fr;
    }

    .specification-title {
        border-bottom: 1px solid #edf0f4;
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-gallery img,
    .related-product-card,
    .related-product-image img,
    .btn-add-to-cart,
    .btn-favorite {
        transition: none;
    }
}
