/* ============================================================
   Favorite Button Component
   - Used on game cards and product page header
   ============================================================ */

/* Base favorite button */
.fav-btn {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--color-gray-400, #9ca3af);
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Lucide SVG icon inside fav-btn */
.fav-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    transition: all 0.25s ease;
}

.fav-btn.is-favorite svg {
    fill: currentColor;
}

.fav-btn:hover {
    background: rgba(255, 255, 255, 1);
    color: var(--color-primary-500, #06b6d4);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

/* Favorited state */
.fav-btn.is-favorite {
    color: #ef4444;
    background: rgba(255, 255, 255, 0.95);
}

.fav-btn.is-favorite:hover {
    color: #dc2626;
}

/* Bounce animation on toggle */
.fav-btn--animate {
    animation: favBounce 0.4s ease;
}

@keyframes favBounce {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.35);
    }
    50% {
        transform: scale(0.9);
    }
    75% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

/* ---- Modern card variant ---- */
.card-modern .fav-btn {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.card-modern .fav-btn:hover {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
}

.card-modern .fav-btn.is-favorite {
    color: #ef4444;
    background: rgba(0, 0, 0, 0.45);
}

.card-modern .fav-btn.is-favorite:hover {
    color: #f87171;
}

/* ---- Inline header variant (product page) ---- */
.fav-btn--inline {
    position: relative;
    top: auto;
    left: auto;
    display: inline-flex;
    width: 36px;
    height: 36px;
    vertical-align: middle;
    margin-right: 8px;
    background: var(--color-primary-50, #ecfeff);
    color: var(--color-gray-400, #9ca3af);
    box-shadow: none;
    border: 1px solid var(--color-primary-100, #cffafe);
}

.fav-btn--inline svg {
    width: 18px;
    height: 18px;
}

.fav-btn--inline:hover {
    background: var(--color-primary-100, #cffafe);
    border-color: var(--color-primary-200, #a5f3fc);
}

.fav-btn--inline.is-favorite {
    color: #ef4444;
    background: #fef2f2;
    border-color: #fecaca;
}

/* ---- Dark mode ---- */
html.dark .fav-btn {
    background: rgba(30, 30, 30, 0.8);
    color: var(--color-gray-500, #6b7280);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

html.dark .fav-btn:hover {
    background: rgba(50, 50, 50, 0.9);
    color: var(--color-primary-400, #22d3ee);
}

html.dark .fav-btn.is-favorite {
    color: #f87171;
    background: rgba(50, 20, 20, 0.8);
}

html.dark .fav-btn--inline {
    background: var(--color-gray-800, #1f2937);
    border-color: var(--color-gray-700, #374151);
    color: var(--color-gray-500, #6b7280);
}

html.dark .fav-btn--inline:hover {
    background: var(--color-gray-700, #374151);
}

html.dark .fav-btn--inline.is-favorite {
    color: #f87171;
    background: rgba(127, 29, 29, 0.3);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ---- Responsive ---- */
@media (max-width: 576px) {
    .fav-btn {
        width: 28px;
        height: 28px;
        top: 4px;
        left: 4px;
    }

    .fav-btn svg {
        width: 14px;
        height: 14px;
    }

    .fav-btn--inline {
        width: 32px;
        height: 32px;
    }

    .fav-btn--inline svg {
        width: 16px;
        height: 16px;
    }
}

/* Prevent card click when clicking fav button */
.fav-btn {
    pointer-events: auto;
}

/* ============================================================
   Topbar Favorites Icon
   - Matches theme-toggle-btn style for default layout
   - Matches topbar-minimal__home style for minimal layout
   ============================================================ */

/* ---- Default/Topbar-only layout icon ---- */
.topbar-icon-btn {
    background: transparent;
    border: none;
    color: var(--nav-text-color);
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
    width: 36px;
    height: 36px;
}

.topbar-icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: currentColor;
}

.topbar-icon-btn:hover {
    background-color: rgba(var(--color-gray-0-rgb, 255, 255, 255), 0.1);
    transform: translateY(-2px);
    color: #f87171;
    box-shadow: 0 0 8px rgba(var(--color-gray-0-rgb, 255, 255, 255), 0.3);
    text-decoration: none;
}

.topbar-icon-btn:active {
    transform: translateY(0);
}

.topbar-icon-btn.active {
    color: #ef4444;
}

/* Badge on topbar icon */
.topbar-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    background: #ef4444;
    color: #fff;
    padding: 0 4px;
}

/* ---- Minimal topbar variant (Kaiali) ---- */
.topbar-minimal__favorites {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(var(--color-primary-500-rgb, 20, 159, 245), 0.2);
    color: var(--color-primary-200, #8ed1fa);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.topbar-minimal__favorites svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: currentColor;
}

.topbar-minimal__favorites:hover {
    background: rgba(var(--color-primary-500-rgb, 20, 159, 245), 0.4);
    color: #f87171;
    transform: scale(1.05);
    text-decoration: none;
}

.topbar-minimal__favorites.active {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.topbar-minimal__favorites .topbar-badge {
    top: -2px;
    right: -2px;
}

/* ---- Dark mode for topbar icons ---- */
html.dark .topbar-icon-btn {
    color: var(--nav-text-color, var(--color-gray-300));
}

html.dark .topbar-icon-btn:hover {
    color: #f87171;
    background-color: rgba(var(--color-gray-0-rgb, 255, 255, 255), 0.08);
}

html.dark .topbar-icon-btn.active {
    color: #f87171;
}

/* ---- Responsive for minimal topbar ---- */
@media (max-width: 576px) {
    .topbar-minimal__favorites {
        width: 34px;
        height: 34px;
    }

    .topbar-minimal__favorites svg {
        width: 16px;
        height: 16px;
    }
}
