/**
 * ms3Variants Frontend CSS
 * @package ms3Variants
 */

/* Контейнер вариантов */
.ms3-variants {
    margin: 1rem 0;
}

/* Селекторы опций */
.ms3-variants-selectors {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ms3-variants-option {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ms3-variants-option-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #333;
}

.ms3-variants-option-values {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ms3-variants-option-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.ms3-variants-option-btn:hover {
    border-color: #999;
    background: #f5f5f5;
}

.ms3-variants-option-btn.active {
    border-color: #1976d2;
    background: #e3f2fd;
    color: #1565c0;
}

.ms3-variants-option-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Список вариантов */
.ms3-variants-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Строка варианта */
.ms3-variant-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid #eee;
    border-radius: 6px;
    background: #fafafa;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.ms3-variant-row:hover {
    border-color: #ddd;
    background: #fff;
}

.ms3-variant-row.active {
    border-color: #1976d2;
    background: #e3f2fd;
}

.ms3-variant-row.ms3-variant-out-of-stock {
    opacity: 0.6;
}

.ms3-variant-row.in-cart {
    border-color: #388e3c;
    background: #e8f5e9;
}

/* Вариант в корзине И выбран */
.ms3-variant-row.in-cart.active {
    border-color: #1976d2;
    background: #e8f5e9;
    box-shadow: inset 3px 0 0 #388e3c;
}

/* Бейдж "В корзине" */
.ms3-variant-cart-badge {
    font-size: 0.7rem;
    color: #fff;
    background: #388e3c;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    white-space: nowrap;
}

/* Изображение варианта */
.ms3-variant-image {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
}

.ms3-variant-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Опции варианта */
.ms3-variant-options {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.ms3-variant-option {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #e0e0e0;
    border-radius: 3px;
    font-size: 0.75rem;
    color: #333;
}

/* Артикул */
.ms3-variant-sku {
    color: #888;
    font-size: 0.75rem;
}

/* Цена варианта */
.ms3-variant-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.125rem;
}

.ms3-variant-old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 0.75rem;
}

.ms3-variant-current-price {
    font-weight: 600;
    font-size: 1rem;
    color: #1976d2;
}

/* Наличие */
.ms3-variant-stock {
    font-size: 0.75rem;
    white-space: nowrap;
}

.ms3-variant-in-stock {
    color: #388e3c;
}

.ms3-variant-out {
    color: #c62828;
}

/* Информация о выбранном варианте */
.ms3-variants-selected {
    margin-top: 1rem;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 6px;
}

/* Адаптив */
@media (max-width: 576px) {
    .ms3-variant-row {
        flex-wrap: wrap;
    }

    .ms3-variant-options {
        width: 100%;
        order: 3;
    }

    .ms3-variant-price {
        margin-left: auto;
    }
}

/* ============================================
   ms3VariantsCatalog - стили для каталога
   ============================================ */

.ms3v-variants {
    margin: 0.75rem 0;
}

/* Select вариантов */
.ms3v-variant-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #333;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ms3v-variant-select:hover {
    border-color: #999;
}

.ms3v-variant-select:focus {
    border-color: #1976d2;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

.ms3v-variant-select option:disabled {
    color: #999;
}

/* Статус нет в наличии */
.ms3v-out-of-stock .ms3v-variant-select {
    border-color: #c62828;
}

/* Компактный режим */
.ms3v-variants--compact .ms3v-variant-select {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
}

/* Тёмная тема (опционально) */
.ms3v-variants--dark .ms3v-variant-select {
    background-color: #2d2d2d;
    border-color: #555;
    color: #eee;
}

.ms3v-variants--dark .ms3v-variant-select:focus {
    border-color: #64b5f6;
}
