/*
 * Minimized styles for Rankup Product Relations
 */

/* ========================================
ОСНОВНЫЕ СТИЛИ СЕКЦИИ
======================================== */
.rankup-product-relations-section {
    /* margin-top: 40px;
    border-top: 1px solid #eee;
    padding-top: 20px; */
    clear: both;
    overflow: hidden;
}

.rankup-product-relations-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8em;
    color: #333;
    font-weight: 600;
}

/* ========================================
SWIPER CAROUSEL STYLES
======================================== */
.rankup-swiper-container {
    position: relative;
    margin: 0 auto;
    --swiper-theme-color: #d10000;
    --swiper-navigation-color: var(--swiper-theme-color);
    --swiper-pagination-color: var(--swiper-theme-color);
}

.rankup-swiper-container .swiper {
    padding: 0;
    overflow: visible;
}

.rankup-swiper-container .swiper-wrapper {
    align-items: stretch;
}

.rankup-swiper-container .swiper-slide {
    height: auto;
    display: flex;
    align-items: stretch;
}

/* Swiper Navigation */
.rankup-swiper-container .swiper-button-next,
.rankup-swiper-container .swiper-button-prev {
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid #ddd;
    /* border-radius: 50%; */
    color: #333;
    transition: all 0.3s ease;
    margin-top: -22px;
}

.rankup-swiper-container .swiper-button-next::after,
.rankup-swiper-container .swiper-button-prev::after {
    font-size: 20px;
    font-weight: 700;
}

.rankup-swiper-container .swiper-button-next:hover,
.rankup-swiper-container .swiper-button-prev:hover {
    background: #d10000;
    color: #fff;
}

.rankup-swiper-container .swiper-button-next {
    right: 10px;
}

.rankup-swiper-container .swiper-button-prev {
    left: 10px;
}

/* ========================================
SWIPER PAGINATION STYLES
======================================== */
.rankup-swiper-container .swiper-pagination {
    position: relative;
    margin-top: 20px !important;
    bottom: auto;
    left: auto;
    right: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    height: auto;
}

/* Standard Bullets Pagination */
.rankup-swiper-container .swiper-pagination-bullet {
    background: #ccc;
    opacity: 0.5;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin: 0 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    outline: none;
}

