/* ========================================================================== 
   Next Purchase — cart subview
   Cart layout owns placement; this file owns tabs and next-purchase content.
   ========================================================================== */

.gk-next-tabs {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    align-items: center;
    gap: 4px;
    padding: 4px;
    direction: rtl;
    background: var(--gk-cc-card-bg, var(--gk-surface));
    border: 1px solid var(--gk-cc-border-color, var(--gk-border-color));
    border-radius: 12px;
    box-shadow: var(--gk-shadow-sm);
}

.gk-next-tabs__tab {
    min-height: 38px;
    padding: 7px 15px;
    color: var(--gk-neutral-600);
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 850;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease;
}
.gk-next-tabs__tab:hover { color: var(--gk-cc-primary, var(--gk-primary)); }
.gk-next-tabs__tab.is-active {
    color: var(--gk-cc-primary, var(--gk-primary));
    background: color-mix(in srgb, var(--gk-cc-primary, var(--gk-primary)) 8%, transparent);
}
.gk-next-tabs__tab:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--gk-cc-primary, var(--gk-primary)) 35%, transparent);
    outline-offset: 1px;
}

.gk-next-cart-row-actions { margin-top: 8px; }
.gk-next-move-from-cart {
    min-height: 30px;
    padding: 3px 8px;
    color: var(--gk-cc-primary, var(--gk-primary));
    background: transparent;
    border: 0;
    border-radius: 7px;
    font-size: 10.5px;
    font-weight: 800;
    cursor: pointer;
}
.gk-next-move-from-cart:hover,
.gk-next-move-from-cart:focus-visible {
    color: var(--gk-cc-primary, var(--gk-primary));
    background: color-mix(in srgb, var(--gk-cc-primary, var(--gk-primary)) 7%, transparent);
    outline: 0;
}

#gk-next-purchase-panel {
    padding: var(--gk-cc-card-padding, 20px);
    background: var(--gk-cc-card-bg, var(--gk-surface));
    border: 1px solid var(--gk-cc-border-color, var(--gk-border-color));
    border-radius: var(--gk-cc-card-radius, 16px);
    box-shadow: var(--gk-cc-card-shadow, var(--gk-shadow-sm));
    direction: rtl;
}

.gk-next-panel__header {
    margin-bottom: 15px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--gk-cc-border-color, var(--gk-border-color));
}
.gk-next-panel__title {
    margin: 0 0 4px;
    color: var(--gk-cc-text-color, var(--gk-text));
    font-size: 18px;
    font-weight: 900;
    line-height: 1.6;
}
.gk-next-panel__subtitle,
.gk-next-panel__guest,
.gk-next-panel__empty {
    margin: 0;
    color: var(--gk-neutral-600);
    font-size: 12px;
    line-height: 1.9;
}
.gk-next-panel__guest,
.gk-next-panel__empty {
    padding: 24px 16px;
    text-align: center;
    background: var(--gk-neutral-50);
    border-radius: 12px;
}
.gk-next-panel__login-btn { margin-top: 10px; }

.gk-next-panel__bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}
.gk-next-panel__bulk-btn,
.gk-next-panel__action {
    min-height: 36px;
    padding: 6px 12px;
    color: var(--gk-neutral-700);
    background: var(--gk-cc-card-bg, var(--gk-surface));
    border: 1px solid var(--gk-cc-border-color, var(--gk-border-color));
    border-radius: 9px;
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}
.gk-next-panel__bulk-btn:hover,
.gk-next-panel__action:hover,
.gk-next-panel__bulk-btn:focus-visible,
.gk-next-panel__action:focus-visible {
    color: var(--gk-cc-primary, var(--gk-primary));
    border-color: color-mix(in srgb, var(--gk-cc-primary, var(--gk-primary)) 38%, var(--gk-cc-border-color, #e5e7eb));
    outline: 0;
}
.gk-next-panel__action.remove,
.gk-next-panel__action--danger,
.gk-next-panel__bulk-btn--danger {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fff7f7;
}

.gk-next-panel__content { display: grid; gap: 12px; }
.gk-next-panel__row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    grid-template-areas:
        'thumb name price'
        'thumb name actions';
    gap: 8px 14px;
    align-items: start;
    padding: 14px;
    background: var(--gk-neutral-50);
    border: 1px solid var(--gk-cc-border-color, var(--gk-border-color));
    border-radius: 13px;
}
.gk-next-panel__row .product-thumbnail { grid-area: thumb; }
.gk-next-panel__row .product-thumbnail img {
    display: block;
    width: 86px;
    height: 86px;
    padding: 5px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--gk-cc-border-color, var(--gk-border-color));
    border-radius: 11px;
}
.gk-next-panel__row .product-name {
    grid-area: name;
    min-width: 0;
    color: var(--gk-cc-text-color, var(--gk-text));
    font-size: 12.5px;
    font-weight: 850;
    line-height: 1.8;
}
.gk-next-panel__row .product-price {
    grid-area: price;
    color: var(--gk-cc-text-color, var(--gk-text));
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}
.gk-next-panel__row .product-actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    align-self: end;
}
.gk-next-panel__variation {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 5px;
    color: var(--gk-neutral-600);
    font-size: 10.5px;
    font-weight: 650;
}
.gk-next-panel__variation-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.gk-next-panel__variation-item::before {
    content: '';
    width: 4px;
    height: 4px;
    flex: 0 0 4px;
    background: var(--gk-neutral-300);
    border-radius: 50%;
}

