﻿
.products-section {
    position: relative;
    padding: 60px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    overflow: hidden;
    width: 100%;
    direction: rtl;
}

    /* Alternating section backgrounds */
    .products-section:nth-child(even) {
        background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    }

    /* Add spacing between sections */
    .products-section + .products-section {
        margin-top: 40px;
    }

/* ===========================
   SECTION HEADER
   =========================== */

.section-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 0 20px;
}

.section-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 700;
    position: relative;
    display: inline-block;
}

    /* Decorative underline for titles */
    .section-title::after {
        content: '';
        position: absolute;
        bottom: -8px;
        left: 50%;
        transform: translateX(-50%);
        width: 80px;
        height: 3px;
        background: linear-gradient(90deg, var(--accent-gold), var(--secondary-color));
        border-radius: 2px;
    }

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-top: 20px;
}

/* ===========================
   PRODUCTS WRAPPER & CONTAINER
   =========================== */

.products-wrapper {
    position: relative;
    overflow: visible; /* ⚠️ CRITICAL: Clips cards outside view */
    margin: 0 auto;
    max-width: 100%;
    padding: 0 10px; /* Space for nav buttons */
}

.products-container {
    display: flex; /* ⚠️ CRITICAL: Horizontal layout */
    gap: 24px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    padding: 0; /* ⚠️ Remove any padding */
    margin: 0; /* ⚠️ Remove any margin */
}

    .products-container::-webkit-scrollbar {
        display: none;
    }

    .products-container:active {
        cursor: grabbing;
        scroll-behavior: auto;
    }

/* ===========================
   NAVIGATION BUTTONS - RTL FIXED
   =========================== */

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(38, 34, 97, 0.15);
    pointer-events: auto;
}

    .nav-button:hover:not(:disabled) {
        background: var(--primary-color);
        transform: translateY(-50%) scale(1.1);
    }

        .nav-button:hover:not(:disabled) svg {
            stroke: white;
        }

    .nav-button:active:not(:disabled) {
        transform: translateY(-50%) scale(0.95);
    }

    .nav-button:disabled {
        opacity: 0.3;
        cursor: not-allowed;
        pointer-events: none;
        background: var(--secondary-color);
        border-color: var(--border-light);
    }

    /* RTL CORRECTED POSITIONING */
    .nav-button.prev {
        right: 10px;
        left: auto;
    }

    .nav-button.next {
        left: 10px;
        right: auto;
    }

    .nav-button svg {
        width: 24px;
        height: 24px;
        stroke: var(--primary-color);
        fill: none;
        pointer-events: none;
        transition: stroke 0.3s ease;
    }

/* ===========================
   PRODUCT CARD
   =========================== */

.product-card {
    flex: 0 0 320px; /* ⚠️ CRITICAL: Must match JS cardWidth */
    width: 320px; /* ⚠️ Explicit width */
    min-width: 320px; /* ⚠️ Prevent shrinking */
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

    .product-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    }

/* ===========================
   IMAGE SLIDESHOW
   =========================== */
/* Container for all images */
/* Container for the image area */
.product-image-container {
    position: relative;
    width: 100%;
    height: 300px; /* Adjust as needed */
    overflow: hidden;
}

/* Container for all images */
.product-images {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    transition: transform 0.6s ease;
}

/* Individual images - side by side */
.product-image {
    flex: 0 0 100%;
    min-width: 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
   /* user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;*/
}

/* Image navigation dots */
.image-nav {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}

.image-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

    .image-dot.active {
        background: #fff;
        width: 24px;
        border-radius: 4px;
    }

/* Navigation arrows */
.image-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all 0.3s ease;
    opacity: 0;
}

.product-image-container:hover .image-arrow {
    opacity: 1;
}

.image-arrow.prev {
    left: 10px;
}

.image-arrow.next {
    right: 10px;
}

.image-arrow svg {
    width: 20px;
    height: 20px;
    color: #333;
}

.image-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

/* ===========================
   PRODUCT INFO
   =========================== */

.product-info {
    padding: 20px;
    text-align: right;
    direction: rtl;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    direction: rtl;
}

.price-currency {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-left: 4px;
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, var(--accent-gold), #c19a2e);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 6;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

/* ===========================
   PRODUCT ACTIONS (Like & Share) - FIXED
   =========================== */

.product-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 7;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    position: relative;
    overflow: visible; /* Changed to visible for tooltips */
}

    .action-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .action-btn:active {
        transform: scale(0.95);
    }

    .action-btn svg {
        width: 20px;
        height: 20px;
        stroke: var(--primary-color);
        fill: none;
        stroke-width: 2;
        transition: all 0.3s ease;
        pointer-events: none;
    }

