/**
 * File: assets/css/frontend/header-widgets/widgets.css
 * Purpose: Styles Engine-owned notification, account, wishlist, compare and cart widget content plus product-list actions.
 * Scope: Widget internals and product action forms only; the theme owns action buttons, positioning and hover interaction.
 * Related PHP: src/HeaderWidgets/HeaderWidgetRenderer.php
 * Related CSS: HyperDAF Pro assets/css/frontend/header/actions.css
 * Related JS: None
 * Package: HyperDAF Engine
 */

.hdf-header-action__widget {
    --hdf-widget-pad: var(--hdf-engine-spacing-4, 1rem);
    color: var(--hdf-engine-color-text-primary, var(--hdf-engine-color-text));
    font-family: var(--hdf-engine-font-family, Inter, sans-serif);
}

.hdf-header-widget-head,
.hdf-header-widget-footer,
.hdf-header-cart-total,
.hdf-header-cart-actions,
.hdf-header-account-actions,
.hdf-header-widget-empty {
    padding: var(--hdf-widget-pad);
}

.hdf-header-widget-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--hdf-engine-color-border, var(--hdf-engine-color-border));
}

.hdf-header-widget-head strong,
.hdf-header-widget-head small {
    display: block;
}

.hdf-header-widget-head small,
.hdf-header-widget-list small {
    margin-top: .2rem;
    color: var(--hdf-engine-color-text-muted, var(--hdf-engine-color-text-muted));
    font-size: .75rem;
}

.hdf-header-widget-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.hdf-header-widget-list > li {
    position: relative;
    display: flex;
    align-items: center;
    gap: .65rem;
    border-bottom: 1px solid var(--hdf-engine-color-border, var(--hdf-engine-color-border));
}

.hdf-header-widget-list > li > a {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .8rem var(--hdf-widget-pad);
    color: inherit;
    text-decoration: none;
}

.hdf-header-widget-list > li > a:hover strong {
    text-decoration: underline;
    text-underline-offset: .18em;
}

.hdf-header-widget-list span,
.hdf-header-widget-list strong,
.hdf-header-widget-list small {
    min-width: 0;
}

.hdf-header-widget-list strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .84rem;
}

.hdf-header-widget-thumb {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: .45rem;
    object-fit: cover;
    background: var(--hdf-engine-color-surface-subtle, var(--hdf-engine-color-canvas));
}

.hdf-header-widget-thumb--empty {
    border: 1px dashed var(--hdf-engine-color-border, var(--hdf-engine-color-border));
}

.hdf-header-widget-remove {
    width: 1.8rem;
    height: 1.8rem;
    flex: 0 0 1.8rem;
    margin-right: .75rem;
    border: 0;
    border-radius: var(--hdf-engine-radius-pill);
    background: transparent;
    color: var(--hdf-engine-color-text-muted, var(--hdf-engine-color-text-muted));
    cursor: pointer;
    font-size: 1.15rem;
}

.hdf-header-widget-remove:hover,
.hdf-header-widget-remove:focus-visible {
    background: var(--hdf-engine-color-danger-soft);
    color: var(--hdf-engine-color-danger);
}

.hdf-header-widget-status {
    width: .55rem;
    height: .55rem;
    flex: 0 0 .55rem;
    border-radius: var(--hdf-engine-radius-pill);
    background: var(--hdf-engine-color-text-disabled);
}

.hdf-header-widget-status--paid,
.hdf-header-widget-status--partially_refunded {
    background: var(--hdf-engine-color-success);
}

.hdf-header-widget-status--pending_payment,
.hdf-header-widget-status--payment_processing {
    background: var(--hdf-engine-color-seo-needs-work);
}

.hdf-header-widget-status--payment_failed,
.hdf-header-widget-status--cancelled,
.hdf-header-widget-status--refunded {
    background: var(--hdf-engine-color-danger);
}

.hdf-header-account-nav {
    display: grid;
}

.hdf-header-account-nav a,
.hdf-header-widget-footer a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem var(--hdf-widget-pad);
    border-bottom: 1px solid var(--hdf-engine-color-border, var(--hdf-engine-color-border));
    color: inherit;
    text-decoration: none;
}

.hdf-header-widget-footer {
    border-top: 1px solid var(--hdf-engine-color-border, var(--hdf-engine-color-border));
}

.hdf-header-widget-footer a {
    padding: 0;
    border: 0;
    font-weight: 600;
}

.hdf-header-account-actions,
.hdf-header-cart-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
}

