/* Стили для попапа избранного */

/* Счетчик избранного */
.fav-icon {
    position: relative;
}

.fav-counter {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #000000;
    color: #ffffff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    display: none !important;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    line-height: 18px;
    padding: 0;
    margin: 0;
    text-align: center;
    box-sizing: border-box;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Показываем счетчик только когда есть атрибут data-has-items="true" */
.fav-counter[data-has-items="true"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Показываем счетчик только когда JavaScript явно установит display: flex */
.fav-counter[style*="display: flex"],
.fav-counter[style*="display:flex"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Дополнительное правило для гарантированного центрирования */
.fav-icon .fav-counter {
    align-items: center !important;
    justify-content: center !important;
    line-height: 18px !important;
}

/* Попап избранного */
.favorites-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.favorites-popup.active {
    display: block;
    opacity: 1;
}

.favorites-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.favorites-popup.active .favorites-popup-overlay {
    background-color: rgba(0, 0, 0, 0.5);
}

.favorites-popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background-color: #ffffff;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid #e0e0e0;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.favorites-popup.active .favorites-popup-content {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.favorites-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
}

.favorites-popup-title {
    font-size: 24px;
    font-weight: bold;
    color: #000000;
    margin: 0;
    text-transform: uppercase;
}

.favorites-popup-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.favorites-popup-close:hover {
    opacity: 0.7;
}

.favorites-popup-close svg {
    width: 24px;
    height: 24px;
}

.favorites-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
}

.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.favorites-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    position: relative;
    transition: box-shadow 0.3s;
}

.favorites-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.favorites-item-link {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.favorites-item-image {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.favorites-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favorites-item-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12px;
    text-align: center;
    padding: 10px;
}

.favorites-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.favorites-item-name {
    font-size: 16px;
    font-weight: normal;
    color: #000000;
    margin: 0;
    line-height: 1.4;
}

.favorites-item-price {
    font-size: 18px;
    font-weight: bold;
    color: #000000;
    margin: 0;
}

.favorites-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
    flex-shrink: 0;
}

.favorites-item-remove:hover {
    opacity: 0.7;
}

.favorites-item-remove svg {
    width: 20px;
    height: 20px;
}

.favorites-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.favorites-empty p {
    font-size: 18px;
    margin: 0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .favorites-popup-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .favorites-popup-header {
        padding: 15px 20px;
    }
    
    .favorites-popup-title {
        font-size: 20px;
    }
    
    .favorites-popup-body {
        padding: 15px 20px;
    }
    
    .favorites-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .favorites-item-link {
        width: 100%;
    }
    
    .favorites-item-remove {
        position: absolute;
        top: 15px;
        right: 15px;
    }
    
    .favorites-item-image {
        width: 100%;
        height: 200px;
    }
}

