/* بطاقة المنتج المحسنة */
.product-card {
    position: relative;
    overflow: hidden;
}

.product-image-wrapper {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.product-image-wrapper img {
    transition: transform 0.3s ease;
}

.product-card:hover .product-image-wrapper img {
    transform: scale(1.05);
}

.product-title-link {
    text-decoration: none;
    color: inherit;
}

.product-title-link:hover h3 {
    color: #3f51b5;
}

/* إجراءات بطاقة المنتج - جميع الأزرار في صف واحد */
.product-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
}

/* زر عرض التفاصيل */
.product-actions .btn-view-details {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 10px;
    background: white;
    border: 2px solid #3f51b5;
    color: #3f51b5;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
    box-sizing: border-box;
    min-height: 40px;
}

.product-actions .btn-view-details:hover {
    background: #3f51b5;
    color: white;
}

.product-actions .btn-view-details svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* زر إضافة للسلة السريع */
.product-actions .quick-add-to-cart {
    flex: 1;
    padding: 8px 12px;
    background: #4caf50;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    box-sizing: border-box;
    color: white;
    min-height: 40px;
}

.product-actions .quick-add-to-cart:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.product-actions .quick-add-to-cart svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* زر المفضلة في بطاقة المنتج */
.product-actions .btn-favorites,
.product-actions .btn-add-to-favorites {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    padding: 8px;
    background: #e91e63;
    border: 2px solid #e91e63;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-sizing: border-box;
    min-height: 40px;
}

.product-actions .btn-favorites:hover,
.product-actions .btn-add-to-favorites:hover {
    background: white !important;
    color: #e91e63 !important;
    border-color: #e91e63 !important;
}

.product-actions .btn-favorites:hover svg,
.product-actions .btn-add-to-favorites:hover svg {
    fill: #e91e63 !important;
    stroke: #e91e63 !important;
}

.product-actions .btn-favorites svg,
.product-actions .btn-add-to-favorites svg {
    width: 16px;
    height: 16px;
    fill: white;
    stroke: white;
    stroke-width: 2;
    flex-shrink: 0;
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 480px) {
    .product-actions {
        gap: 6px;
    }
    
    .product-actions .btn-view-details {
        padding: 6px 8px;
        font-size: 0.7rem;
        min-height: 36px;
    }
    
    .product-actions .quick-add-to-cart {
        padding: 6px 8px;
        font-size: 0.7rem;
        min-height: 36px;
    }
    
    .product-actions .btn-favorites,
    .product-actions .btn-add-to-favorites {
        flex: 0 0 36px;
        width: 36px;
        min-width: 36px;
        padding: 6px;
        min-height: 36px;
    }
    
    .product-actions .btn-view-details svg,
    .product-actions .quick-add-to-cart svg,
    .product-actions .btn-favorites svg,
    .product-actions .btn-add-to-favorites svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 360px) {
    .product-actions {
        gap: 4px;
    }
    
    .product-actions .btn-view-details,
    .product-actions .quick-add-to-cart {
        padding: 5px 6px;
        font-size: 0.65rem;
        min-height: 32px;
    }
    
    .product-actions .btn-favorites,
    .product-actions .btn-add-to-favorites {
        flex: 0 0 32px;
        width: 32px;
        min-width: 32px;
        padding: 5px;
        min-height: 32px;
    }
}

/* صفحة عرض المنتج المحسنة */
.product-detail-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
}

.product-image-section {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.product-image-main {
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    padding: 20px;
}

.product-image-main img {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 500px;
}

.product-info-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.product-title {
    font-size: 2rem;
    color: #333;
    margin: 0;
    line-height: 1.3;
}

.product-price-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.price-label {
    font-size: 1rem;
    opacity: 0.9;
}

.product-price-large {
    font-size: 2rem;
    font-weight: bold;
}

.product-description-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #3f51b5;
}

.product-description-box h3 {
    margin: 0 0 12px 0;
    color: #3f51b5;
    font-size: 1.1rem;
}

.product-description-box p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.add-to-cart-form-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 10px;
}

