/* Виджет избранного и сравнения с улучшенными иконками */
.favorites-widget {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.widget-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 0 16px 16px 0;
    box-shadow: 
        2px 0 15px rgba(0, 0, 0, 0.1),
        5px 5px 25px rgba(0, 0, 0, 0.08);
    padding: 16px 12px;
    border-left: 3px solid #3498db;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.widget-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(52, 152, 219, 0.05) 20%,
        rgba(231, 76, 60, 0.05) 100%);
    z-index: -1;
}

.widget-content:hover {
    box-shadow: 
        4px 0 25px rgba(0, 0, 0, 0.15),
        8px 8px 35px rgba(0, 0, 0, 0.12);
    transform: translateX(8px);
    border-left-color: #2980b9;
}

.widget-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #2c3e50;
    padding: 14px 10px;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    min-width: 70px;
    background: transparent;
    border: 1px solid transparent;
}

.widget-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(52, 152, 219, 0.2);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.widget-btn:active {
    transform: translateY(-1px) scale(1.02);
    transition-duration: 0.1s;
}

.btn-icon {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.widget-btn:hover .btn-icon {
    transform: scale(1.1) rotate(5deg);
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.compare-btn:hover .btn-icon {
    border-color: rgba(52, 152, 219, 0.3);
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(41, 128, 185, 0.1) 100%);
}

.favorite-btn:hover .btn-icon {
    border-color: rgba(231, 76, 60, 0.3);
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1) 0%, rgba(192, 57, 43, 0.1) 100%);
}

/* Иконки SVG */
.compare-icon,
.favorite-icon {
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
}

.compare-icon {
    color: #3498db;
    stroke: #3498db;
}

.favorite-icon {
    color: #e74c3c;
    stroke: #e74c3c;
}

.widget-btn:hover .compare-icon {
    color: #2980b9;
    stroke: #2980b9;
    transform: scale(1.1);
}

.widget-btn:hover .favorite-icon {
    color: #c0392b;
    stroke: #c0392b;
    transform: scale(1.1);
}

/* Счетчик */
.btn-counter {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    font-size: 11px;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 
        0 3px 8px rgba(231, 76, 60, 0.4),
        0 0 0 2px white;
    z-index: 2;
    transition: all 0.3s ease;
}

.compare-btn .btn-counter {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    box-shadow: 
        0 3px 8px rgba(52, 152, 219, 0.4),
        0 0 0 2px white;
}

.widget-btn:hover .btn-counter {
    transform: scale(1.15) rotate(15deg);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 0 0 2px white;
}

/* Подпись */
.btn-label {
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: #2c3e50;
    position: relative;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.7);
}

.widget-btn:hover .btn-label {
    color: white;
    transform: translateY(2px);
}

.compare-btn:hover .btn-label {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    box-shadow: 0 3px 8px rgba(52, 152, 219, 0.3);
}

.favorite-btn:hover .btn-label {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 3px 8px rgba(231, 76, 60, 0.3);
}

/* Разделитель */
.widget-divider {
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(52, 152, 219, 0.3) 20%, 
        rgba(231, 76, 60, 0.3) 80%, 
        transparent 100%);
    margin: 8px 12px;
    border-radius: 1px;
}

/* Индикатор состояния */
.widget-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #3498db, #e74c3c);
    border-radius: 0 2px 2px 0;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.widget-content:hover .widget-indicator {
    width: 6px;
    opacity: 1;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

/* Анимация пульсации счетчика */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 
            0 3px 8px rgba(231, 76, 60, 0.4),
            0 0 0 2px white;
    }
    50% {
        transform: scale(1.2);
        box-shadow: 
            0 5px 15px rgba(231, 76, 60, 0.6),
            0 0 0 2px white;
    }
    100% {
        transform: scale(1);
        box-shadow: 
            0 3px 8px rgba(231, 76, 60, 0.4),
            0 0 0 2px white;
    }
}

.compare-btn .btn-counter {
    animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
    0% {
        transform: scale(1);
        box-shadow: 
            0 3px 8px rgba(52, 152, 219, 0.4),
            0 0 0 2px white;
    }
    50% {
        transform: scale(1.2);
        box-shadow: 
            0 5px 15px rgba(52, 152, 219, 0.6),
            0 0 0 2px white;
    }
    100% {
        transform: scale(1);
        box-shadow: 
            0 3px 8px rgba(52, 152, 219, 0.4),
            0 0 0 2px white;
    }
}

