/* Shared product favorite control. Kept separate from the account bundle. */
.hg-favorite-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 42px;
    min-height: 42px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--muted);
    box-shadow: 0 7px 20px rgba(35, 40, 78, .09);
    line-height: 1;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.hg-favorite-toggle i {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    font-size: 17px;
    line-height: 1;
    transition: transform .2s ease;
}

.hg-favorite-toggle:hover,
.hg-favorite-toggle:focus-visible {
    border-color: var(--sky);
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 9px 23px rgba(35, 40, 78, .13);
    transform: translateY(-1px);
    outline: 0;
}

.hg-favorite-toggle:hover i,
.hg-favorite-toggle:focus-visible i {
    transform: scale(1.08);
}

.hg-favorite-toggle.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--paper);
}

.hg-favorite-toggle.is-active:hover,
.hg-favorite-toggle.is-active:focus-visible {
    border-color: var(--primary-2);
    background: var(--primary-2);
    color: var(--paper);
}

.hg-favorite-toggle.is-loading {
    opacity: .62;
    pointer-events: none;
}

.hg-favorite-toggle.is-loading i {
    animation: hg-favorite-pulse .75s ease-in-out infinite alternate;
}

.hg-product-image > .hg-favorite-toggle {
    position: absolute;
    z-index: 8;
    top: 12px;
    left: 12px;
    width: 42px;
    height: 42px;
}

.hg-favorite-toggle.has-label {
    min-width: 176px;
    min-height: 44px;
    padding: 9px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.6;
    white-space: nowrap;
}

.hg-book-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.hg-book-title-row .product_title {
    flex: 1 1 auto;
    min-width: 0;
}

.hg-account-book .hg-favorite-toggle {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 10px;
}

.hg-account-toast {
    position: fixed;
    z-index: 9999;
    left: 25px;
    bottom: 25px;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: min(390px, calc(100vw - 30px));
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--success);
    color: var(--paper);
    box-shadow: 0 14px 35px rgba(15, 28, 48, .22);
    font-size: 12px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}

.hg-account-toast.is-visible {
    opacity: 1;
    transform: none;
}

.hg-account-toast.is-error {
    background: var(--primary);
}

@keyframes hg-favorite-pulse {
    from { transform: scale(.82); }
    to { transform: scale(1.08); }
}

@media (max-width: 680px) {
    .hg-book-title-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .hg-book-title-row > .hg-favorite-toggle {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 430px) {
    .hg-product-image > .hg-favorite-toggle {
        top: 8px;
        left: 8px;
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        border-radius: 10px;
    }

    .hg-product-image > .hg-favorite-toggle i {
        font-size: 15px;
    }

    .hg-account-toast {
        right: 15px;
        left: 15px;
        bottom: 15px;
        max-width: none;
    }
}
