/* OS cart: storefront-compatible material preview and add actions */
.cart-menu-dropdown {
    position: relative;
}

.cart-toolbar-entry {
    position: static;
    display: block;
    width: 48px;
    height: 48px;
}

.cart-menu-btn {
    position: relative;
    width: 48px;
    height: 48px;
}

.cart-menu-btn i {
    font-size: 20px;
    line-height: 1;
}

.cart-count-badge {
    position: absolute;
    top: 3px;
    right: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 999px;
    background: #BD1C22;
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    line-height: 15px;
    transform-origin: center;
}

.cart-count-badge[hidden] {
    display: none;
}

.cart-count-badge.bump {
    animation: cart-badge-bump 0.28s ease;
}

.cart-dropdown-menu {
    position: fixed;
    top: 8px;
    right: auto;
    left: 68px;
    width: 410px;
    min-width: 410px;
    max-height: calc(100vh - 16px);
    overflow: hidden;
    padding: 8px;
    z-index: 9000;
    color-scheme: light;
}

.cart-dropdown-menu.is-open {
    display: flex;
    flex-direction: column;
}

.cart-dropdown-header {
    flex: 0 0 auto;
    padding: 8px;
}

.cart-dropdown-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cart-dropdown-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    color: #232328;
}

.cart-dropdown-count {
    flex: 0 0 auto;
    color: rgba(35, 35, 40, 0.56);
    font-size: 12px;
    line-height: 18px;
}

.cart-dropdown-project {
    display: block;
    min-width: 0;
    max-width: 100%;
    color: rgba(35, 35, 40, 0.56);
    font-size: 12px;
    line-height: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-dropdown-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px;
}

.cart-sync-option {
    margin-left: auto;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: rgba(35, 35, 40, 0.68);
    font-size: 12px;
    line-height: 18px;
    cursor: pointer;
    user-select: none;
}

.cart-sync-option:hover {
    color: #232328;
}

.cart-sync-option input {
    width: 12px;
    height: 12px;
    margin: 0;
    accent-color: #BD1C22;
    cursor: pointer;
}

.cart-sync-help {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: -6px;
    color: rgba(35, 35, 40, 0.42);
    cursor: help;
}

.cart-sync-help:hover,
.cart-sync-help:focus-visible {
    color: rgba(35, 35, 40, 0.78);
}

.cart-sync-help i {
    font-size: 12px;
    line-height: 1;
}

.cart-sync-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: -4px;
    z-index: 2;
    width: 238px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(28, 30, 36, 0.94);
    color: #ffffff;
    font-size: 12px;
    line-height: 18px;
    white-space: normal;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: translateY(-2px);
    pointer-events: none;
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.cart-sync-tooltip::before {
    content: "";
    position: absolute;
    top: -4px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: rgba(28, 30, 36, 0.94);
    transform: rotate(45deg);
}

.cart-sync-help:hover .cart-sync-tooltip,
.cart-sync-help:focus-visible .cart-sync-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.cart-dropdown-divider {
    flex: 0 0 auto;
    height: 1px;
    margin: 4px -4px;
    background: rgba(24, 24, 29, 0.08);
}

.cart-empty-state {
    flex: 0 0 auto;
    padding: 24px 14px 22px;
    text-align: center;
}

.cart-empty-title {
    color: #232328;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.cart-empty-hint {
    max-width: 24ch;
    margin: 5px auto 0;
    color: rgba(35, 35, 40, 0.56);
    font-size: 12px;
    line-height: 18px;
}

.cart-preview-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px 0;
}

.cart-preview-row {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto 24px;
    align-items: center;
    gap: 8px;
    padding: 9px 8px;
    border-radius: 4px;
}

.cart-preview-select,
.cart-select-all {
    display: inline-flex;
    align-items: center;
    color: rgba(35, 35, 40, 0.72);
    cursor: pointer;
    user-select: none;
}

.cart-preview-select input,
.cart-select-all input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: #BD1C22;
    cursor: pointer;
}

.cart-preview-select.is-disabled,
.cart-select-all.is-disabled {
    color: rgba(35, 35, 40, 0.36);
    cursor: not-allowed;
}

.cart-preview-select.is-disabled input,
.cart-select-all.is-disabled input {
    cursor: not-allowed;
}

.cart-preview-row:hover {
    background: rgba(0, 0, 0, 0.04);
}

.cart-preview-row.is-confirming-remove {
    background: rgba(189, 28, 34, 0.06);
}

.cart-preview-main {
    min-width: 0;
}

