.favorite-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 7px 12px;
    color: #d4d4d8;
    background: rgba(12, 12, 15, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.favorite-button:hover {
    color: var(--beam-color);
    border-color: color-mix(
        in srgb,
        var(--beam-color) 50%,
        transparent
    );
    transform: translateY(-1px);
}

.favorite-button.is-saved {
    color: #09090b;
    background: var(--beam-color);
    border-color: var(--beam-color);
    box-shadow: 0 8px 25px color-mix(
        in srgb,
        var(--beam-color) 20%,
        transparent
    );
}

.favorite-button.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.favorite-button__icon {
    font-family: Arial, sans-serif !important;
    font-size: 20px;
    line-height: 1;
}

.favorite-button__count {
    min-width: 1.2em;
    color: inherit;
    font-family: Arial, sans-serif !important;
    font-size: 12px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-align: center;
    direction: ltr;
}

.favorite-button--company-card,
.favorite-button--promotion {
    position: absolute;
    z-index: 12;
    top: 12px;
    left: 12px;
}

.market-card,
.promo-card,
.pf-hero-card {
    position: relative;
}

.favorite-button--firm {
    position: absolute;
    z-index: 12;
    top: 18px;
    left: 18px;
}

.favorite-button--saved-card {
    min-width: 38px;
    padding-inline: 9px;
}

.favorite-button--saved-card .favorite-button__label {
    display: none;
}

.favorite-toast {
    position: fixed;
    z-index: 999999;
    left: 50%;
    bottom: 24px;
    width: max-content;
    max-width: calc(100% - 30px);
    padding: 12px 18px;
    opacity: 0;
    visibility: hidden;
    color: #fff;
    background: rgba(13, 13, 16, 0.98);
    border: 1px solid color-mix(
        in srgb,
        var(--beam-color) 45%,
        rgba(255, 255, 255, 0.1)
    );
    border-radius: 14px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    transform: translate(-50%, 12px);
    transition:
        opacity 0.24s ease,
        visibility 0.24s ease,
        transform 0.24s ease;
}

.favorite-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.favorite-toast.is-error {
    border-color: rgba(255, 107, 107, 0.5);
}

.profile-favorites {
    margin-bottom: 18px;
    padding: 22px;
    border: 1px solid color-mix(
        in srgb,
        var(--beam-color) 30%,
        rgba(255, 255, 255, 0.08)
    );
    border-radius: 22px;
    background:
        radial-gradient(
            circle at 100% 0,
            color-mix(in srgb, var(--beam-color) 8%, transparent),
            transparent 34%
        ),
        var(--auth-card);
    box-shadow:
        0 22px 55px rgba(0, 0, 0, 0.3),
        0 0 26px color-mix(
            in srgb,
            var(--beam-color) 5%,
            transparent
        );
}

.profile-favorites__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 17px;
}

.profile-favorites__heading h2 {
    margin: 0 0 4px;
    color: #fff;
    font-size: 21px;
}

.profile-favorites__heading p {
    margin: 0;
    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.7;
}

.profile-favorites__groups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
}

.favorite-group {
    --favorite-group-accent: var(--beam-color);

    position: relative;
    min-width: 0;
    overflow: hidden;
    padding: 14px;
    border: 1px solid color-mix(
        in srgb,
        var(--favorite-group-accent) 24%,
        rgba(255, 255, 255, 0.08)
    );
    border-radius: 17px;
    background:
        linear-gradient(
            145deg,
            color-mix(
                in srgb,
                var(--favorite-group-accent) 6%,
                transparent
            ),
            transparent 46%
        ),
        rgba(255, 255, 255, 0.018);
}

.favorite-group::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        color-mix(
            in srgb,
            var(--favorite-group-accent) 72%,
            transparent
        ),
        transparent
    );
}

.favorite-group[data-favorite-group="promotion"] {
    --favorite-group-accent: #f59e0b;
}

.favorite-group[data-saved-comparison-group] {
    --favorite-group-accent: #38bdf8;
}

.favorite-group__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 11px;
    color: #fff;
    font-size: 14px;
}

.favorite-group__title::before {
    content: "";
    width: 4px;
    height: 17px;
    flex: 0 0 auto;
    background: var(--favorite-group-accent);
    border-radius: 999px;
    box-shadow: 0 0 14px color-mix(
        in srgb,
        var(--favorite-group-accent) 30%,
        transparent
    );
}

.favorite-group__count {
    display: grid;
    place-items: center;
    min-width: 25px;
    height: 21px;
    margin-inline-start: auto;
    padding-inline: 6px;
    color: #09090b;
    background: var(--favorite-group-accent);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
}

