/* صفحة عرض المنتج - تصميم محسّن */

.product-detail-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: start;
}

/* قسم معرض الصور */
.product-image-gallery {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-image {
    width: 100%;
    height: 500px;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    position: relative;
}

.main-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.02) 100%);
    pointer-events: none;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
    transition: transform 0.5s ease, opacity 0.3s ease;
    opacity: 1;
}

.main-image:hover img {
    transform: scale(1.05);
}

/* الصور المصغرة */
.thumbnail-images {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
    justify-content: center;
    scrollbar-width: thin;
    scrollbar-color: #3f51b5 #f0f0f0;
}

.thumbnail-images::-webkit-scrollbar {
    height: 6px;
}

.thumbnail-images::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.thumbnail-images::-webkit-scrollbar-thumb {
    background: #3f51b5;
    border-radius: 10px;
}

.thumbnail-images .thumb {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.thumbnail-images .thumb:hover {
    border-color: #3f51b5;
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(63,81,181,0.3);
}

.thumbnail-images .thumb.active {
    border-color: #3f51b5;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #3f51b5;
}

/* شارة العلامة التجارية */
.brand-badge-detail {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10;
}

[dir="rtl"] .brand-badge-detail {
    right: auto;
    left: 20px;
}

.brand-badge-detail img {
    height: 30px;
    width: auto;
    object-fit: contain;
}

/* قسم معلومات المنتج */
.product-info-details {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.product-name {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    line-height: 1.3;
}

/* التقييم بالنجوم */
.product-rating {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

.product-rating .stars {
    font-size: 24px;
    display: flex;
    gap: 4px;
}

.product-rating .star {
    color: #e0e0e0;
    transition: color 0.3s;
}

.product-rating .star.filled {
    color: #ffc107;
    text-shadow: 0 2px 4px rgba(255,193,7,0.3);
}

.product-rating .star.half {
    background: linear-gradient(90deg, #ffc107 50%, #e0e0e0 50%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.product-rating .rating-text {
    color: #666;
    font-size: 15px;
    font-weight: 500;
}

/* السعر */
.product-price-details {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 20px;
    background: linear-gradient(135deg, #3f51b5 0%, #5c6bc0 100%);
    border-radius: 16px;
    color: white;
    box-shadow: 0 8px 24px rgba(63,81,181,0.3);
}

.original-price {
    text-decoration: line-through;
    color: rgba(255,255,255,0.7) !important;
    font-size: 1.1rem !important;
}

.discounted-price {
    color: white !important;
    font-weight: 700 !important;
    font-size: 2rem !important;
}

.discount-badge {
    background: rgba(255,255,255,0.2) !important;
    color: white !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    backdrop-filter: blur(10px);
}

/* الوصف */
.product-description {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border-right: 4px solid #3f51b5;
    color: #555;
    line-height: 1.8;
    font-size: 1rem;
}

[dir="rtl"] .product-description {
    border-right: none;
    border-left: 4px solid #3f51b5;
}

/* معلومات المخزون */
.product-stock-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}

.stock-item {
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
}

.stock-item:hover {
    border-color: #3f51b5;
    box-shadow: 0 4px 12px rgba(63,81,181,0.15);
    transform: translateY(-2px);
}

.stock-item svg {
    width: 24px;
    height: 24px;
    color: #3f51b5;
    flex-shrink: 0;
}

.stock-item > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stock-label {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stock-available {
    color: #4caf50;
}

.stock-sold {
    color: #ff9800;
}

/* صف إجراءات المنتج */
.product-actions-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.add-to-cart-form {
    flex: 1;
    display: flex;
    gap: 12px;
    align-items: center;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-selector label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    font-size: 0.95rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: white;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #3f51b5;
    transition: all 0.3s;
    font-weight: 600;
}

.qty-btn:hover {
    background: #3f51b5;
    color: white;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-input {
    width: 50px;
    height: 40px;
    text-align: center;
    border: none;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

[dir="rtl"] .qty-input {
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
}

.btn-add-to-cart {
    flex: 1;
    padding: 12px 24px;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    border: none;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(76,175,80,0.3);
    position: relative;
    overflow: hidden;
}

.btn-add-to-cart::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-add-to-cart:hover::before {
    width: 300px;
    height: 300px;
}

.btn-add-to-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(76,175,80,0.4);
}

.btn-add-to-cart:active {
    transform: translateY(0);
}

.btn-add-to-cart svg {
    width: 20px;
    height: 20px;
    z-index: 1;
}

.btn-add-to-cart span {
    z-index: 1;
}

/* زر المفضلة */
.favorites-button-row {
    margin-top: 0;
}

.favorites-button-row .btn-favorites {
    width: 100%;
    padding: 12px 24px;
    background: white;
    border: 2px solid #e91e63;
    color: #e91e63;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.favorites-button-row .btn-favorites::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(233,30,99,0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.favorites-button-row .btn-favorites:hover::before {
    width: 400px;
    height: 400px;
}

.favorites-button-row .btn-favorites:hover {
    background: #e91e63;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(233,30,99,0.3);
}

.favorites-button-row .btn-favorites svg {
    width: 20px;
    height: 20px;
    z-index: 1;
    transition: transform 0.3s;
}

.favorites-button-row .btn-favorites:hover svg {
    transform: scale(1.2);
}

.favorites-button-row .btn-favorites.in-favorites {
    background: #e91e63;
    color: white;
    border-color: #e91e63;
}

.favorites-button-row .btn-favorites.in-favorites svg {
    fill: white;
}

/* إشعار السلة */
#cart-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 32px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    display: none;
    opacity: 1;
}

#cart-notification.success {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
}

#cart-notification.error {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

/* استجابة للشاشات المتوسطة */
@media (max-width: 992px) {
    .product-detail-container {
        grid-template-columns: 1fr;
        gap: 30px;
        margin: 20px auto;
    }
    
    .product-image-gallery {
        position: relative;
        top: 0;
    }
    
    .main-image {
        height: 400px;
    }
    
    .product-name {
        font-size: 1.75rem;
    }
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 576px) {
    .product-detail-container {
        padding: 15px;
        margin: 15px auto;
    }
    
    .main-image {
        height: 300px;
        border-radius: 16px;
    }
    
    .thumbnail-images .thumb {
        width: 70px;
        height: 70px;
    }
    
    .product-name {
        font-size: 1.5rem;
    }
    
    .product-rating .stars {
        font-size: 20px;
    }
    
    .discounted-price {
        font-size: 1.5rem !important;
    }
    
    .product-stock-info {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .product-actions-row {
        flex-direction: column;
        padding: 16px;
    }
    
    .add-to-cart-form {
        flex-direction: column;
        width: 100%;
    }
    
    .quantity-selector {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn-add-to-cart {
        width: 100%;
        padding: 14px 24px;
    }
    
    .brand-badge-detail {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
    }
    
    [dir="rtl"] .brand-badge-detail {
        right: auto;
        left: 10px;
    }
}