.cart-preview-name {
    color: #232328;
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-preview-meta,
.cart-preview-extra,
.cart-preview-price {
    margin-top: 2px;
    color: rgba(35, 35, 40, 0.56);
    font-size: 11px;
    line-height: 16px;
}

.cart-preview-meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-preview-extra {
    white-space: normal;
    overflow-wrap: anywhere;
}

.cart-preview-unavailable {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    margin-top: 2px;
    border-radius: 3px;
    padding: 0 6px;
    background: rgba(189, 28, 34, 0.08);
    color: #9f252a;
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
    cursor: help;
}

.cart-preview-side {
    min-width: 62px;
    text-align: right;
}

.cart-preview-qty {
    color: #232328;
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
    font-variant-numeric: tabular-nums;
}

.cart-preview-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: rgba(35, 35, 40, 0.42);
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.cart-preview-remove:hover,
.cart-preview-remove:focus-visible {
    background: rgba(189, 28, 34, 0.08);
    color: #BD1C22;
}

.cart-preview-remove:disabled {
    background: transparent;
    color: rgba(35, 35, 40, 0.28);
    cursor: not-allowed;
}

.cart-preview-remove:disabled:hover {
    background: transparent;
    color: rgba(35, 35, 40, 0.28);
}

.cart-preview-remove i {
    font-size: 13px;
    line-height: 1;
}

.cart-remove-confirm {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding-top: 2px;
    color: rgba(35, 35, 40, 0.68);
    font-size: 11px;
    line-height: 16px;
}

.cart-remove-confirm-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cart-remove-confirm-btn {
    min-height: 24px;
    border: 0;
    border-radius: 4px;
    padding: 0 8px;
    font-size: 11px;
    line-height: 16px;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.cart-remove-confirm-btn.secondary {
    background: rgba(255, 255, 255, 0.7);
    color: #232328;
}

.cart-remove-confirm-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.96);
}

.cart-remove-confirm-btn.danger {
    background: rgba(189, 28, 34, 0.12);
    color: #BD1C22;
}

.cart-remove-confirm-btn.danger:hover {
    background: #BD1C22;
    color: #ffffff;
}

.cart-summary {
    flex: 0 0 auto;
    display: grid;
    gap: 5px;
    padding: 8px;
}

.cart-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: rgba(35, 35, 40, 0.56);
    font-size: 12px;
    line-height: 18px;
}

.cart-summary-value {
    color: #232328;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.cart-dropdown-actions {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin: 4px 0 0;
    border-radius: 4px;
    padding: 4px 6px 4px 10px;
    background: rgba(35, 35, 40, 0.08);
}

.cart-select-all {
    gap: 6px;
    font-size: 12px;
    line-height: 18px;
}

.cart-checkout-control {
    position: relative;
    display: block;
    min-width: 0;
}

.cart-dropdown-action {
    width: 100%;
    min-height: 36px;
    border: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 10px;
    cursor: pointer;
    font-size: 13px;
    line-height: 18px;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.cart-dropdown-action.primary {
    background: transparent;
    color: #232328;
}

.cart-dropdown-action.primary:hover {
    background: rgba(35, 35, 40, 0.08);
}

.cart-dropdown-action.secondary {
    background: transparent;
    color: #232328;
}

.cart-dropdown-action.secondary:hover {
    background: rgba(0, 0, 0, 0.04);
}

.cart-dropdown-action:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.cart-dropdown-action:disabled:hover {
    background: transparent;
}

.cart-checkout-tooltip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 3;
    width: max-content;
    max-width: 220px;
    padding: 7px 9px;
    border-radius: 4px;
    background: rgba(28, 30, 36, 0.96);
    color: #ffffff;
    font-size: 11px;
    line-height: 16px;
    white-space: normal;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(2px);
    pointer-events: none;
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.cart-checkout-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 18px;
    border: 4px solid transparent;
    border-top-color: rgba(28, 30, 36, 0.96);
}

.cart-checkout-control:hover .cart-checkout-tooltip,
.cart-checkout-control:focus-within .cart-checkout-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.cart-toolbar-entry.open .cart-menu-btn,
.cart-toolbar-entry .cart-menu-btn.active {
    background: #BD1C22;
    color: #ffffff;
}

.hitbot-cart-toast {
    position: fixed;
    right: 18px;
    top: 64px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(340px, calc(100vw - 36px));
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(35, 35, 40, 0.96);
    color: #ffffff;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
    font-size: 13px;
    line-height: 18px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

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

.hitbot-cart-toast i {
    color: #42d987;
    font-size: 16px;
}

@keyframes cart-badge-bump {
    0% {
        transform: scale(1);
    }
    45% {
        transform: scale(1.18);
    }
    100% {
        transform: scale(1);
    }
}
