/**
 * Favorites Feature — ToolBox.id
 * Tombol bintang di setiap tool card untuk simpan favorit ke localStorage.
 * Section "Favorit Saya" di halaman home tampil jika ada data favorit,
 * jika tidak tampilkan featured tools sebagai fallback.
 */

/* ---- Tombol Bintang pada Tool Card ---- */
.fav-btn {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 2;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    padding: 0;
    transition: transform 0.18s ease, background 0.18s ease;
    color: var(--text-tertiary, #64748b);
}

.fav-btn:hover {
    background: rgba(250, 204, 21, 0.12);
    transform: scale(1.15);
}

.fav-btn svg {
    width: 18px;
    height: 18px;
    transition: color 0.2s ease, fill 0.2s ease;
}

/* Aktif — bintang kuning */
.fav-btn.is-fav {
    color: #facc15;
}

.fav-btn.is-fav svg {
    fill: #facc15;
    stroke: #facc15;
    filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.5));
}

/* Animasi pop saat di-klik */
.fav-btn.pop {
    animation: fav-pop 0.28s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes fav-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); }
    80%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Badge jumlah favorit di judul section */
.my-fav-count-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    vertical-align: middle;
    margin-left: 8px;
}



/* ---- Section Favorit Saya ---- */
/* Section dirender oleh PHP secara default, JS hanya mengganti konten grid */
#my-favorites-section {
    /* visible by default — PHP renders featured tools as fallback */
}


/* Badge "Favorit Kamu" */
.my-fav-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    background: rgba(250, 204, 21, 0.12);
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

/* Empty state favorit */
.fav-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 0.75rem;
    color: var(--text-tertiary, #94a3b8);
    font-size: 0.9rem;
    text-align: center;
}

.fav-empty svg {
    width: 40px;
    height: 40px;
    opacity: 0.3;
}

/* Toast notifikasi */
.fav-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.fav-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.fav-toast .star-icon { color: #facc15; }

/* ---- Sidebar Badges ---- */
.sidebar-badges {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sidebar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.sidebar-badge svg {
    width: 14px !important;
    height: 14px !important;
}

.sidebar-badge.badge-popular {
    color: #ef4444;
}

.sidebar-badge.badge-fav {
    color: #facc15;
}

.sidebar-badge.badge-fav svg {
    fill: #facc15;
}

/* Sembunyikan badge jika sidebar diminimalkan */
.tool-sidebar.minimized .sidebar-badges {
    display: none !important;
}

/* ---- Detail Page Breadcrumb Favorite Button ---- */
.breadcrumb-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.breadcrumb-container .breadcrumb {
    margin-bottom: 0 !important;
    flex: 1;
    min-width: 0;
}

.fav-btn-detail {
    position: static !important;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 50% !important;
    color: var(--text-tertiary, #64748b);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    box-sizing: border-box;
}

.fav-btn-detail:hover {
    background: rgba(250, 204, 21, 0.1) !important;
    border-color: rgba(250, 204, 21, 0.4) !important;
    transform: scale(1.08);
}

.fav-btn-detail.is-fav {
    color: #facc15 !important;
    border-color: rgba(250, 204, 21, 0.6) !important;
    background: rgba(250, 204, 21, 0.05) !important;
}

.fav-btn-detail.is-fav svg {
    fill: #facc15 !important;
    stroke: #facc15 !important;
}