.hdf-header-widget-button,
.hdf-header-widget-empty a {
    display: inline-flex;
    min-height: 2.45rem;
    align-items: center;
    justify-content: center;
    padding: .55rem .8rem;
    border: 1px solid var(--hdf-engine-color-border, var(--hdf-engine-color-border));
    border-radius: .55rem;
    background: var(--hdf-engine-color-surface, var(--hdf-engine-color-surface));
    color: var(--hdf-engine-color-text-primary, var(--hdf-engine-color-text));
    font-size: .82rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.hdf-header-widget-button--primary,
.hdf-header-widget-empty a {
    border-color: var(--hdf-engine-color-primary-strong, var(--hdf-engine-color-primary-strong));
    background: var(--hdf-engine-color-primary-strong, var(--hdf-engine-color-primary-strong));
    color: var(--hdf-engine-color-surface);
}

.hdf-header-widget-empty {
    text-align: center;
}

.hdf-header-widget-empty p {
    margin: 0 0 .8rem;
    color: var(--hdf-engine-color-text-muted, var(--hdf-engine-color-text-muted));
}

.hdf-header-widget-clear {
    padding: .65rem var(--hdf-widget-pad);
    text-align: right;
}

.hdf-header-widget-clear button {
    border: 0;
    background: transparent;
    color: var(--hdf-engine-color-danger);
    cursor: pointer;
    font-weight: 600;
}

.hdf-header-cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--hdf-engine-color-border, var(--hdf-engine-color-border));
}

.hdf-product-list-actions,
.hdf-single-product-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.hdf-product-list-actions {
    position: absolute;
    z-index: 3;
    top: .65rem;
    right: .65rem;
}

.hdf-product-list-action {
    margin: 0;
}

.hdf-product-list-action__button {
    display: inline-flex;
    min-width: 2.35rem;
    min-height: 2.35rem;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .5rem;
    border: 1px solid var(--hdf-engine-color-border, var(--hdf-engine-color-border));
    border-radius: .55rem;
    background: rgba(255, 255, 255, .94);
    color: var(--hdf-engine-color-text-primary, var(--hdf-engine-color-text));
    cursor: pointer;
    box-shadow: 0 3px 14px rgba(16, 24, 40, .08);
}

.hdf-product-list-action__button svg {
    width: 1.05rem;
    height: 1.05rem;
    stroke: currentColor;
}

.hdf-product-list-action__button.is-active {
    border-color: var(--hdf-engine-color-primary-strong, var(--hdf-engine-color-primary-strong));
    background: var(--hdf-engine-color-surface-selected);
    color: var(--hdf-engine-color-primary-strong, var(--hdf-engine-color-primary-strong));
}

.hdf-product-list-actions .hdf-product-list-action__button span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.hdf-single-product-list-actions {
    margin-top: .75rem;
}

.hdf-single-product-list-actions .hdf-product-list-action__button {
    background: var(--hdf-engine-color-surface, var(--hdf-engine-color-surface));
    box-shadow: none;
}

@media (max-width: 520px) {
    .hdf-header-account-actions,
    .hdf-header-cart-actions {
        grid-template-columns: 1fr;
    }
}

/* Global catalogue-card placement; header dropdown list actions retain their own rules above. */
.hdf-product-card .hdf-product-list-actions {
    position: absolute;
    left: .85rem;
    right: auto;
    top: auto;
    bottom: .85rem;
    z-index: 3;
    display: flex;
    gap: .45rem;
}

.hdf-product-card .hdf-product-list-actions form {
    margin: 0;
}

.hdf-product-card .hdf-product-list-actions button {
    display: inline-flex;
    width: 2.2rem;
    height: 2.2rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(17, 24, 39, .13);
    border-radius: var(--hdf-engine-radius-pill);
    background: var(--hdf-engine-color-surface);
    box-shadow: 0 .2rem .55rem rgba(17, 24, 39, .12);
    color: var(--hdf-engine-color-text);
    cursor: pointer;
}

.hdf-product-card .hdf-product-list-actions button:hover,
.hdf-product-card .hdf-product-list-actions button:focus-visible,
.hdf-product-card .hdf-product-list-actions button.is-active {
    border-color: var(--hdf-engine-color-primary-strong, var(--hdf-engine-color-primary-strong));
    color: var(--hdf-engine-color-primary-strong, var(--hdf-engine-color-primary-strong));
}

.hdf-product-card .hdf-product-list-actions button span:not([aria-hidden]) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
}


/* Native HyperDAF header action icon family supplied by Engine feature owners. */
.hdf-header-action__button .hdf-engine-icon--header {
    display: block;
    width: calc(var(--hdf-component-header-action-icon-size) * .86);
    height: calc(var(--hdf-component-header-action-icon-size) * .86);
    overflow: visible;
    color: currentColor;
    opacity: .8;
    transform: translateZ(0);
    transition:
        opacity var(--hdf-motion-duration-fast, 160ms) var(--hdf-motion-easing-standard, ease),
        transform var(--hdf-motion-duration-fast, 160ms) var(--hdf-motion-easing-standard, ease);
}

