/* Стили для компонента карточки товара */

/* Основные стили карточки */
.product-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    z-index: 10;
}

/* Контейнер изображения */
.product-img-container {
    position: relative;
    overflow: hidden;
}

.product-img {
    transition: transform 0.3s ease;
    border-radius: 8px;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

/* Бейджи товаров */
.product-badge {
    position: static; /* Убираем абсолютное позиционирование */
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Позиционирование бейджей в ряд */
.badges-container {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: row;
    gap: 5px;
    z-index: 5;
    flex-wrap: wrap;
    max-width: calc(100% - 20px);
}

/* Бейдж скидки внизу изображения */
.badge-sale-bottom {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: #ffc107;
    color: #212529;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1; /* lower than dropdowns */
    pointer-events: none; /* prevent capturing hover/clicks over menus */
}

.badge-new {
    background: #28a745;
    color: white;
}

.badge-hot {
    background: #dc3545;
    color: white;
}

.badge-sale {
    background: #ffc107;
    color: #212529;
}

/* Быстрый просмотр */
.quick-actions {
    position: absolute;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.product-card:hover .quick-actions {
    opacity: 1;
}

.quick-actions .btn {
    backdrop-filter: blur(5px);
    background: rgba(255, 255, 255, 0.384);
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    display: flex;
}

.quick-actions .btn:hover {
    background: rgb(43 67 146) !important;
    color: #fff;
}

/* Цены */
.current-price {
    color: #2c3e50;
}

.old-price {
    font-size: 1.2em;
}

/* Название товара */
.product-name-link {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-name-link:hover {
    color: #2b4392;
}

/* Кнопки действий */
.add-to-cart-btn {
    transition: all 0.2s ease;
}

.add-to-cart-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.add-to-wishlist-btn {
    transition: all 0.2s ease;
}

.add-to-wishlist-btn:hover {
    transform: scale(1.05);
}

/* Стили для атрибутов товаров */
.product-attributes {
    position: absolute;
    left: 0;
    right: 0;
    top: 98%;
    z-index: 100;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0 0 8px 8px;
    padding: 15px;
    margin-top: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    display: block;
}

.product-card:hover .product-attributes {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .product-attributes {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        margin-top: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        opacity: 1;
        pointer-events: auto;
    }

    .color-btn:not(.attribute-btn) {
        border-radius: 80px;
    }
}

.attribute-group {
    margin-bottom: 10px;
}

.attribute-label {
    font-size: 0.775rem;
    font-weight: 500;
    color: #a3a3a3;
    margin-bottom: 5px;
}

.attribute-options {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.attribute-btn {
    font-size: 0.75rem;
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    border-radius: 4px;
    transition: all 0.2s;
    cursor: pointer;
}

.attribute-btn:hover {
    border-color: #2b4392;
    background: #f8f9fa;
}

.attribute-btn.selected {
    border-color: #2b4392;
}

.attribute-btn.selected:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.color-btn:not(.attribute-btn) {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 80px;
    border: 3px solid transparent;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-btn.selected::before {
    opacity: 0.8;
}

/* Адаптивность */
@media (max-width: 576px) {
    .product-card {
        margin-bottom: 1rem;
    }

    .product-img {
        max-height: 15rem !important;
        min-height: 15rem !important;
    }

    .current-price {
        font-size: 1.1rem !important;
    }

    .product-name-link {
        font-size: 1rem !important;
    }
}

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeInUp 0.3s ease-out;
}

/* Состояния загрузки */
.product-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.product-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2b4392;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}