/**
 * Horizontal Product Scroller Styles
 * RTL-Compatible with smooth scrolling and auto-scroll support
 */

/* Section Container */
.horizontal-scroller-section {
    width: 100%;
    margin-bottom: 1.5rem;
    position: relative;
}

/* Header */
.scroller-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.scroller-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.scroller-view-more {
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(31, 41, 55, 0.05);
}

.scroller-view-more:hover {
    background: rgba(31, 41, 55, 0.1);
    transform: translateX(4px);
}

[dir="rtl"] .scroller-view-more:hover {
    transform: translateX(-4px);
}

/* Wrapper with Arrows */
.horizontal-scroller-wrapper {
    position: relative;
    padding: 0 60px;
}

/* Arrow Buttons */
.scroller-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    border: 1px solid rgba(31, 41, 55, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.scroller-arrow i {
    font-size: 1.2rem;
    color: #1f2937;
    transition: transform 0.3s ease;
}

.scroller-arrow:hover {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-color: transparent;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.scroller-arrow:hover i {
    color: white;
}

.scroller-arrow:active {
    transform: translateY(-50%) scale(1.05);
}

.scroller-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Arrow Positioning */
.scroller-arrow-left {
    left: 0;
}

.scroller-arrow-right {
    right: 0;
}

/* RTL Arrow Positioning */
[dir="rtl"] .scroller-arrow-left {
    left: auto;
    right: 0;
}

[dir="rtl"] .scroller-arrow-right {
    right: auto;
    left: 0;
}

/* Scrollable Container */
.scroller-container {
    overflow: hidden;
    position: relative;
    width: 100%;
    touch-action: pan-y;
}

.scroller-container:hover {
    cursor: grab;
}

.scroller-container.dragging {
    cursor: grabbing;
    user-select: none;
}

/* Track */
.scroller-track {
    display: flex;
    gap: 0;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* RTL Track */
[dir="rtl"] .scroller-track {
    direction: rtl;
}

/* Card Wrapper */
.scroller-card-wrapper {
    flex: 0 0 25%;
    min-width: 0;
}

/* Product Card Styles (inherit from main styles) */
.horizontal-scroller-section .product-card {
    background: #f8f9fa;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.horizontal-scroller-section .product-card::before {
    display: none;
}

.horizontal-scroller-section .product-card:hover {
    transform: none;
    box-shadow: none;
    background: #ffffff;
}

.horizontal-scroller-section .product-card:hover::before {
    opacity: 0;
}

.horizontal-scroller-section .product-image {
    width: 100%;
    height: 240px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 1rem;
}

.horizontal-scroller-section .product-image img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    transition: transform 0.35s ease;
}

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

.horizontal-scroller-section .product-badge {
    position: absolute;
    top: 12px;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #fff;
    padding: 0.35rem 0.8rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

[dir="rtl"] .horizontal-scroller-section .product-badge {
    right: 12px;
}

[dir="ltr"] .horizontal-scroller-section .product-badge {
    left: 12px;
}

.horizontal-scroller-section .wishlist-btn {
    position: absolute;
    top: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

[dir="rtl"] .horizontal-scroller-section .wishlist-btn {
    left: 12px;
}

[dir="ltr"] .horizontal-scroller-section .wishlist-btn {
    right: 12px;
}

.horizontal-scroller-section .wishlist-btn:hover {
    background: #1f2937;
    transform: scale(1.1);
}

.horizontal-scroller-section .wishlist-btn i {
    color: #1f2937;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.horizontal-scroller-section .wishlist-btn:hover i {
    color: white;
}

.horizontal-scroller-section .product-info {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.horizontal-scroller-section .product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #1e293b;
    line-height: 1.35;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7rem;
}

.horizontal-scroller-section .product-card:hover .product-title {
    color: #1f2937;
}

.horizontal-scroller-section .product-description {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0.875rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.horizontal-scroller-section .product-footer {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.horizontal-scroller-section .product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    text-align: start;
}

.horizontal-scroller-section .product-price .original-price {
    text-decoration: line-through;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
    display: block;
}

.horizontal-scroller-section .product-price .current-price {
    color: #1f2937;
    font-weight: 700;
    display: block;
}

.horizontal-scroller-section .add-to-cart {
    background: transparent;
    color: #1f2937;
    padding: 0.65rem 1.25rem;
    border-radius: 50px;
    border: 2px solid #1f2937;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.horizontal-scroller-section .add-to-cart:hover {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Icon-Only Add to Cart Button */
.horizontal-scroller-section .add-to-cart-icon {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #ffffff;
    border: none;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    flex-shrink: 0;
}

.horizontal-scroller-section .add-to-cart-icon:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.horizontal-scroller-section .add-to-cart-icon:active {
    transform: translateY(-1px) scale(0.98);
}

.horizontal-scroller-section .add-to-cart-icon.in-cart {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.horizontal-scroller-section .add-to-cart-icon.in-cart:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.horizontal-scroller-section .add-to-cart-icon.out-of-stock {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
    cursor: default;
}

.horizontal-scroller-section .add-to-cart-icon.out-of-stock:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.horizontal-scroller-section .add-to-cart-icon i {
    font-size: inherit;
}

.horizontal-scroller-section .out-of-stock {
    background: #f1f5f9;
    color: #64748b;
    padding: 0.65rem 1.25rem;
    border-radius: 50px;
    border: 2px solid #e2e8f0;
    font-weight: 600;
    cursor: not-allowed;
}

/* Progress Dots */
.scroller-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.scroller-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.scroller-dot.active {
    background: #1f2937;
    width: 24px;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .scroller-card-wrapper {
        flex: 0 0 33.333%;
    }
}

@media (max-width: 968px) {
    .horizontal-scroller-wrapper {
        padding: 0 50px;
    }

    .scroller-arrow {
        width: 40px;
        height: 40px;
    }

    .scroller-arrow i {
        font-size: 1rem;
    }

    .scroller-card-wrapper {
        flex: 0 0 50%;
    }

    .scroller-title {
        font-size: 1.5rem;
    }

    .horizontal-scroller-section .add-to-cart-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 1rem;
    }
}

@media (max-width: 640px) {
    .horizontal-scroller-wrapper {
        padding: 0 40px;
    }

    .scroller-arrow {
        width: 36px;
        height: 36px;
    }

    .scroller-arrow i {
        font-size: 0.9rem;
    }

    .scroller-card-wrapper {
        flex: 0 0 100%;
    }

    .scroller-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .scroller-title {
        font-size: 1.25rem;
    }

    .horizontal-scroller-section .product-image {
        height: 200px;
    }

    .horizontal-scroller-section .add-to-cart-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 0.95rem;
    }

    .horizontal-scroller-section .product-price {
        font-size: 1.1rem;
    }

    .horizontal-scroller-section .product-price .original-price {
        font-size: 0.75rem;
    }
}

/* Auto-scroll pause indicator */
.scroller-container.paused {
    /* Optional: Add visual indicator when auto-scroll is paused */
}

/* Smooth scrolling for keyboard navigation */
.scroller-container:focus {
    outline: 2px solid rgba(31, 41, 55, 0.3);
    outline-offset: 4px;
    border-radius: 8px;
}

/* RTL specific adjustments */
[dir="rtl"] .horizontal-scroller-section .product-info {
    text-align: right;
}

[dir="rtl"] .horizontal-scroller-section .product-footer {
    flex-direction: row-reverse;
}

[dir="rtl"] .horizontal-scroller-section .product-price {
    align-items: flex-end;
    text-align: end;
}

[dir="ltr"] .horizontal-scroller-section .product-info {
    text-align: left;
}

[dir="ltr"] .horizontal-scroller-section .product-footer {
    flex-direction: row;
}

[dir="ltr"] .horizontal-scroller-section .product-price {
    align-items: flex-start;
    text-align: start;
}
