/**
 * Estilos para el sistema de favoritos
 */

/* Botón de favorito en productos */
.favorite-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
}

.favorite-toggle:hover {
    background: #fff;
    border-color: #fed700;
    transform: scale(1.1);
}

.favorite-toggle i {
    color: #999;
    font-size: 18px;
    transition: color 0.2s ease;
}

.favorite-toggle:hover i {
    color: #fed700;
}

.favorite-toggle.is-favorite i {
    color: #e74c3c;
}

.favorite-toggle.is-favorite:hover i {
    color: #c0392b;
}

/* Iconos de favoritos y carrito en header - Estilo unificado */
.favorites-header-icon,
.cart-header-icon {
    position: relative;
    display: inline-flex;
    margin-left: 15px;
}

.favorites-header-icon a,
.cart-header-icon a {
    color: #36c;
    font-size: 24px;
    text-decoration: none;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    transition: color 0.2s ease;
}

.favorites-header-icon a:hover,
.cart-header-icon a:hover {
    color: #fed700;
}

/* Contadores de favoritos y carrito */
#favorites-count,
#cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: #fff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

/* Mostrar contador solo cuando hay items */
#favorites-count {
    display: none;
}

#cart-count {
    display: inline-block;
}

/* Ocultar contador si es 0 */
#cart-count:empty,
#cart-count[data-count="0"] {
    display: none;
}

/* Etiquetas debajo de los iconos */
.header-icon-label {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: #333;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.5px;
    line-height: 1;
    white-space: nowrap;
}

/* Panel lateral de favoritos */
.favorites-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.favorites-panel.open {
    visibility: visible;
    opacity: 1;
}

.favorites-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.favorites-sidebar {
    position: absolute;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 90vw;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.favorites-panel.open .favorites-sidebar {
    right: 0;
}

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

.favorites-header h2 {
    margin: 0;
    font-size: 20px;
    color: #36c;
}

.favorites-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: #36c;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.favorites-close:hover {
    color: #000;
}

.favorites-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Lista vacía */
.favorites-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.favorites-empty i {
    color: #ddd;
    margin-bottom: 20px;
}

.favorites-empty p {
    margin: 10px 0;
}

.favorites-empty .small {
    font-size: 13px;
    color: #bbb;
}

/* Lista de favoritos */
.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.favorite-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 4px;
    transition: border-color 0.2s ease;
    position: relative;
}

.favorite-item:hover {
    border-color: #fed700;
}

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

.favorite-thumb {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favorite-info {
    flex: 1;
    min-width: 0;
}

.favorite-info h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.favorite-info p {
    margin: 3px 0;
    font-size: 12px;
    color: #666;
}

.favorite-years {
    color: #999;
    font-size: 11px !important;
}

.favorite-price {
    color: #36c;
    font-weight: bold;
    font-size: 13px !important;
}

.favorite-remove {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.favorite-remove:hover {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

.favorite-remove i {
    font-size: 14px;
}

/* Acciones */
.favorites-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.favorites-clear {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease;
}

.favorites-clear:hover {
    background: #c0392b;
}

/* Notificación */
.favorite-notification {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 10000;
    transition: bottom 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.favorite-notification.show {
    bottom: 30px;
}

/* Ajustes para product-box */
.product-box {
    position: relative;
}

/* Responsive */
@media (max-width: 768px) {
    .favorites-sidebar {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }
    
    .favorite-thumb {
        width: 60px;
        height: 60px;
    }
    
    .favorite-info h4 {
        font-size: 13px;
    }
    
    .favorite-info p {
        font-size: 11px;
    }
    
    .favorites-header-icon,
    .cart-header-icon {
        margin-left: 13px;
    }
    
    .favorites-header-icon a,
    .cart-header-icon a {
        font-size: 26px;
    }

    .header-icon-label {
        font-size: 11px;
        letter-spacing: 0.3px;
        margin-top: 4px;
    }
}

@media (max-width: 480px) {
    .favorite-toggle {
        width: 32px;
        height: 32px;
        top: 5px;
        right: 5px;
    }
    
    .favorite-toggle i {
        font-size: 16px;
    }
    
    .favorites-content {
        padding: 15px;
    }
    
    .favorite-item {
        padding: 10px;
    }
    
    /* Ajustar espaciado en móviles pequeños */
    .favorites-header-icon,
    .cart-header-icon {
        margin-left: 8px;
    }
    
    .favorites-header-icon a,
    .cart-header-icon a {
        font-size: 24px;
    }

    .header-icon-label {
        font-size: 10px;
        margin-top: 3px;
    }
}