.rankup-swiper-container .swiper-pagination-bullet-active {
    background: var(--swiper-theme-color, #d10000);
    opacity: 1;
    transform: scale(1.2);
}

.rankup-swiper-container .swiper-pagination-bullet:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

/* Dynamic Bullets Pagination */
.rankup-swiper-container .swiper-pagination-bullets-dynamic {
    overflow: hidden;
    font-size: 0;
    transform: translateX(0);
    position: relative;
    width: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
}

.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet {
    transform: scale(0.33);
    position: relative;
    margin: 0 2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.3;
}

.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active,
.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main {
    transform: scale(1);
    opacity: 1;
    background: var(--swiper-theme-color, #d10000);
}

.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev,
.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next {
    transform: scale(0.66);
    opacity: 0.7;
    background: var(--swiper-theme-color, #d10000);
}

.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev,
.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next {
    transform: scale(0.33);
    opacity: 0.4;
    background: var(--swiper-theme-color, #d10000);
}

.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet:hover {
    transform: scale(0.5);
    opacity: 0.8;
}

.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active:hover {
    transform: scale(1.1);
}

/* Fraction Pagination */
.rankup-swiper-container .swiper-pagination-fraction {
    font-family: inherit;
    font-size: 14px;
    color: #333;
    font-weight: 500;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rankup-swiper-container .swiper-pagination-current {
    color: var(--swiper-theme-color, #d10000);
    font-weight: 700;
    font-size: 16px;
}

.rankup-swiper-container .swiper-pagination-total {
    color: #666;
}

/* Progress Bar Pagination */
.rankup-swiper-container .swiper-pagination-progressbar {
    background: rgba(0, 0, 0, 0.1);
    /* border-radius: 10px; */
    height: 6px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.rankup-swiper-container .swiper-pagination-progressbar .swiper-pagination-progressbar-fill {
    background: var(--swiper-theme-color, #d10000);
    /* border-radius: 10px; */
    height: 10px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
}

/* ========================================
CSS GRID STYLES
======================================== */
.rankup-products-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(4, 1fr);
}

/* ========================================
ОБЩИЕ СТИЛИ ПРОДУКТОВ
======================================== */
.rankup-product-wrapper {
    background: #fff;
    border: 1px solid #e0e0e0;
    /* border-radius: 8px; */
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.rankup-product-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* ========================================
ИЗОБРАЖЕНИЯ ПРОДУКТОВ
======================================== */
.rankup-product-image {
    position: relative;
    overflow: hidden;
    background: #fff;
    aspect-ratio: 1;
    padding: 10px;
}

.rankup-product-image .product-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.rankup-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.rankup-hover-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.rankup-product-wrapper:hover .rankup-hover-image {
    opacity: 1;
}

/* ========================================
ИНФОРМАЦИЯ О ПРОДУКТЕ
======================================== */
.rankup-product-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.rankup-product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.rankup-product-title a {
    text-decoration: none;
    color: #333;
    transition: color 0.3s ease;
}

.rankup-product-title a:hover {
    color: #d10000;
}

.rankup-product-categories {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.rankup-product-price {
    font-weight: 700;
    font-size: 16px;
    color: #d10000;
    margin-bottom: 10px;
}

.rankup-product-price del {
    color: #999;
    font-weight: 400;
    font-size: 14px;
}

.rankup-product-rating {
    margin-bottom: 10px;
    font-size: 14px;
}

/* ========================================
ADD TO CART КНОПКИ
======================================== */
.rankup-add-to-cart {
    margin-top: auto;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.rankup-add-to-cart a,
.rankup-add-to-cart button {
    background: #d10000;
    color: #fff;
    border: none;
    padding: 10px 20px;
    /* border-radius: 4px; */
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    width: 100%;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* Темный overlay эффект при hover */
.rankup-add-to-cart a::before,
.rankup-add-to-cart button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.2), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}

.rankup-add-to-cart a:hover::before,
.rankup-add-to-cart button:hover::before {
    left: 100%;
}

.rankup-add-to-cart a:hover,
.rankup-add-to-cart button:hover {
    background: #b00000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(209, 0, 0, 0.3);
}

/* Состояние загрузки */
.rankup-add-to-cart a.loading,
.rankup-add-to-cart button.loading {
    color: transparent;
    cursor: not-allowed;
    pointer-events: none;
    background: #999;
}

/* Спиннер загрузки */
.rankup-add-to-cart a.loading::after,
.rankup-add-to-cart button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    /* border-radius: 50%; */
    animation: spin 0.8s linear infinite;
    z-index: 2;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Состояние успешного добавления */
.rankup-add-to-cart a.added,
.rankup-add-to-cart button.added {
    background: #4CAF50;
    animation: success-pulse 0.6s ease;
    color: transparent;
}

.rankup-add-to-cart a.added::after,
.rankup-add-to-cart button.added::after {
    content: '✓ Added';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: 600;
    animation: none;
    border: none;
    width: auto;
    height: auto;
    margin: 0;
    z-index: 2;
}

@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Анимация волны при клике */
.rankup-add-to-cart a:active:not(.loading),
.rankup-add-to-cart button:active:not(.loading) {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Эффект свечения при фокусе */
.rankup-add-to-cart a:focus,
.rankup-add-to-cart button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(209, 0, 0, 0.3);
}

/* Эффект нажатия */
.rankup-add-to-cart a:active:not(.loading),
.rankup-add-to-cart button:active:not(.loading) {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(209, 0, 0, 0.4);
}

/* ========================================
КНОПКИ ДЕЙСТВИЙ И BADGES
======================================== */
.rankup-product-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rankup-product-wrapper:hover .rankup-product-actions {
    opacity: 1;
}

.rankup-compare-btn,
.rankup-wishlist-btn {
    background: rgba(255, 255, 255, 0.9);
    /* border-radius: 50%; */
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
}

.rankup-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #d10000;
    color: #fff;
    padding: 4px 8px;
    /* border-radius: 4px; */
    font-size: 11px;
    font-weight: 600;
    z-index: 3;
}

/* ========================================
СКРЫТИЕ VIEW CART КНОПКИ
======================================== */
.rankup-product-relations-section .added_to_cart,
.rankup-product-relations-section a[href*="cart"]:not(.add_to_cart_button),
.rankup-product-wrapper .added_to_cart,
.rankup-product-wrapper a.added_to_cart {
    display: none !important;
}

.rankup-product-relations-section .woocommerce-message,
.rankup-product-relations-section .woocommerce-info {
    display: none !important;
}

.rankup-add-to-cart .added_to_cart {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ========================================
ACCESSIBILITY
======================================== */
.rankup-swiper-container .swiper-pagination-bullet:focus {
    outline: 2px solid var(--swiper-theme-color);
    outline-offset: 2px;
}

.rankup-swiper-container .swiper-pagination-bullet[aria-current="true"] {
    background: var(--swiper-theme-color);
    opacity: 1;
}

.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet:focus {
    outline: 2px solid var(--swiper-theme-color);
    outline-offset: 2px;
    transform: scale(0.5);
}

.rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active:focus {
    transform: scale(1.1);
}

/* ========================================
АДАПТИВНЫЕ СТИЛИ
======================================== */
@media (max-width: 1023px) {
    .rankup-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .rankup-swiper-container .swiper {
        /* padding: 0 40px; */
    }
    
    .rankup-product-relations-title {
        font-size: 1.6em;
    }
}

@media (max-width: 768px) {
    .rankup-swiper-container .swiper-pagination {
        margin-top: 15px;
    }
    
    .rankup-swiper-container .swiper-pagination-bullet {
        width: 8px;
        height: 8px;
        margin: 0 3px;
    }
    
    .rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet {
        margin: 0 1px;
        transform: scale(0.25);
    }
    
    .rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active {
        transform: scale(0.8);
    }
    
    .rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev,
    .rankup-swiper-container .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next {
        transform: scale(0.5);
    }
    
    .rankup-swiper-container .swiper-pagination-fraction {
        font-size: 12px;
    }
    
    .rankup-swiper-container .swiper-pagination-current {
        font-size: 14px;
    }
    
    .rankup-swiper-container .swiper-pagination-progressbar {
        max-width: 100%;
        height: 6px;
    }
}

@media (max-width: 767px) {
    .rankup-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .rankup-swiper-container .swiper {
        /* padding: 0 35px; */
    }
    
    .rankup-swiper-container .swiper-button-next,
    .rankup-swiper-container .swiper-button-prev {
        width: 35px;
        height: 35px;
    }
    
    .rankup-swiper-container .swiper-button-next {
        right: 5px;
    }
    
    .rankup-swiper-container .swiper-button-prev {
        left: 5px;
    }
    
    .rankup-product-relations-title {
        font-size: 1.4em;
        margin-bottom: 20px;
    }
    
    .rankup-product-relations-section {
        /* margin-top: 30px; */
        /* padding-top: 15px; */
    }
    
    .rankup-product-title {
        font-size: 14px;
        min-height: 35px;
    }
}

/* ========================================
DARK THEME SUPPORT
======================================== */
@media (prefers-color-scheme: dark) {
    .rankup-swiper-container .swiper-pagination-bullet {
        background: #666;
    }
    
    .rankup-swiper-container .swiper-pagination-fraction {
        color: #fff;
    }
    
    .rankup-swiper-container .swiper-pagination-total {
        color: #999;
    }
    
    .rankup-swiper-container .swiper-pagination-progressbar {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ========================================
RTL SUPPORT
======================================== */
.rtl .rankup-swiper-container .swiper-pagination-progressbar .swiper-pagination-progressbar-fill {
    transform-origin: right;
}