/**
 * Recently Viewed Products Component Styles
 *
 * Horizontal scrollable product slider with navigation.
 * Navigation style matches homepage reviews/articles sliders.
 *
 * @package HelloElementorChild
 * @since 2.5.0
 */

/* ===== SECTION ===== */
.nt-recently-viewed-section {
    margin-bottom: var(--section-gap, 48px);
    padding-top: 16px;
}

.nt-recently-viewed-section .nt-section-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-dark, #1F2937);
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.2;
}

.nt-recently-viewed-section .nt-section-subtitle {
    font-size: 15px;
    color: #6B7280;
    text-align: center;
    margin-top: 0;
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ===== SLIDER WRAPPER (для позиционирования кнопок) ===== */
.nt-recently-slider {
    position: relative;
    padding: 0 28px; /* пространство для стрелок, не обрезает их */
    margin: 0 -28px; /* компенсация padding, чтобы карточки не сжимались */
}

/* ===== TRACK (SCROLLABLE) ===== */
.nt-recently-track {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding: 16px 4px;
    margin: -16px -4px;
}

.nt-recently-track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Центрирование когда мало карточек */
.nt-recently-track.few-items {
    justify-content: center;
}

/* ===== PRODUCT CARD ===== */
.nt-recently-track .nt-product-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    text-decoration: none;
    display: block;
    position: relative;
    flex-shrink: 0;
    width: calc((100% - 72px) / 4); /* 4 карточки с gap 24px */
    min-width: 240px;
    scroll-snap-align: start;
}

.nt-recently-track .nt-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Neo-Brutalism Badge */
.nt-recently-track .nt-product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    border: 2px solid #000000;
    border-radius: 6px;
    box-shadow: 2px 2px 0px 0px rgba(0,0,0,1);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    z-index: 2;
}

.nt-recently-track .nt-product-badge.hit {
    background: #2C3DF5;
    color: white;
}

.nt-recently-track .nt-product-badge.sale {
    background: #EF4444;
    color: white;
}

.nt-recently-track .nt-product-badge.new {
    background: #10B981;
    color: white;
}

.nt-recently-track .nt-product-badge.flagship {
    background: #FCD34D;
    color: #000000;
}

/* Image */
.nt-recently-track .nt-product-image {
    aspect-ratio: 1 / 1;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    overflow: hidden;
    color: #9CA3AF;
    font-size: 13px;
}

.nt-recently-track .nt-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Brand */
.nt-recently-track .nt-product-brand {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary, #2C3DF5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

/* Name */
.nt-recently-track .nt-product-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark, #1F2937);
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Rating */
.nt-recently-track .nt-product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.nt-recently-track .nt-product-stars {
    color: #FBBF24;
    font-size: 12px;
}

.nt-recently-track .nt-product-rating-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark, #1F2937);
}

.nt-recently-track .nt-product-rating-count {
    font-size: 12px;
    color: #6B7280;
}

/* Prices */
.nt-recently-track .nt-product-prices {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nt-recently-track .nt-product-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary, #2C3DF5);
}

.nt-recently-track .nt-product-price-old {
    font-size: 14px;
    color: #9CA3AF;
    text-decoration: line-through;
}

/* ===== NAVIGATION BUTTONS - стиль как на главной (reviews/articles) ===== */
.nt-recently-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 44px !important;
    height: 44px !important;
    background: white !important;
    border: 1px solid #E6E6FF !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
    z-index: 10 !important;
    transition: all 0.2s !important;
    padding: 0 !important;
}

.nt-recently-nav svg {
    width: 20px !important;
    height: 20px !important;
    stroke: var(--text-dark, #1F2937) !important;
}

.nt-recently-nav:hover:not(.disabled) {
    background: #F5F9FF !important;
}

.nt-recently-nav.disabled {
    opacity: 0.4 !important;
    cursor: default !important;
}

/* Позиция кнопок — внутри padding slider-wrapper */
.nt-recently-prev {
    left: 0;
}

.nt-recently-next {
    right: 0;
}

/* Скрываем навигацию когда мало товаров */
.nt-recently-slider.no-nav .nt-recently-nav {
    display: none;
}

/* ===== LOADING STATE ===== */
.nt-recently-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 300px;
}

.nt-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #E5E7EB;
    border-top-color: var(--primary, #2C3DF5);
    border-radius: 50%;
    animation: nt-spin 0.8s linear infinite;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 1400px) {
    .nt-recently-track .nt-product-card {
        width: calc((100% - 48px) / 3); /* 3 карточки */
    }
}

@media (max-width: 1024px) {
    .nt-recently-track .nt-product-card {
        width: calc((100% - 24px) / 2); /* 2 карточки */
        min-width: 220px;
    }

    .nt-recently-prev {
        left: 0;
    }

    .nt-recently-next {
        right: 0;
    }
}

@media (max-width: 768px) {
    .nt-recently-viewed-section .nt-section-title {
        font-size: 24px;
    }

    .nt-recently-viewed-section .nt-section-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }

    /* Hide nav buttons on mobile, use swipe */
    .nt-recently-nav {
        display: none;
    }

    .nt-recently-track {
        padding: 8px 0;
        margin: 0;
        gap: 16px;
        overflow-y: hidden;
    }

    .nt-recently-track .nt-product-card {
        width: 200px;
        min-width: 200px;
        padding: 16px;
    }

    .nt-recently-track .nt-product-name {
        font-size: 14px;
    }

    .nt-recently-track .nt-product-price {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .nt-recently-track .nt-product-card {
        width: 170px;
        min-width: 170px;
        padding: 12px;
    }

    .nt-recently-track .nt-product-name {
        font-size: 13px;
    }

    .nt-recently-track .nt-product-price {
        font-size: 16px;
    }

    .nt-recently-track .nt-product-badge {
        padding: 4px 8px;
        font-size: 9px;
    }
}
