/* Favorites Section on Homepage */
#favorites-section {
    display: none;
    /* Hidden by default */
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: var(--md-sys-color-secondary-container);
    border-radius: 16px;
    border: 1px solid var(--md-sys-color-outline-variant);
}

#favorites-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--md-sys-color-on-secondary-container);
}

/* Ensure card is relative for absolute positioning of heart */
.card {
    position: relative !important;
}

/* Favorite Toggle Button (Heart) - Top Right */
.fav-toggle-btn {
    --md-icon-button-icon-size: 24px;
    color: var(--md-sys-color-outline);
    transition: color 0.2s;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}

/* Active state for filled heart */
.fav-toggle-btn.active {
    color: var(--md-sys-color-error);
    /* Red heart */
}

/* Target BOTH class-based and ID-based active states */
.fav-toggle-btn.active md-icon,
.fav-toggle-btn.active .material-symbols-outlined,
#header-fav-btn.active md-icon {
    font-variation-settings: 'FILL' 1 !important;
}

/* Floating Action Button (FAB) Area */
#fav-fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    overflow: visible;
}

.fav-menu {
    background: var(--md-sys-color-surface-container-high);
    border-radius: 16px;
    padding: 8px 0;
    box-shadow: var(--md-sys-elevation-level3);
    min-width: 250px;
    max-width: 300px;

    /* Absolute position relative to the container */
    position: absolute;
    bottom: 100%;
    /* Sit on top of the container */
    right: 0;
    margin-bottom: 16px;
    /* Gap between menu and FAB */

    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
}

.fav-menu.open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.fav-menu-header {
    padding: 8px 16px;
    font-weight: bold;
    color: var(--md-sys-color-on-surface);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: 4px;
}

.fav-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none !important;
    color: var(--md-sys-color-on-surface);
    transition: background-color 0.2s;
}

.fav-menu-item:hover {
    background-color: var(--md-sys-color-surface-variant);
}

.fav-menu-item .material-symbols-outlined {
    font-size: 20px;
    color: var(--md-sys-color-primary);
}

.fav-menu-empty {
    padding: 16px;
    text-align: center;
    color: var(--md-sys-color-outline);
    font-style: italic;
}