.quantity-selector-detail {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quantity-selector-detail label {
    font-weight: 600;
    color: #333;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0;
    width: fit-content;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.qty-minus {
    border-radius: 6px 0 0 6px;
}

.qty-plus {
    border-radius: 0 6px 6px 0;
}

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

.qty-input {
    width: 60px;
    height: 40px;
    text-align: center;
    border: 2px solid #ddd;
    border-left: none;
    border-right: none;
    font-size: 1rem;
    font-weight: 600;
}

.btn-add-to-cart-large {
    padding: 16px 32px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-add-to-cart-large:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .product-detail-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 20px auto;
    }
    
    .product-image-section {
        position: relative;
        top: 0;
    }
    
    .product-title {
        font-size: 1.5rem;
    }
    
    .product-price-large {
        font-size: 1.5rem;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .btn-view-details,
    .btn-add-to-cart-quick {
        width: 100%;
    }
}

/* تحسينات زر المفضلة في صفحة المنتج - تصميم أكثر تناسقاً */
.product-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
}

.product-actions-row .add-to-cart-form {
    flex: 1;
    display: flex;
    gap: 10px;
    align-items: center;
}

.product-actions-row .quantity-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.product-actions-row .quantity-controls {
    display: flex;
    align-items: center;
}

.product-actions-row .qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.product-actions-row .qty-btn:hover {
    background: #3f51b5;
    border-color: #3f51b5;
    color: white;
}

.product-actions-row .qty-input {
    width: 45px;
    height: 32px;
    text-align: center;
    border: 1px solid #ddd;
    border-left: none;
    border-right: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.product-actions-row .btn-add-to-cart {
    flex: 1;
    padding: 10px 16px;
    background: #4caf50;
    border: none;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.product-actions-row .btn-add-to-cart:hover {
    background: #45a049;
}

.product-actions-row .btn-add-to-cart svg {
    width: 18px;
    height: 18px;
}

/* صف زر المفضلة - يظهر تحت زر إضافة إلى السلة */
.favorites-button-row {
    margin-top: 12px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.favorites-button-row .btn-favorites {
    width: 50%;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e91e63;
    color: #e91e63;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}

[dir="ltr"] .favorites-button-row .btn-favorites {
    margin-right: 0;
    margin-left: 0;
}

[dir="rtl"] .favorites-button-row .btn-favorites {
    margin-left: 0;
    margin-right: 0;
}

.favorites-button-row .btn-favorites:hover {
    background: #e91e63;
    color: white;
    transform: scale(1.02);
}

.favorites-button-row .btn-favorites svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* حالة زر المفضلة عند إضافته */
.favorites-button-row .btn-favorites.in-favorites {
    background: #e91e63;
    color: white;
    border-color: #e91e63;
}

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

/* استجابة للشاشات الصغيرة */
@media (max-width: 576px) {
    .product-actions-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .product-actions-row .add-to-cart-form {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .product-actions-row .quantity-selector {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .product-actions-row .quantity-selector label {
        font-size: 0.85rem;
        margin-bottom: 0;
    }
    
    .product-actions-row .quantity-controls {
        flex: 1;
        justify-content: center;
    }
    
    .product-actions-row .qty-btn {
        width: 40px;
        height: 38px;
    }
    
    .product-actions-row .qty-input {
        width: 50px;
        height: 38px;
    }
    
    .product-actions-row .btn-add-to-cart {
        width: 100%;
        min-height: 48px;
        padding: 12px 16px;
    }
    
    .favorites-button-row {
        width: 100%;
        margin-top: 0;
    }
    
    .favorites-button-row .btn-favorites {
        width: 100% !important;
        min-height: 48px;
        padding: 12px 16px;
    }
    
    /* معلومات المخزون - تناسق */
    .product-stock-info {
        flex-direction: row;
        gap: 8px;
        margin: 15px 0;
    }
    
    .stock-item {
        padding: 10px 8px;
        flex: 1;
        gap: 8px;
    }
    
    .stock-item svg {
        width: 20px;
        height: 20px;
    }
    
    .stock-label {
        font-size: 0.65rem;
    }
    
    .stock-value {
        font-size: 1rem;
    }
}

/* =============================================== */
/* == Favorites Notification Styles == */
/* =============================================== */

.favorites-notification {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 25px;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.favorites-notification.show {
    opacity: 1;
    visibility: visible;
    top: 100px;
}

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

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

.favorites-notification span {
    text-align: center;
}

.favorites-notification .favorites-link {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
    font-size: 0.9rem;
    transition: opacity 0.2s;
    cursor: pointer;
}

.favorites-notification .favorites-link:hover {
    opacity: 0.8;
}

/* Loading spinner for favorites button */
.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty favorites message */
.empty-favorites-message {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.empty-favorites-message svg {
    color: #ccc;
    margin-bottom: 20px;
}

.empty-favorites-message p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 25px;
}

.empty-favorites-message .btn-continue-shopping {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, #3f51b5 0%, #5c6bc0 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.empty-favorites-message .btn-continue-shopping:hover {
    background: linear-gradient(135deg, #303f9f 0%, #3f51b5 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(63,81,181,0.3);
}


/* زر المفضلة في صفحة المفضلة - تأثير التمرير */
/* الحالة الافتراضية: خلفية بيضاء وقلب احمر */
.wishlist-page .product-actions .btn-favorites {
    padding: 10px 12px;
    background: white;
    border: 2px solid #e91e63;
    color: #e91e63;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

/* عند التمرير: خلفية حمراء وقلب ابيض */
.wishlist-page .product-actions .btn-favorites:hover {
    background: #e91e63 !important;
    color: white !important;
    border-color: #e91e63 !important;
}

.wishlist-page .product-actions .btn-favorites:hover svg {
    fill: white !important;
    stroke: white !important;
}

.wishlist-page .product-actions .btn-favorites svg {
    width: 18px;
    height: 18px;
    fill: #e91e63;
    stroke: #e91e63;
    stroke-width: 2;
    transition: all 0.3s ease;
}

/* حالة زر المفضلة عند إضافته في صفحة المفضلة */
.wishlist-page .product-actions .btn-favorites.in-favorites {
    background: #e91e63;
    color: white;
    border-color: #e91e63;
}

.wishlist-page .product-actions .btn-favorites.in-favorites svg {
    fill: white;
    stroke: white;
}

/* تأثير التمرير لزر المفضلة في صفحة المفضلة عندما يكون المنتج مضافاً */
.wishlist-page .product-actions .btn-favorites.in-favorites:hover {
    background: white !important;
    color: #e91e63 !important;
    border-color: #e91e63 !important;
    transform: scale(1.05);
}

.wishlist-page .product-actions .btn-favorites.in-favorites:hover svg {
    fill: #e91e63 !important;
    stroke: #e91e63 !important;
}
