/* 2.1.0 */

/* ========================================================= */
/* 1. КОНТЕЙНЕРИ І ЗАГАЛЬНИЙ МАКЕТ СПИСКУ ВАРІАЦІЙ (.rvt-rows) */
/* ========================================================= */

.rvt-container-in-theme {
    margin: 20px 0;
}
.rvt-wrap {
    width: 100%;
    margin: 10px 0 20px;
}

/* Список варіацій */
.rvt-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Один рядок (карточка варіації) - Загальні стилі */
.rvt-row {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 10px;
    background: #fff;
    /* Мобільний/Загальний макет (вертикальний) */
    display: flex;
    flex-direction: column;
    gap: 6px; /* Замінює margin-top на rvt-row-actions */
}

/* Верхній блок: фото + інформація (Мобільний/Загальний) */
.rvt-row-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* Фото */
.rvt-field-image img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    display: block;
    cursor: zoom-in;
}

/* Блок з текстом */
.rvt-row-info {
    flex: 1 1 auto;
    font-size: 13px;
}
.rvt-field-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
}
.rvt-field-sku {
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 4px;
}
.rvt-field-description {
    margin-bottom: 4px;
}
.rvt-field-attr {
    font-size: 12px;
}
.rvt-field-attr .rvt-attr-label {
    font-weight: 600;
    margin-right: 3px;
}

/* ========================================================= */
/* 2. ДІЇ ТА КНОПКИ */
/* ========================================================= */

/* Низ: ціна + кількість + кнопка (Мобільний - justify-content: space-between) */
.rvt-row-actions {
    display: flex;
    justify-content: space-between; /* Замість flex-end на мобільному */
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.rvt-action-price {
    font-weight: 700;
    font-size: 15px;
}

/* Кількість - Спільний селектор */
.rvt-col-qty .rvt-qty-wrapper,
.rvt-action-qty .rvt-qty-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.rvt-qty-btn[type="button"] {
    padding: 0 6px;
    min-width: 24px;
    height: 28px;
    line-height: 26px;
    border: 1px solid #ccc;
    background: #f7f7f7;
    cursor: pointer;
    font-size: 14px;
}
.rvt-qty-btn:hover {
    background: #eee;
}

.rvt-qty-input::-webkit-outer-spin-button,
.rvt-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.rvt-qty-input[type=number] {
    -moz-appearance: textfield;
    width: 50px;
}

/* Контейнер для кнопки + посилання */
.rvt-action-button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    min-height: 46px;
}

/* Кнопка купити (об'єднано стилі 14px та 16px в 16px) */
.rvt-buy-button.button {
    padding: 6px 16px;
    font-size: 13px;
    position: relative; /* Не дублюємо */
}
.rvt-buy-button.rvt-loading {
    opacity: 0.6;
    pointer-events: none;
}
.rvt-buy-button.rvt-added {
    animation: rvt-pulse 0.4s ease-out;
}
@keyframes rvt-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* Бейдж не розтягує кнопку */
.rvt-cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-block;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1.6;
    background: #d9534f;
    color: #fff;
    margin-left: 0; /* Видалено зайвий margin-left: 6px */
}

/* Посилання під кнопкою */
.rvt-action-button .added_to_cart {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.2;
    text-decoration: underline;
}

/* Превʼю великої картинки */
.rvt-image-preview {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 80vw;
    max-height: 80vh;
    z-index: 9999;
    display: none;
    pointer-events: none;
    background: #fff;
    padding: 6px;
    border-radius: 6px;
    box-shadow: 0 0 18px rgba(0,0,0,0.35);
}

/* ========================================================= */
/* 3. ДЕСКТОПНИЙ МАКЕТ (min-width: 768px) */
/* ========================================================= */

