/**
 * favorites.css - Estilos para el sistema de favoritos
 */

/* =============================================================================
   BOTÓN DE FAVORITO
   ============================================================================= */

.favorite-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.dark-mode .favorite-btn {
    background: #2d2d2d;
    border-color: #555;
    color: #b0b0b0;
}

.favorite-btn:hover {
    border-color: #dc3545;
    color: #dc3545;
    background-color: #fff5f5;
}

.dark-mode .favorite-btn:hover {
    background: #3d3d3d;
    border-color: #dc3545;
    color: #dc3545;
}

.favorite-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.favorite-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.favorite-btn.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #dc3545;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 5px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Estado activo (favorito agregado) */
.favorite-btn.active {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.favorite-btn.active:hover {
    background: #c82333;
    border-color: #c82333;
}

.dark-mode .favorite-btn.active {
    background: #dc3545;
    border-color: #dc3545;
}

.favorite-btn.active:hover {
    background: #b02a2a;
    border-color: #b02a2a;
}

.favorite-btn.active .favorite-icon.outline {
    display: none;
}

.favorite-btn.active .favorite-icon.filled {
    display: inline-block;
}

.favorite-btn:not(.active) .favorite-icon.filled {
    display: none;
}

.favorite-btn:not(.active) .favorite-icon.outline {
    display: inline-block;
}

.favorite-text {
    font-size: 13px;
}

.favorite-btn.active .favorite-text {
    content: 'Guardado';
}

/* =============================================================================
   PANEL DE FAVORITOS
   ============================================================================= */

.favorites-panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dark-mode .favorites-panel {
    background: #2d2d2d;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.favorites-panel h3 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #007bff;
}

.dark-mode .favorites-panel h3 {
    color: #e4e4e4;
}

/* Lista de favoritos */
.favorites-list {
    margin: 0;
    padding: 0;
}

.favorites-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.favorites-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
}

.dark-mode .favorites-item {
    border-bottom-color: #404040;
}

.favorites-item:hover {
    background-color: #f8f9fa;
}

.dark-mode .favorites-item:hover {
    background-color: #3d3d3d;
}

.favorites-item:last-child {
    border-bottom: none;
}

.favorites-link {
    color: #333;
    text-decoration: none;
    flex: 1;
    font-weight: 500;
}

.dark-mode .favorites-link {
    color: #e4e4e4;
}

.favorites-link:hover {
    color: #007bff;
}

.dark-mode .favorites-link:hover {
    color: #58a6ff;
}

.favorites-remove {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 18px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.favorites-remove:hover {
    background-color: #dc3545;
    color: white;
}

/* =============================================================================
   ESTADO VACÍO - SIN FAVORITOS
   ============================================================================= */

.no-favorites {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.dark-mode .no-favorites {
    color: #b0b0b0;
}

.no-favorites-icon {
    font-size: 64px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-favorites p {
    font-size: 16px;
    margin: 10px 0;
}

.no-favorites a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}

.no-favorites a:hover {
    text-decoration: underline;
}

/* =============================================================================
   BADGE DE CONTADOR DE FAVORITOS
   ============================================================================= */

.favorites-count-badge {
    position: relative;
}

.favorites-count-badge::after {
    content: attr(data-count);
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    background: #dc3545;
    color: white;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.favorites-count-badge[data-count="0"]::after {
    display: none;
}

/* =============================================================================
   WIDGET DE FAVORITOS PARA SIDEBAR
   ============================================================================= */

.favorites-widget {
    margin-bottom: 20px;
}

.favorites-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.favorites-widget-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dark-mode .favorites-widget-title {
    color: #e4e4e4;
}

.favorites-widget-count {
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.favorites-widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.favorites-widget-item {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.dark-mode .favorites-widget-item {
    border-bottom-color: #404040;
}

.favorites-widget-item:last-child {
    border-bottom: none;
}

.favorites-widget-link {
    display: block;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.dark-mode .favorites-widget-link {
    color: #b0b0b0;
}

.favorites-widget-link:hover {
    color: #007bff;
}

.dark-mode .favorites-widget-link:hover {
    color: #58a6ff;
}

/* =============================================================================
   BOTÓN FLOTANTE PARA VER FAVORITOS
   ============================================================================= */

.favorites-floating-btn {
    position: fixed;
    bottom: 140px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    z-index: 9989;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorites-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.favorites-floating-btn:active {
    transform: scale(0.95);
}

.favorites-floating-btn svg {
    color: white;
    width: 24px;
    height: 24px;
}

.favorites-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ffc107;
    color: #333;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* =============================================================================
   NOTIFICACIÓN DE FAVORITO
   ============================================================================= */

.favorite-notification {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* =============================================================================
   ANIMACIÓN DE CORAZÓN
   ============================================================================= */

.favorite-btn.adding .favorite-icon {
    animation: heartBeat 0.3s ease-in-out;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* =============================================================================
   TOOLTIP
   ============================================================================= */

.favorite-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 5px;
    padding: 5px 10px;
    background: #333;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    .favorites-floating-btn {
        bottom: 130px;
        right: 15px;
        width: 45px;
        height: 45px;
    }

    .favorites-floating-btn svg {
        width: 20px;
        height: 20px;
    }

    .favorites-panel {
        padding: 15px;
    }

    .favorite-text {
        display: none;
    }
}

/* =============================================================================
   DARK MODE
   ============================================================================= */

.dark-mode .favorites-floating-btn {
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

/* =============================================================================
   ACCESIBILIDAD
   ============================================================================= */

.favorite-btn:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.favorite-btn:focus:not(:focus-visible) {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    .favorite-btn,
    .favorites-floating-btn {
        transition: none !important;
    }

    .favorite-btn.loading::after {
        animation: none;
    }

    .favorite-btn.adding .favorite-icon {
        animation: none;
    }
}

/* =============================================================================
   ESTADO DE CARGA EN LISTA DE FAVORITOS
   ============================================================================= */

.favorites-loading {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.favorites-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =============================================================================
   MENSAJES DE ERROR/ÉXITO
   ============================================================================= */

.favorites-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 15px 0;
}

.dark-mode .favorites-error {
    background: #5a1e1e;
    color: #fca5a5;
}

.favorites-success {
    background: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 15px 0;
}

.dark-mode .favorites-success {
    background: #1a4d2e;
    color: #a7f3d0;
}
