/**
 * ModKor Ajax Cart — storefront styles.
 * @copyright Copyright (c) 2026 ModKor — Proprietary.
 *
 * Self-contained (no Tailwind dependency). Colours come from CSS variables the engine sets when a
 * custom palette is configured; otherwise the var() fallbacks apply and dark mode is honoured via
 * prefers-color-scheme + a forced [data-mkac-scheme] override. Animations use transform/opacity only.
 */

.mkac-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    padding: 4vh 4vw;
    background: rgba(2, 6, 23, .5);
    z-index: 90;
    opacity: 0;
    transition: opacity .18s ease;
}
.mkac-overlay[data-show="true"] { opacity: 1; }
.mkac-overlay.mkac-top { align-items: flex-start; }
.mkac-overlay.mkac-middle { align-items: center; }
.mkac-overlay.mkac-left { justify-content: flex-start; }
.mkac-overlay.mkac-center { justify-content: center; }
.mkac-overlay.mkac-right { justify-content: flex-end; }

.mkac-panel {
    --_bg: var(--mkac-bg, #ffffff);
    --_text: var(--mkac-text, #1b2733);
    --_name: var(--mkac-name, #111827);
    --_btntext: var(--mkac-btn-text, #ffffff);
    --_continue: var(--mkac-continue, #111827);
    --_checkout: var(--mkac-checkout, #0ea5e9);
    background: var(--_bg);
    color: var(--_text);
    width: 100%;
    max-width: 30rem;
    max-height: 92vh;
    overflow: auto;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(2, 6, 23, .3);
    padding: 20px;
    transform: translateY(8px) scale(.98);
    transition: transform .2s ease;
}
.mkac-overlay[data-show="true"] .mkac-panel { transform: none; }

@media (prefers-color-scheme: dark) {
    .mkac-panel {
        --_bg: var(--mkac-bg, #1b2430);
        --_text: var(--mkac-text, #e5eaf0);
        --_name: var(--mkac-name, #f8fafc);
    }
}
:root[data-mkac-scheme="dark"] .mkac-panel {
    --_bg: var(--mkac-bg, #1b2430);
    --_text: var(--mkac-text, #e5eaf0);
    --_name: var(--mkac-name, #f8fafc);
}
:root[data-mkac-scheme="light"] .mkac-panel {
    --_bg: var(--mkac-bg, #ffffff);
    --_text: var(--mkac-text, #1b2733);
    --_name: var(--mkac-name, #111827);
}

.mkac-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mkac-title { font-size: 1.15rem; font-weight: 800; color: var(--_name); margin: 0; line-height: 1.25; }
.mkac-close { background: none; border: 0; cursor: pointer; font-size: 1.4rem; line-height: 1; color: var(--_text); opacity: .6; padding: 2px 6px; }
.mkac-close:hover { opacity: 1; }
.mkac-timer { font-size: .78rem; opacity: .7; margin-top: 3px; }

.mkac-line { display: flex; gap: 12px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid rgba(127, 127, 127, .2); }
.mkac-thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; background: rgba(127, 127, 127, .12); }
.mkac-pname { font-weight: 700; color: var(--_name); }
.mkac-meta { font-size: .85rem; opacity: .85; margin-top: 2px; }
.mkac-summary { display: flex; justify-content: space-between; font-size: .9rem; margin-top: 12px; }
.mkac-summary strong { color: var(--_name); }

.mkac-actions { display: flex; gap: 10px; margin-top: 16px; }
.mkac-btn { flex: 1; text-align: center; border: 0; border-radius: 9px; padding: 11px 12px; font-weight: 800; font-size: .92rem; cursor: pointer; color: var(--_btntext); text-decoration: none; }
.mkac-btn--continue { background: var(--_continue); }
.mkac-btn--checkout { background: var(--_checkout); }
.mkac-btn:hover { filter: brightness(1.06); }

/* related / cross-sell horizontal scroller */
.mkac-selling { margin-top: 16px; }
.mkac-selling__title { font-weight: 800; color: var(--_name); font-size: .95rem; }
.mkac-selling__subtitle { font-size: .82rem; opacity: .8; margin-bottom: 8px; }
.mkac-rail { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.mkac-rail::-webkit-scrollbar { height: 6px; }
.mkac-rail::-webkit-scrollbar-thumb { background: rgba(127, 127, 127, .35); border-radius: 6px; }
.mkac-tile { scroll-snap-align: start; flex: 0 0 128px; text-decoration: none; color: inherit; }
.mkac-tile img { width: 128px; height: 128px; object-fit: cover; border-radius: 8px; background: rgba(127, 127, 127, .12); }
.mkac-tile__name { font-size: .8rem; font-weight: 600; margin-top: 6px; color: var(--_text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mkac-tile__price { font-size: .82rem; font-weight: 800; color: var(--_name); }
.mkac-tile__add { display: inline-block; margin-top: 4px; font-size: .74rem; font-weight: 800; color: var(--_checkout); background: none; border: 0; padding: 0; cursor: pointer; }

/* options dialog reuses the panel; give the injected form room */
.mkac-dialog-body { margin-top: 4px; }
.mkac-dialog-body img { max-width: 100%; height: auto; }
.mkac-loading { padding: 30px 0; text-align: center; opacity: .7; }

/* fly-to-cart ghost */
.mkac-fly {
    position: fixed;
    z-index: 120;
    pointer-events: none;
    border-radius: 8px;
    object-fit: cover;
    transition: transform .7s cubic-bezier(.2, .7, .3, 1), opacity .7s ease;
    will-change: transform, opacity;
}
/* guaranteed-visible fallback badge when a card has no usable image/icon */
.mkac-fly--badge {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mkac-checkout, #0ea5e9);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(2, 6, 23, .3);
}

/* "already in cart" badge */
.mkac-qty-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    background: #111827;
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 999px;
    pointer-events: none;
}

/* free-shipping progress meter */
.mkac-meter { margin-top: 14px; }
.mkac-meter__label { font-size: .82rem; font-weight: 700; margin-bottom: 6px; color: var(--_name, #111827); }
.mkac-meter__track { height: 8px; border-radius: 999px; background: rgba(127, 127, 127, .2); overflow: hidden; }
.mkac-meter__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #14ffaf, #0ea5e9); transition: width .5s cubic-bezier(.2, .7, .3, 1); }
.mkac-meter__fill--done { background: #16a34a; }

/* scarcity + reserve */
.mkac-scarcity { margin-top: 10px; font-size: .82rem; font-weight: 800; color: #b45309; }
.mkac-reserve { display: flex; align-items: center; gap: 6px; font-size: .78rem; opacity: .85; margin-top: 3px; }
.mkac-reserve__dot { width: 7px; height: 7px; border-radius: 999px; background: #ef4444; animation: mkac-pulse 1.2s infinite; }
@keyframes mkac-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* behavioral button emphasis */
.mkac-btn--emph { box-shadow: 0 0 0 3px rgba(14, 165, 233, .35); transform: translateY(-1px); }
.mkac-btn--muted { opacity: .78; }

/* sub-actions row (view cart + undo) */
.mkac-subactions { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 10px; }
.mkac-link { font-size: .82rem; text-decoration: underline; opacity: .85; }
.mkac-undo-link { background: none; border: 0; cursor: pointer; font-size: .82rem; font-weight: 800; color: #ef4444; text-decoration: underline; padding: 0; }

/* "Add all" button on the selling block */
.mkac-addall { margin: 6px 0 10px; }
.mkac-addall__btn { width: 100%; border: 1px dashed var(--_checkout, #0ea5e9); background: none; color: var(--_checkout, #0ea5e9); border-radius: 9px; padding: 8px; font-weight: 800; font-size: .84rem; cursor: pointer; }
.mkac-addall__btn:hover { background: rgba(14, 165, 233, .08); }

/* corner snackbar + undo */
.mkac-snack { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); z-index: 130; display: flex; align-items: center; gap: 14px; background: #0b1220; color: #e5eaf0; padding: 12px 18px; border-radius: 12px; box-shadow: 0 12px 30px rgba(2, 6, 23, .3); font-size: .88rem; font-weight: 600; opacity: 0; transition: transform .22s ease, opacity .22s ease; max-width: calc(100vw - 32px); }
.mkac-snack[data-show="true"] { transform: translate(-50%, 0); opacity: 1; }
.mkac-snack--error { background: #7f1d1d; }
.mkac-snack__action { background: none; border: 0; color: #14ffaf; font-weight: 800; cursor: pointer; text-transform: uppercase; letter-spacing: .04em; font-size: .8rem; }

/* inline qty stepper (button morph) — a self-contained filled pill so the −/+/number stay readable on
   ANY theme (the old currentColor inherited a near-invisible colour on dark storefronts). */
.mkac-stepper { display: inline-flex; align-items: stretch; border-radius: 10px; overflow: hidden; vertical-align: middle; background: var(--mkac-continue, #111827); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.mkac-stepper__btn { width: 42px; min-height: 42px; border: 0; background: none; font-size: 1.35rem; font-weight: 800; cursor: pointer; color: var(--mkac-btn-text, #ffffff); line-height: 1; display: flex; align-items: center; justify-content: center; }
.mkac-stepper__btn:hover { background: rgba(255, 255, 255, .16); }
.mkac-stepper__val { min-width: 42px; padding: 0 6px; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 800; font-size: 1rem; color: var(--mkac-btn-text, #ffffff); background: rgba(0, 0, 0, .22); }

/* recently-added filmstrip */
.mkac-recent { position: fixed; left: 16px; bottom: 16px; z-index: 110; display: flex; gap: 8px; }
.mkac-recent__item { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; box-shadow: 0 6px 16px rgba(2, 6, 23, .25); background: #fff; opacity: 0; transform: translateY(10px) scale(.8); transition: opacity .25s ease, transform .25s ease; }
.mkac-recent__item[data-show="true"] { opacity: 1; transform: none; }

/* cart-icon bounce on fly landing */
.mkac-bounce { animation: mkac-bounce .55s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes mkac-bounce { 0%, 100% { transform: none; } 30% { transform: scale(1.25); } 55% { transform: scale(.92); } }

/* mobile bottom-sheet (opt-in) */
@media (max-width: 640px) {
    body.mkac-sheet .mkac-overlay { align-items: flex-end; padding: 0; }
    body.mkac-sheet .mkac-panel { max-width: 100%; width: 100%; max-height: 88vh; border-radius: 18px 18px 0 0; transform: translateY(100%); }
    body.mkac-sheet .mkac-overlay[data-show="true"] .mkac-panel { transform: none; }
}

/* cart page / minicart AJAX busy state — dim the content and show a top progress bar */
body.mkac-busy #maincontent { opacity: .55; pointer-events: none; transition: opacity .15s ease; }
body.mkac-busy::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 200;
    background: linear-gradient(90deg, #14ffaf, #0ea5e9);
    animation: mkac-progress 1s ease-in-out infinite;
}
@keyframes mkac-progress { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

[x-cloak] { display: none !important; }
