/*
 * DEVMC - 2026.10.23 - feature #header-favorites-preview# "Hover panel of the header 'Favoritos'
 * (owner mockup). Markup: layouts/index.blade.php (.header-favorites wrapper + empty panel) and
 * account/partials/favorites-preview.blade.php (panel body, fetched by header-favorites.js).
 * Loaded by htmlheader.blade.php with manual ?v=N."
 */

.header-favorites {
    position: relative;
    display: inline-flex;
}

.header-favorites__panel {
    position: absolute;
    top: calc(100% + 14px);
    right: -16px;
    z-index: 1050;
    display: none;
    width: 420px;
    max-width: calc(100vw - 32px);
    padding: 20px;
    border: 1px solid #ececec;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.14);
    /* Fixed, not var(--text-color): the panel background is always white, and some tenants set
       --text-color to a light tone (measured: title and names came out white on white). */
    color: #222;
    text-align: left;
}

/* Arrow pointing at the trigger. */
.header-favorites__panel::before {
    content: "";
    position: absolute;
    top: -8px;
    right: 34px;
    width: 14px;
    height: 14px;
    border-top: 1px solid #ececec;
    border-left: 1px solid #ececec;
    background: #fff;
    transform: rotate(45deg);
}

/* Invisible bridge over the gap, so moving the pointer from the icon to the panel keeps it open. */
.header-favorites__panel::after {
    content: "";
    position: absolute;
    top: -16px;
    right: 0;
    left: 0;
    height: 16px;
}

.header-favorites.is-open .header-favorites__panel {
    display: block;
    animation: header-favorites-in 0.15s ease-out;
}

@keyframes header-favorites-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

.header-favorites__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.header-favorites__title {
    font-size: 20px;
    font-weight: 700;
}

.header-favorites__count {
    color: #777;
    font-size: 13px;
}

.header-favorites__list {
    max-height: 420px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.header-favorites__item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
}

.header-favorites__item:last-child {
    border-bottom: 0;
}

.header-favorites__thumb {
    flex: 0 0 96px;
    width: 96px;
    height: 96px;
    overflow: hidden;
    border-radius: 10px;
    background: #f6f6f6;
}

.header-favorites__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-favorites__info {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.header-favorites__name {
    color: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.header-favorites__name:hover {
    color: var(--link-hover-color, inherit);
}

.header-favorites__brand,
.header-favorites__installments,
.header-favorites__unavailable {
    color: #777;
    font-size: 12px;
}

.header-favorites__price {
    margin-top: 4px;
    font-size: 17px;
    font-weight: 700;
}

.header-favorites__remove {
    align-self: flex-start;
    margin-top: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--link-color, #1a73e8);
    font-size: 12px;
    cursor: pointer;
}

.header-favorites__remove:hover {
    text-decoration: underline;
}

.header-favorites__remove:disabled {
    opacity: 0.5;
    cursor: wait;
}

.header-favorites__heart {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    fill: rgb(255, 91, 137);
}

.header-favorites__empty {
    margin: 0;
    padding: 18px 0;
    color: #777;
    font-size: 13px;
    text-align: center;
}

.header-favorites__all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    padding: 12px;
    border-radius: 10px;
    background: #f3f3f5;
    color: inherit;
    font-size: 14px;
    font-weight: 600;
}

.header-favorites__all:hover {
    background: #e9e9ec;
    color: inherit;
}

.header-favorites__remove:focus-visible,
.header-favorites__all:focus-visible,
.header-favorites__name:focus-visible,
.header-favorites__thumb:focus-visible {
    outline: 2px solid var(--header-menu-top-color);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .header-favorites.is-open .header-favorites__panel {
        animation: none;
    }
}