.favorite-saved-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.favorite-saved-card {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 66px;
    padding: 9px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 13px;
    background: rgba(5, 5, 7, 0.42);
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.favorite-saved-card:hover {
    border-color: color-mix(
        in srgb,
        var(--favorite-group-accent) 34%,
        rgba(255, 255, 255, 0.08)
    );
    background: color-mix(
        in srgb,
        var(--favorite-group-accent) 4%,
        rgba(5, 5, 7, 0.48)
    );
    transform: translateY(-1px);
}

.favorite-saved-card__logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border: 1px solid color-mix(
        in srgb,
        var(--favorite-group-accent) 32%,
        rgba(255, 255, 255, 0.08)
    );
    border-radius: 11px;
    background: #0b0b0d;
}

.favorite-saved-card__content {
    min-width: 0;
}

.favorite-saved-card__content a {
    display: block;
    overflow: hidden;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.favorite-saved-card__content a:hover {
    color: var(--favorite-group-accent);
}

.favorite-saved-card__content span {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: var(--auth-muted);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.favorite-empty {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    min-height: 76px;
    margin: 0;
    padding: 12px;
    color: #a8a8b2;
    background: rgba(255, 255, 255, 0.016);
    border: 1px dashed color-mix(
        in srgb,
        var(--favorite-group-accent) 22%,
        rgba(255, 255, 255, 0.1)
    );
    border-radius: 13px;
    font-size: 10px;
    line-height: 1.7;
    text-align: center;
}

@media (max-width: 768px) {
    .favorite-button--company-card,
    .favorite-button--promotion {
        top: 9px;
        left: 9px;
    }

    .favorite-button--firm {
        position: static;
        width: 100%;
        margin-top: 14px;
    }

    .favorite-button--company-card .favorite-button__label,
    .favorite-button--promotion .favorite-button__label {
        display: none;
    }

    .favorite-button--company-card,
    .favorite-button--promotion {
        width: 38px;
        padding: 6px;
    }

    .profile-favorites {
        margin-bottom: 14px;
        padding: 17px 13px;
        border-radius: 19px;
    }

    .profile-favorites__heading {
        margin-bottom: 14px;
    }

    .profile-favorites__heading h2 {
        font-size: 19px;
    }

    .profile-favorites__heading p {
        font-size: 10px;
    }

    .profile-favorites__groups {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .favorite-group {
        padding: 12px;
        border-radius: 15px;
    }

    .favorite-saved-grid {
        grid-template-columns: 1fr;
    }

    .favorite-empty {
        min-height: 62px;
        padding: 10px;
    }
}


/* تصميم المفضلة: قلب ورقم فقط بدون دائرة */
.favorite-button--company-card,
.favorite-button--promotion,
.favorite-button--firm {
    width: auto;
    min-height: 34px;
    padding: 3px 2px;
    gap: 5px;
    color: #e4e4e7;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.favorite-button--company-card:hover,
.favorite-button--promotion:hover,
.favorite-button--firm:hover,
.favorite-button--company-card.is-saved,
.favorite-button--promotion.is-saved,
.favorite-button--firm.is-saved {
    color: var(--beam-color);
    background: transparent;
    border: 0;
    box-shadow: none;
}

.favorite-button--company-card .favorite-button__label,
.favorite-button--promotion .favorite-button__label,
.favorite-button--firm .favorite-button__label {
    display: none;
}

.favorite-button--company-card .favorite-button__icon,
.favorite-button--promotion .favorite-button__icon,
.favorite-button--firm .favorite-button__icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    color: inherit;
    background: currentColor;
    font-size: 0;

    -webkit-mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 0 0 0-7.78Z' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        center / contain no-repeat;

    mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 0 0 0-7.78Z' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        center / contain no-repeat;
}

.favorite-button--company-card .favorite-button__count,
.favorite-button--promotion .favorite-button__count,
.favorite-button--firm .favorite-button__count {
    min-width: auto;
    font-size: 13px;
}

.favorite-button--company-card.is-saved .favorite-button__icon,
.favorite-button--promotion.is-saved .favorite-button__icon,
.favorite-button--firm.is-saved .favorite-button__icon {
    -webkit-mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M12 21.35 10.55 20.03C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54Z'/%3E%3C/svg%3E")
        center / contain no-repeat;

    mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M12 21.35 10.55 20.03C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54Z'/%3E%3C/svg%3E")
        center / contain no-repeat;
}

.favorite-button--company-card:focus-visible,
.favorite-button--promotion:focus-visible,
.favorite-button--firm:focus-visible {
    outline: 2px solid var(--beam-color);
    outline-offset: 3px;
}


/* نقل المفضلة بالكمبيوتر بعيدًا عن أزرار الشركة */
@media (min-width: 993px) {
    .favorite-button--company-card {
        top: 10px;
        left: 220px;
        z-index: 20;
    }
}