@media (max-width: 700px) {
    .gk-next-tabs { width: 100%; }
    .gk-next-tabs__tab { flex: 1 1 50%; padding-inline: 10px; }
    #gk-next-purchase-panel { padding: 14px; border-radius: 14px; }
    .gk-next-panel__row {
        grid-template-columns: 72px minmax(0, 1fr);
        grid-template-areas:
            'thumb name'
            'thumb price'
            'actions actions';
        padding: 11px;
        gap: 7px 10px;
    }
    .gk-next-panel__row .product-thumbnail img { width: 68px; height: 68px; }
    .gk-next-panel__row .product-price { white-space: normal; }
    .gk-next-panel__row .product-actions { justify-content: flex-start; margin-top: 3px; }
}

@media (max-width: 430px) {
    .gk-next-panel__bulk-actions { display: grid; grid-template-columns: 1fr; }
    .gk-next-panel__bulk-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .gk-next-tabs__tab,
    .gk-next-move-from-cart,
    .gk-next-panel__bulk-btn,
    .gk-next-panel__action { transition: none !important; }
}

/* Cart v2 — transactional feedback for "Next Purchase" actions. */
.gk-next-panel__row.is-loading,
.gk-next-panel__content.is-loading,
.gk-next-move-from-cart.is-loading,
.gk-next-bulk-cart.is-loading {
    opacity: .58;
    pointer-events: none;
}

.gk-next-undo-toast {
    position: fixed;
    z-index: 10020;
    inset-inline-start: 24px;
    inset-block-end: 24px;
    display: flex;
    max-width: min(420px, calc(100vw - 32px));
    align-items: center;
    gap: 14px;
    padding: 11px 13px;
    color: #fff;
    background: rgba(17, 24, 39, .96);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 12px;
    box-shadow: 0 16px 44px rgba(15, 23, 42, .24);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .18s ease, transform .18s ease;
    direction: rtl;
    backdrop-filter: blur(10px);
}
.gk-next-undo-toast.is-visible { opacity: 1; transform: translateY(0); }
.gk-next-undo-toast__message {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.8;
}
.gk-next-undo-toast__button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 5px 10px;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
}
.gk-next-undo-toast__button:hover,
.gk-next-undo-toast__button:focus-visible {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .48);
    outline: 0;
}

@media (max-width: 700px) {
    .gk-next-undo-toast {
        inset-inline: 12px;
        inset-block-end: calc(var(--gk-bottom-nav-height, 0px) + 82px + env(safe-area-inset-bottom, 0px));
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gk-next-undo-toast { transition: none !important; }
}

.gk-next-panel__saved-qty {
    display: inline-flex;
    margin-top: 6px;
    color: var(--gk-neutral-500);
    font-size: 10px;
    font-weight: 700;
}
.gk-next-panel__row .product-price {
    display: grid;
    gap: 2px;
    justify-items: end;
}
.gk-next-panel__price-label {
    color: var(--gk-neutral-500);
    font-size: 9.5px;
    font-weight: 650;
}
@media (max-width: 700px) {
    .gk-next-panel__row .product-price { justify-items: start; }
}