/* Like Button Specific Styles */
.like-btn {
    position: relative;
    /*opacity:1;*/
}

    .like-btn .heart-icon {
        transition: all 0.3s ease;
        stroke: var(--primary-color);
        fill: none;
    }

    .like-btn .heart-filled {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
        fill: #ff4757;
        stroke: none;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .like-btn.liked .heart-icon {
        transform: scale(0);
        opacity: 0;
    }

    .like-btn.liked .heart-filled {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    .like-btn.liked {
        background: rgba(255, 71, 87, 0.1);
    }

    .like-btn:hover:not(.liked) .heart-icon {
        stroke: #ff4757;
    }

/* Animation for like button */
@keyframes heartBeat {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    25% {
        transform: translate(-50%, -50%) scale(1.3);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    75% {
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.like-btn.liked .heart-filled {
    animation: heartBeat 0.6s ease-in-out;
}

/* Share Button Specific Styles - FIXED */
.share-btn {
    position: relative;
}

    .share-btn svg {
        stroke: var(--primary-color);
        fill: none;
        stroke-width: 2;
    }

    .share-btn:hover {
        /*background: rgba(38, 34, 97, 0.1);*/
    }

        .share-btn:hover svg {
            stroke: var(--accent-gold);
            transform: rotate(15deg);
        }

/* Share Menu - FIXED */
.share-menu {
    position: absolute;
    top: 100%;
    right: 0; /* Changed from left to right for RTL */
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    min-width: 180px;
    pointer-events: none;
    direction: rtl;
}

    .share-menu.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

.share-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: right;
    font-family: inherit;
    font-size: 0.9rem;
    color: #333;
    direction: rtl;
}

    .share-menu-item:hover {
        background: var(--secondary-color);
    }

    .share-menu-item svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        fill: none;
        stroke-width: 2;
    }

    /* Specific colors for share menu items */
    .share-menu-item.whatsapp:hover {
        background: rgba(37, 211, 102, 0.1);
    }

    .share-menu-item.whatsapp svg {
        stroke: #25D366;
    }

    .share-menu-item.telegram:hover {
        background: rgba(0, 136, 204, 0.1);
    }

    .share-menu-item.telegram svg {
        stroke: #0088cc;
    }

    .share-menu-item.twitter:hover {
        background: rgba(29, 161, 242, 0.1);
    }

    .share-menu-item.twitter svg {
        stroke: #1DA1F2;
    }

    .share-menu-item.copy:hover {
        background: rgba(38, 34, 97, 0.1);
    }

    .share-menu-item.copy svg {
        stroke: var(--primary-color);
    }

/* Ripple effect for action buttons */
.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(38, 34, 97, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: -1;
}

.action-btn:active::before {
    width: 100px;
    height: 100px;
}

/* Like count badge */
.like-count {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: #ff4757;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

    .like-count.show {
        opacity: 1;
        transform: scale(1);
    }

/* Tooltip styles - FIXED */
.action-btn[title]::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.action-btn[title]:hover::after {
    opacity: 1;
    transition-delay: 0.5s;
}

/* Prevent tooltip when share menu is active */
.share-btn.active[title]::after {
    display: none;
}

/* ===========================
   FLOATING HEART ANIMATION
   =========================== */
@keyframes floatHeart {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
    }

    50% {
        opacity: 0.8;
        transform: translate(-50%, -100%) scale(1.5) rotate(15deg);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(0.5) rotate(0deg);
    }
}

.floating-heart {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    animation: floatHeart 1s ease-out forwards;
}

    .floating-heart svg {
        fill: #ff4757;
        stroke: none;
        filter: drop-shadow(0 2px 4px rgba(255, 71, 87, 0.5));
    }

/* ===========================
   COPY SUCCESS NOTIFICATION
   =========================== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideInRight 0.3s ease-out;
}

    .copy-notification.hiding {
        animation: slideOutRight 0.3s ease-out;
    }

    .copy-notification svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

.copy-notification-text {
    font-weight: 500;
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

@media (max-width: 1024px) {
    .products-container {
        padding: 20px 50px;
    }
}

@media (max-width: 768px) {
    .products-section {
        padding: 40px 0;
    }

    .section-title {
        font-size: 2rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    .products-container {
        padding: 20px 40px;
    }

    .product-card {
        flex: 0 0 280px;
    }

    .product-image-container {
        height: 200px;
    }

    .nav-button {
        width: 40px;
        height: 40px;
    }

        .nav-button svg {
            width: 20px;
            height: 20px;
        }

    .action-btn {
        width: 36px;
        height: 36px;
    }

        .action-btn svg {
            width: 18px;
            height: 18px;
        }

    .share-menu {
        min-width: 160px;
        font-size: 0.85rem;
    }

    .share-menu-item {
        padding: 8px 10px;
        gap: 10px;
    }

    /* Remove tooltips on mobile */
    .action-btn[title]::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .products-container {
        padding: 20px 30px;
    }

    .product-card {
        flex: 0 0 260px;
    }

    .nav-button.prev {
        right: 5px;
    }

    .nav-button.next {
        left: 5px;
    }
}

/* ===========================
   ACCESSIBILITY
   =========================== */

.nav-button:focus-visible,
.action-btn:focus-visible,
.image-arrow:focus-visible,
.image-dot:focus-visible {
    outline: 3px solid var(--accent-gold);
    outline-offset: 2px;
}

.share-menu-item:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
