/**
 * Favorites/Wishlist System Styles
 * Heart button, animations, toast notifications
 */

/* ================================
   FAVORITE BUTTON
   ================================ */

.favorite-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.dark .favorite-btn {
    background: #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.favorite-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.dark .favorite-btn:hover {
    box-shadow: 0 4px 12px rgba(251, 146, 60, 0.4);
}

/* Heart Icon */
.favorite-btn svg {
    width: 20px;
    height: 20px;
    stroke: #f97316;
    fill: none;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.dark .favorite-btn svg {
    stroke: #fb923c;
}

/* Active/Favorite State */
.favorite-btn.is-favorite svg {
    fill: #f97316;
    stroke: #f97316;
    animation: heartBeat 0.6s ease;
}

.dark .favorite-btn.is-favorite svg {
    fill: #fb923c;
    stroke: #fb923c;
}

/* Pulse Animation on Click */
.favorite-btn-pulse {
    animation: buttonPulse 0.6s ease;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    20% {
        transform: scale(1.3);
    }
    40% {
        transform: scale(1);
    }
    60% {
        transform: scale(1.2);
    }
    80% {
        transform: scale(1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes buttonPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 20px rgba(249, 115, 22, 0);
    }
}

/* ================================
   FAVORITE BUTTON POSITIONS
   ================================ */

/* In Product Card */
.favorite-btn-card {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* In Product File Page */
.favorite-btn-product {
    width: auto;
    height: auto;
    padding: 12px 24px;
    border-radius: 12px;
    gap: 8px;
    display: inline-flex;
}

.favorite-btn-product svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Toggle text based on state */
.favorite-btn-product.is-favorite .favorite-text-add {
    display: none;
}

.favorite-btn-product.is-favorite .favorite-text-remove {
    display: inline !important;
}

.favorite-btn-product:not(.is-favorite) .favorite-text-remove {
    display: none;
}

/* Button style for btn-action */
.btn-favorite.btn-action {
    background: white;
    border: 2px solid #f97316;
    color: #f97316;
}

.dark .btn-favorite.btn-action {
    background: #1f2937;
    border-color: #fb923c;
    color: #fb923c;
}

.btn-favorite.btn-action:hover {
    background: #fef3c7;
    border-color: #ea580c;
}

.dark .btn-favorite.btn-action:hover {
    background: #92400e;
    border-color: #f97316;
}

.btn-favorite.btn-action.is-favorite {
    background: linear-gradient(135deg, #f97316, #ea580c);
    border-color: #f97316;
    color: white;
}

.dark .btn-favorite.btn-action.is-favorite {
    background: linear-gradient(135deg, #fb923c, #f97316);
    border-color: #fb923c;
}

/* Small variant */
.favorite-btn-sm {
    width: 32px;
    height: 32px;
}

.favorite-btn-sm svg {
    width: 16px;
    height: 16px;
}

/* ================================
   FAVORITE COUNTER BADGE
   ================================ */

.favorite-counter {
    position: relative;
}

.favorite-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    border-radius: 10px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 0 5px;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.4);
    animation: badgePop 0.3s ease;
}

.dark .favorite-badge {
    background: linear-gradient(135deg, #fb923c, #f97316);
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Hide badge when count is 0 */
.favorite-badge[data-count="0"] {
    display: none;
}

/* ================================
   TOAST NOTIFICATIONS
   ================================ */

.favorite-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 320px;
    border-left: 4px solid #f97316;
}

.dark .favorite-toast {
    background: #1f2937;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.favorite-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.favorite-toast-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.4;
}

.dark .favorite-toast-message {
    color: #f3f4f6;
}

/* Toast Types */
.favorite-toast-success {
    border-left-color: #10b981;
}

.favorite-toast-success .favorite-toast-icon {
    background: #d1fae5;
    color: #059669;
}

.dark .favorite-toast-success .favorite-toast-icon {
    background: #064e3b;
    color: #6ee7b7;
}

.favorite-toast-error {
    border-left-color: #ef4444;
}

.favorite-toast-error .favorite-toast-icon {
    background: #fee2e2;
    color: #dc2626;
}

.dark .favorite-toast-error .favorite-toast-icon {
    background: #7f1d1d;
    color: #fca5a5;
}

.favorite-toast-warning {
    border-left-color: #f59e0b;
}

.favorite-toast-warning .favorite-toast-icon {
    background: #fef3c7;
    color: #d97706;
}

.dark .favorite-toast-warning .favorite-toast-icon {
    background: #78350f;
    color: #fcd34d;
}

.favorite-toast-info {
    border-left-color: #3b82f6;
}

.favorite-toast-info .favorite-toast-icon {
    background: #dbeafe;
    color: #2563eb;
}

.dark .favorite-toast-info .favorite-toast-icon {
    background: #1e3a8a;
    color: #93c5fd;
}

/* ================================
   FAVORITES PAGE
   ================================ */

.favorites-page-header {
    text-align: center;
    padding: 40px 0;
}

.favorites-page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.dark .favorites-page-title {
    color: #f3f4f6;
}

.favorites-page-subtitle {
    font-size: 1.125rem;
    color: #6b7280;
}

.dark .favorites-page-subtitle {
    color: #9ca3af;
}

.favorites-count {
    display: inline-block;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-left: 8px;
}

/* Empty State */
.favorites-empty {
    text-align: center;
    padding: 80px 20px;
}

.favorites-empty-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    opacity: 0.4;
    color: #9ca3af;
}

.dark .favorites-empty-icon {
    color: #6b7280;
}

.favorites-empty-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
}

.dark .favorites-empty-title {
    color: #f3f4f6;
}

.favorites-empty-text {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 32px;
}

.dark .favorites-empty-text {
    color: #9ca3af;
}

.favorites-empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.favorites-empty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
    color: white;
}

/* Actions Bar */
.favorites-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.dark .favorites-actions {
    border-bottom-color: #374151;
}

.favorites-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.favorites-clear-btn:hover {
    background: #ef4444;
    color: white;
}

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

@media (max-width: 640px) {
    .favorite-toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }

    .favorites-page-header {
        padding: 24px 0;
    }

    .favorites-page-title {
        font-size: 1.5rem;
    }

    .favorites-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .favorites-clear-btn {
        justify-content: center;
    }
}

/* ================================
   ACCESSIBILITY
   ================================ */

/* Focus states */
.favorite-btn:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

.dark .favorite-btn:focus-visible {
    outline-color: #fb923c;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .favorite-btn,
    .favorite-btn svg,
    .favorite-toast {
        animation: none;
        transition: none;
    }

    .favorite-btn:hover {
        transform: none;
    }
}
