/* ==========================================================================
   Cart + Account right slide-in flyouts (PrestaShop-style).
   Self-contained, theme-independent: uses the admin --site-* tokens with safe
   fallbacks (same convention as the QuickView drawer). Loaded once per page by
   the <sys:flyouts/> tag handler.
   ========================================================================== */

/* --- Shared backdrop ------------------------------------------------------ */
.mv-fly-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s;
    z-index: 100000;
}
.mv-fly-backdrop.is-open { opacity: 1; visibility: visible; }

/* --- Drawer panels (right slide-in) --------------------------------------- */
.mv-fly-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 400px;
    max-width: 92vw;
    background: #fff;
    box-shadow: -6px 0 24px rgba(0, 0, 0, .18);
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.22, .61, .36, 1);
    z-index: 100001;
    display: flex;
    flex-direction: column;
    font-family: var(--site-font, Arial, Helvetica, sans-serif);
    color: var(--site-text, #1a1a1a);
}
.mv-fly-drawer.is-open { transform: translateX(0); }

.mv-fly-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--site-border, #e3e3e3);
}
.mv-fly-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--site-text, #1a1a1a);
    margin-right: auto;
}
.mv-fly-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--site-muted, #555);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.mv-fly-close:hover {
    background: var(--site-surface, #f3f3f3);
    color: var(--site-text, #1a1a1a);
}

.mv-fly-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* --- Loading / error ------------------------------------------------------ */
.mv-fly-loading,
.mv-fly-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    color: var(--site-muted, #888);
    font-size: 28px;
}
.mv-fly-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--site-border, #e0e0e0);
    border-top-color: var(--site-primary, #1d4ed8);
    border-radius: 50%;
    animation: mv-fly-spin .8s linear infinite;
}
@keyframes mv-fly-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Cart drawer body
   ========================================================================== */
.mv-cartfly-items {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 0;
}
.mv-cartfly-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 14px 30px 14px 18px;
    border-bottom: 1px solid var(--site-border, #eee);
}
/* Per-line AJAX remove X, top-right of each cart line (like the old cart popup). */
.mv-cartfly-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    line-height: 1;
    padding: 0;
    border: 1px solid var(--site-border, #e0e0e0);
    border-radius: 50%;
    background: #fff;
    color: #c0392b;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
    transition: background .15s, color .15s, border-color .15s;
    z-index: 2;
}
.mv-cartfly-remove:hover { background: #c0392b; color: #fff; border-color: #c0392b; }
.mv-cartfly-remove[disabled] { opacity: .5; cursor: default; }
.mv-cartfly-thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    display: block;
    border: 1px solid var(--site-border, #eee);
    border-radius: var(--site-radius, 6px);
    overflow: hidden;
    background: var(--site-surface, #f7f7f7);
}
.mv-cartfly-thumb img,
.mv-cartfly-thumb--ph {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.mv-cartfly-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.mv-cartfly-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--site-text, #1a1a1a);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mv-cartfly-name:hover { color: var(--site-primary, #1d4ed8); }
.mv-cartfly-sku {
    font-size: 11px;
    color: var(--site-muted, #999);
}
.mv-cartfly-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}
.mv-cartfly-qty {
    font-size: 12px;
    color: var(--site-muted, #666);
}
.mv-cartfly-meta {
    align-items: center;
}
.mv-cartfly-qtywrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--site-muted, #666);
}
.mv-cartfly-qtyinput {
    width: 46px;
    padding: 3px 4px;
    border: 1px solid var(--site-border, #cdd5df);
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    box-sizing: border-box;
}
.mv-cartfly-qtyinput:disabled {
    opacity: .55;
}
.mv-cartfly-coupon {
    padding: 0 0 10px;
    border-bottom: 1px solid var(--site-border, #e6e8eb);
    margin-bottom: 10px;
}
.mv-cartfly-couponform {
    display: flex;
    gap: 6px;
}
.mv-cartfly-couponinput {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid var(--site-border, #cdd5df);
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
}
.mv-cartfly-couponbtn {
    flex: 0 0 auto;
    padding: 7px 14px;
    border: 0;
    border-radius: 6px;
    background: var(--site-button-bg, #2c5aa0);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}
.mv-cartfly-couponrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}
.mv-cartfly-couponremove {
    border: 0;
    background: none;
    color: #c0392b;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
/* Canonical totals table injected via TotalsAsTable() */
.mv-cartfly-totals table {
    width: 100%;
    border-collapse: collapse;
}
.mv-cartfly-totals td {
    padding: 4px 0;
    font-size: 13px;
    color: var(--site-muted, #666);
    vertical-align: top;
}
.mv-cartfly-totals td:last-child {
    text-align: right;
    white-space: nowrap;
    color: var(--site-text, #1a1a1a);
    font-weight: 600;
}
.mv-cartfly-totals tr:last-child td {
    border-top: 1px solid var(--site-border, #e6e8eb);
    padding-top: 8px;
    font-size: 16px;
    font-weight: 700;
}
.mv-cartfly-line {
    font-size: 14px;
    font-weight: 700;
    color: var(--site-text, #1a1a1a);
    white-space: nowrap;
}

/* Footer: totals + actions (sticky at the bottom of the drawer) */
.mv-cartfly-foot {
    flex: 0 0 auto;
    border-top: 1px solid var(--site-border, #e3e3e3);
    padding: 14px 18px 18px;
    background: #fff;
}
.mv-cartfly-totals { margin-bottom: 12px; }
.mv-cartfly-totrow {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    color: var(--site-muted, #555);
    padding: 5px 0;
}
.mv-cartfly-totrow--grand {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--site-border, #eee);
    font-size: 20px;
    font-weight: 700;
    color: var(--site-text, #1a1a1a);
}
.mv-cartfly-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Empty state */
.mv-cartfly-empty {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 40px 24px;
    text-align: center;
    color: var(--site-muted, #888);
}
.mv-cartfly-empty svg { width: 56px; height: 56px; fill: var(--site-border, #d4d4d4); }
.mv-cartfly-empty p { margin: 0; font-size: 15px; }

/* --- Buttons (shared by cart + account) ----------------------------------- */
.mv-cartfly-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: var(--site-radius, 6px);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.mv-cartfly-btn svg { width: 16px; height: 16px; fill: currentColor; }
.mv-cartfly-btn--primary {
    background: var(--site-button-bg, #2c3e50);
    color: var(--site-button-text, #fff);
}
.mv-cartfly-btn--primary:hover { background: var(--site-button-hover, #2c5aa0); color: var(--site-button-hover-text, #fff); }
.mv-cartfly-btn--ghost {
    background: #fff;
    color: var(--site-text, #1a1a1a);
    border-color: var(--site-border, #d4d4d4);
}
.mv-cartfly-btn--ghost:hover {
    background: var(--site-surface, #f5f5f5);
    border-color: var(--site-muted, #b5b5b5);
}

/* ==========================================================================
   Account drawer body
   ========================================================================== */
.mv-account-drawer .mv-fly-body { padding: 18px; gap: 0; }

/* Signed-in: greeting + shortcut links */
.mv-acct-greeting {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--site-border, #eee);
    font-size: 16px;
    font-weight: 700;
}
.mv-acct-greeting svg { width: 28px; height: 28px; fill: var(--site-primary, #1d4ed8); }

.mv-acct-links {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}
.mv-acct-links li { margin: 0; }
.mv-acct-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--site-border, #f0f0f0);
    color: var(--site-text, #1a1a1a);
    text-decoration: none;
    font-size: 14px;
}
.mv-acct-links a:hover { color: var(--site-primary, #1d4ed8); }
.mv-acct-links svg { width: 20px; height: 20px; fill: var(--site-muted, #777); flex: 0 0 auto; }
.mv-acct-links a:hover svg { fill: var(--site-primary, #1d4ed8); }
.mv-acct-logout { margin-top: 6px; }

/* Signed-out: tabs + forms */
.mv-acct-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 18px;
    border-bottom: 2px solid var(--site-border, #eee);
}
.mv-acct-tab {
    flex: 1 1 0;
    padding: 12px 8px;
    border: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--site-muted, #888);
    cursor: pointer;
    margin-bottom: -2px;
    border-bottom: 2px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}
.mv-acct-tab.is-active {
    color: var(--site-primary, #1d4ed8);
    border-bottom-color: var(--site-primary, #1d4ed8);
}

.mv-acct-panel { display: none; }
.mv-acct-panel.is-active { display: block; }

.mv-acct-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.mv-acct-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.mv-acct-field > span {
    font-size: 12px;
    font-weight: 600;
    color: var(--site-muted, #666);
}
.mv-acct-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--site-border, #d4d4d4);
    border-radius: var(--site-radius, 6px);
    font-size: 14px;
    color: var(--site-text, #1a1a1a);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.mv-acct-input:focus {
    outline: 0;
    border-color: var(--site-primary, #1d4ed8);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
.mv-acct-submit { margin-top: 4px; }
.mv-acct-forgot {
    text-align: center;
    font-size: 13px;
    color: var(--site-muted, #777);
    text-decoration: none;
}
.mv-acct-forgot:hover { color: var(--site-primary, #1d4ed8); text-decoration: underline; }