.hdf-header-action__button:hover .hdf-engine-icon--header,
.hdf-header-action__button:focus-visible .hdf-engine-icon--header,
.hdf-header-action__button[aria-expanded="true"] .hdf-engine-icon--header {
    opacity: 1;
    transform: scale(1.035);
}

.hdf-header-action__button .hdf-engine-icon--header-notification {
    width: calc(var(--hdf-component-header-action-icon-size) * .8);
    height: calc(var(--hdf-component-header-action-icon-size) * .8);
}

.hdf-header-action__button .hdf-engine-icon--header-account,
.hdf-header-action__button .hdf-engine-icon--header-favorite,
.hdf-header-action__button .hdf-engine-icon--header-favorite-active {
    width: calc(var(--hdf-component-header-action-icon-size) * .84);
    height: calc(var(--hdf-component-header-action-icon-size) * .84);
}

.hdf-header-action__button .hdf-engine-icon--header-cart {
    width: calc(var(--hdf-component-header-action-icon-size) * .88);
    height: calc(var(--hdf-component-header-action-icon-size) * .84);
}

.hdf-header-action__button .hdf-engine-icon--header-collections {
    width: calc(var(--hdf-component-header-action-icon-size) * .9);
    height: calc(var(--hdf-component-header-action-icon-size) * .9);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.hdf-header-action__button .hdf-engine-icon--header-favorite-active {
    color: var(--hdf-engine-color-primary-strong, currentColor);
    opacity: .9;
}

/* RC.13 premium cart dropdown and AJAX feedback. */
.hdf-header-action--cart .hdf-header-action__widget {
    width: min(25rem, calc(100vw - 2rem));
    max-height: min(34rem, calc(100vh - 7rem));
    overflow: auto;
    border-color: color-mix(in srgb, var(--hdf-engine-color-border) 88%, transparent);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgb(16 24 40 / 16%);
}

.hdf-header-cart-panel {
    overflow: hidden;
    background: var(--hdf-engine-color-surface);
}

.hdf-header-cart-panel__head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--hdf-engine-color-border-subtle);
    background: linear-gradient(180deg, var(--hdf-engine-color-surface), var(--hdf-engine-color-surface-subtle));
}

.hdf-header-cart-panel__icon,
.hdf-header-cart-empty__icon {
    display: grid;
    width: 2.55rem;
    height: 2.55rem;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--hdf-engine-color-primary-strong) 28%, var(--hdf-engine-color-border));
    border-radius: 12px;
    background: var(--hdf-engine-color-surface-selected);
    color: var(--hdf-engine-color-primary-strong);
}

.hdf-header-cart-panel__icon svg,
.hdf-header-cart-empty__icon svg {
    width: 1.25rem;
    height: 1.2rem;
}

.hdf-header-cart-panel__heading {
    display: grid;
    gap: .12rem;
    min-width: 0;
}

.hdf-header-cart-panel__heading strong {
    color: var(--hdf-engine-color-text);
    font-size: .94rem;
    line-height: 1.2;
}

.hdf-header-cart-panel__heading small {
    color: var(--hdf-engine-color-text-muted);
    font-size: .74rem;
}

.hdf-header-cart-panel__count {
    display: inline-flex;
    min-width: 1.7rem;
    height: 1.7rem;
    align-items: center;
    justify-content: center;
    padding-inline: .35rem;
    border-radius: 999px;
    background: var(--hdf-engine-color-primary-strong);
    color: var(--hdf-engine-color-surface);
    font-size: .72rem;
    font-weight: 750;
}

.hdf-header-cart-lines {
    display: grid;
    margin: 0;
    padding: .35rem 0;
    list-style: none;
}

.hdf-header-cart-line {
    border-bottom: 1px solid var(--hdf-engine-color-border-subtle);
}

.hdf-header-cart-line:last-child {
    border-bottom: 0;
}

.hdf-header-cart-line__link {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .7rem;
    padding: .72rem 1rem;
    color: inherit;
    text-decoration: none;
    transition: background-color .16s ease;
}

.hdf-header-cart-line__link:hover,
.hdf-header-cart-line__link:focus-visible {
    background: var(--hdf-engine-color-surface-subtle);
    outline: none;
}