.btn-counter.has-items {
    animation: pulse 2s infinite;
}

.compare-btn .btn-counter.has-items {
    animation: pulse-blue 2s infinite;
}

/* Анимация появления */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%) translateY(-50%);
        opacity: 0;
    }
    to {
        transform: translateX(0) translateY(-50%);
        opacity: 1;
    }
}

.favorites-widget {
    animation: slideInLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Анимация обновления счетчика */
@keyframes counterBounce {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.3) rotate(-15deg);
    }
    75% {
        transform: scale(1.3) rotate(15deg);
    }
}

.counter-update {
    animation: counterBounce 0.5s ease;
}

/* Анимация добавления товара */
@keyframes addItem {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

.widget-btn.item-added .btn-icon {
    animation: addItem 0.4s ease;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .favorites-widget {
        left: 10px;
    }
    
    .widget-content:hover {
        transform: translateX(5px);
    }
}

@media (max-width: 768px) {
    .favorites-widget {
        position: fixed;
        bottom: 20px;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        animation: slideInBottom 0.6s ease;
    }
    
    @keyframes slideInBottom {
        from {
            transform: translateX(-50%) translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }
    }
    
    .widget-content {
        flex-direction: row;
        border-radius: 25px;
        border-left: none;
        border-top: 3px solid #3498db;
        padding: 12px 20px;
        gap: 20px;
        min-width: 280px;
    }
    
    .widget-content:hover {
        transform: translateX(-50%) translateY(-5px);
    }
    
    .widget-btn {
        flex-direction: row;
        gap: 15px;
        padding: 12px 18px;
        min-width: auto;
        border-radius: 16px;
    }
    
    .btn-icon {
        margin-bottom: 0;
        width: 40px;
        height: 40px;
    }
    
    .compare-icon,
    .favorite-icon {
        width: 20px;
        height: 20px;
    }
    
    .btn-counter {
        font-size: 10px;
        min-width: 20px;
        height: 20px;
        top: -6px;
        right: -6px;
    }
    
    .btn-label {
        font-size: 14px;
        padding: 3px 6px;
    }
    
    .widget-divider {
        height: auto;
        width: 1px;
        background: linear-gradient(to bottom, 
            transparent 0%, 
            rgba(52, 152, 219, 0.3) 20%, 
            rgba(231, 76, 60, 0.3) 80%, 
            transparent 100%);
        margin: 0 8px;
    }
    
    .widget-indicator {
        display: none;
    }
}

@media (max-width: 480px) {
    .widget-content {
        padding: 10px 16px;
        gap: 12px;
        min-width: 240px;
    }
    
    .widget-btn {
        padding: 10px 14px;
        gap: 12px;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
    }
    
    .btn-label {
        font-size: 12px;
    }
    
    .btn-counter {
        font-size: 9px;
        min-width: 18px;
        height: 18px;
    }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    .widget-content {
        background: rgba(30, 30, 30, 0.95);
        border-left-color: #3498db;
    }
    
    .widget-content::before {
        background: linear-gradient(135deg, 
            rgba(52, 152, 219, 0.1) 0%,
            rgba(231, 76, 60, 0.1) 100%);
    }
    
    .widget-btn {
        color: #ecf0f1;
    }
    
    .widget-btn:hover {
        background: rgba(50, 50, 50, 0.9);
        border-color: rgba(52, 152, 219, 0.3);
    }
    
    .btn-icon {
        background: rgba(40, 40, 40, 0.9);
    }
    
    .widget-btn:hover .btn-icon {
        background: rgba(60, 60, 60, 0.9);
    }
    
    .btn-label {
        background: rgba(40, 40, 40, 0.7);
        color: #ecf0f1;
    }
    
    .widget-btn:hover .btn-label {
        color: white;
    }
    
    .compare-icon {
        color: #5dade2;
        stroke: #5dade2;
    }
    
    .favorite-icon {
        color: #ec7063;
        stroke: #ec7063;
    }
}

/* Состояния для активных страниц */
.compare-page .compare-btn .btn-label,
.favorites-page .favorite-btn .btn-label {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
}

.compare-page .compare-btn:hover .btn-label,
.favorites-page .favorite-btn:hover .btn-label {
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
}

/* Индикатор загрузки */
.widget-loading .btn-icon {
    position: relative;
    overflow: hidden;
}

.widget-loading .btn-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 100%);
    animation: loadingShimmer 1.5s infinite;
}

@keyframes loadingShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}