@media (min-width: 768px) {
    /* Рядок: в один рядок */
    .rvt-row {
        flex-direction: row; /* Змінюємо напрямок на горизонтальний */
        align-items: center;
        justify-content: space-between;
        gap: 20px;
        padding: 8px 10px; /* Зберігаємо padidng */
    }

    /* Основна інформація: вирівнювання по центру, більший gap */
    .rvt-row-main {
        align-items: center; /* Змінюємо flex-start на center */
        gap: 15px; /* Змінюємо 10px на 15px */
        flex: 1 1 auto;
    }

    /* Блок дій: праворуч, без верхнього відступу */
    .rvt-row-actions {
        justify-content: flex-end; /* Повертаємо вирівнювання на flex-end */
        margin-top: 0;
        flex: 0 0 auto;
        gap: 15px; /* Збільшуємо gap для кращого вигляду */
    }
}

/* ========================================================= */
/* 4. ВЕРХНЯ ПАНЕЛЬ (ПОШУК І ФІЛЬТРИ) */
/* ========================================================= */

.rvt-topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px; /* Об'єднано 15px і 10px, залишимо 15px для кращого інтервалу */
}

.rvt-page-size-wrapper label {
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rvt-page-size {
    padding: 3px 6px;
    font-size: 13px;
}

.rvt-search-wrapper {
    margin-left: auto;
}

/* Блок пошуку (рефакторинг для єдиного визначення) */
.rvt-search-box {
    flex: 0 1 280px;
}
.rvt-search-box label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px; /* Додано відступ до поля вводу */
}

/* Поле вводу (Об'єднано та оптимізовано) */
.rvt-search-input {
    height: 34px;
    padding: 4px 8px; /* Використовуємо фінальні значення */
    font-size: 13px; /* Використовуємо фінальні значення */
    min-width: 160px;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    /* Видалено margin-top: 4px (перенесено на label) */
    /* Видалено font-size: 14px */
}

.rvt-search-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px rgba(34,113,177,0.2);
}

/* Фільтри поруч із пошуком */
.rvt-topbar .rvt-attr-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
}

/* ========================================================= */
/* 5. ПАГІНАЦІЯ */
/* ========================================================= */

.rvt-pagination {
    margin-top: 15px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.rvt-page-btn {
    min-width: 32px;
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid #ccc;
    background: #f7f7f7;
    cursor: pointer;
    border-radius: 3px;
}

.rvt-page-btn:hover:not([disabled]) {
    background: #eee;
}

.rvt-page-btn[disabled] {
    opacity: 0.5;
    cursor: default;
}

.rvt-page-active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.rvt-page-ellipsis {
    padding: 4px 6px;
    font-size: 13px;
    line-height: 1.4;
    user-select: none;
}

/* ========================================================= */
/* 6. АДАПТИВНІ КЛАСИ ТА МОБІЛЬНИЙ ВИГЛЯД */
/* ========================================================= */

/* Приховання для desktop / mobile за налаштуваннями */
@media (min-width: 768px) {
    .rvt-desktop-hidden {
        display: none !important;
    }
}
@media (max-width: 767px) {
    .rvt-mobile-hidden {
        display: none !important;
    }

    /* Мобільний вигляд: верхня панель */
    .rvt-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .rvt-search-box {
        width: 100%;
        flex: 1 1 auto; /* Змінено 0 1 280px на повну ширину */
    }

    /* Мобільний вигляд: поле пошуку */
    .rvt-search-input {
        width: 100%;
        height: 38px;
        font-size: 15px;
    }

    .rvt-topbar .rvt-attr-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .rvt-attr-filter-item {
        display: flex;
        justify-content: space-between;
        gap: 8px;
    }

    .rvt-attr-filter-item select {
        flex: 1;
    }
}

/* ------------------------------------- */
/* АНІМАЦІЯ БЛІНГУ ДЛЯ ПЛЕЙСХОЛДЕРА */
/* ------------------------------------- */

@keyframes rvt-blink {
    0% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.3; /* Зробимо його напівпрозорим */
    }
    100% { 
        opacity: 1; 
    }
}

.rvt-blinking {
    /* Застосовуємо анімацію: ім'я, тривалість, нескінченний цикл */
    animation: rvt-blink 1.5s infinite; 
    
    /* Додаткові стилі для плейсхолдера */
    text-align: center;
    padding: 20px 0;
    font-weight: 600;
    color: #999;
}