.hdf-header-cart-line__mark {
    display: grid;
    width: 2.2rem;
    height: 2.2rem;
    place-items: center;
    border: 1px solid var(--hdf-engine-color-border);
    border-radius: 9px;
    background: var(--hdf-engine-color-surface);
    color: var(--hdf-engine-color-primary-strong);
    font-size: .72rem;
    font-weight: 800;
}

.hdf-header-cart-line__copy {
    display: grid;
    min-width: 0;
    gap: .18rem;
}

.hdf-header-cart-line__copy strong {
    overflow: hidden;
    color: var(--hdf-engine-color-text);
    font-size: .8rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hdf-header-cart-line__copy small {
    color: var(--hdf-engine-color-text-muted);
    font-size: .69rem;
}

.hdf-header-cart-line__link b {
    color: var(--hdf-engine-color-text);
    font-size: .76rem;
    white-space: nowrap;
}

.hdf-header-cart-panel__more {
    margin: 0;
    padding: .55rem 1rem;
    border-top: 1px solid var(--hdf-engine-color-border-subtle);
    color: var(--hdf-engine-color-text-muted);
    font-size: .7rem;
    text-align: center;
}

.hdf-header-cart-panel .hdf-header-cart-total {
    padding: .85rem 1rem .55rem;
    border-top: 1px solid var(--hdf-engine-color-border);
    background: var(--hdf-engine-color-surface-subtle);
}

.hdf-header-cart-panel .hdf-header-cart-total span {
    color: var(--hdf-engine-color-text-secondary);
    font-size: .8rem;
    font-weight: 600;
}

.hdf-header-cart-panel .hdf-header-cart-total strong {
    color: var(--hdf-engine-color-text);
    font-size: 1rem;
}

.hdf-header-cart-panel .hdf-header-cart-actions {
    padding: .55rem 1rem .65rem;
    background: var(--hdf-engine-color-surface-subtle);
}

.hdf-header-cart-panel .hdf-header-widget-button {
    min-height: 2.55rem;
    border-radius: 8px;
}

.hdf-header-cart-panel .hdf-header-widget-button:hover,
.hdf-header-cart-panel .hdf-header-widget-button:focus-visible {
    border-color: var(--hdf-engine-color-primary-strong);
    color: var(--hdf-engine-color-primary-strong);
}

.hdf-header-cart-panel .hdf-header-widget-button--primary:hover,
.hdf-header-cart-panel .hdf-header-widget-button--primary:focus-visible {
    background: var(--hdf-engine-color-primary-hover);
    color: var(--hdf-engine-color-surface);
}

.hdf-header-cart-panel__secure {
    margin: 0;
    padding: 0 1rem .9rem;
    background: var(--hdf-engine-color-surface-subtle);
    color: var(--hdf-engine-color-text-muted);
    font-size: .66rem;
    text-align: center;
}

.hdf-header-cart-empty {
    display: grid;
    justify-items: center;
    gap: .55rem;
    padding: 1.6rem 1.2rem;
    text-align: center;
}

.hdf-header-cart-empty strong {
    color: var(--hdf-engine-color-text);
    font-size: .92rem;
}

.hdf-header-cart-empty p {
    max-width: 28ch;
    margin: 0 0 .35rem;
    color: var(--hdf-engine-color-text-muted);
    font-size: .76rem;
    line-height: 1.5;
}

.hdf-header-action__badge.is-updated {
    animation: hdf-cart-badge-pop .5s ease;
}

.hdf-header-action--cart.is-cart-updated .hdf-header-action__button {
    color: var(--hdf-engine-color-primary-strong);
}

.hdf-cart-toast {
    position: fixed;
    z-index: 100000;
    right: 1rem;
    bottom: 1rem;
    max-width: min(22rem, calc(100vw - 2rem));
    padding: .78rem 1rem;
    border: 1px solid color-mix(in srgb, var(--hdf-engine-color-primary-strong) 35%, var(--hdf-engine-color-border));
    border-radius: 10px;
    background: var(--hdf-engine-color-surface);
    color: var(--hdf-engine-color-text);
    box-shadow: 0 14px 36px rgb(16 24 40 / 18%);
    font-size: .82rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transform: translateY(.65rem);
    transition: opacity .18s ease, transform .18s ease;
}

.hdf-cart-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.hdf-cart-toast.is-error {
    border-color: var(--hdf-engine-color-danger);
    color: var(--hdf-engine-color-danger-text);
}

@keyframes hdf-cart-badge-pop {
    0% { transform: scale(.72); }
    60% { transform: scale(1.22); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .hdf-header-action__badge.is-updated,
    .hdf-product-card__cart-button.is-added .hdf-engine-icon {
        animation: none;
    }
    .hdf-cart-toast {
        transition: none;
    }
}
