/**
 * Advanced WooCommerce Checkout Funnel - Frontend Styles
 * Exact Clone of mugitcg.shop/cart/
 */

:root {
    --bg: #09080A;
    --surface: #141210;
    --ink: #F4ECD8;
    --muted: #A99D80;
    --line: #3A3122;
    --accent: #D4AF37;
    --accent-ink: #0B0A08;
    --gold: #E9CB6B;
    --ok: #F2D46E;
    --wa: #14803F;
    --bad: #E5534B;
    --chat: #0B141A;
    --bubble: #005C4B;
    --bubble-ink: #E9EDEF;
    --display: "Dela Gothic One", "Zen Kaku Gothic New", system-ui, sans-serif;
    --body: "Zen Kaku Gothic New", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
    --mugi-max-width: 640px;
    --mugi-radius: 12px;
}

/* Wrapper */
.mugi-checkout-wrap {
    max-width: var(--mugi-max-width);
    margin: 0 auto;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-block: 28px 80px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    color: var(--ink);
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.55;
    box-sizing: border-box;
}

.mugi-checkout-wrap * {
    box-sizing: border-box;
}

/* Main Checkout Container */
.mugi-checkout-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: var(--mugi-radius);
    padding: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.mugi-checkout-box h2 {
    margin: 0;
    font-family: var(--display);
    font-weight: 400;
    font-size: 1.25rem;
    color: var(--ink);
    letter-spacing: -0.02em;
}

/* Blocks */
.block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.step {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
    display: block;
}

.fine {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.4;
    margin: 0;
}

/* Labels and Inputs */
label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--muted);
}

input, select, textarea {
    font: inherit;
    font-size: 0.95rem;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-color: var(--accent);
}

input.bad, textarea.bad {
    border-color: var(--bad);
}

textarea {
    min-height: 64px;
    resize: vertical;
}

.grid2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

/* Agreement checkbox */
.agree {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    color: var(--ink);
    font-size: 0.88rem;
    cursor: pointer;
    margin-top: 4px;
}

.agree input {
    width: auto;
    margin-top: 3px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Shipping Options (.opts) */
.opts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.opts label, .pay-opts label {
    flex: 1 1 90px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
    background: var(--bg);
    font-size: 0.85rem;
    transition: all 0.2s ease;
    user-select: none;
}

.opts label:hover, .pay-opts label:hover {
    border-color: var(--muted);
}

.opts label:has(input:checked), .pay-opts label:has(input:checked),
.opts label.is-selected, .pay-opts label.is-selected {
    border-color: var(--accent);
    background: rgba(212, 175, 55, 0.08);
}

.opts input, .pay-opts input {
    width: auto;
    accent-color: var(--accent);
}

/* Payment Groups & Details */
.official {
    color: var(--gold);
    font-size: 0.85rem;
    margin: 0;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 8px;
    padding: 8px 12px;
}

.official b {
    color: var(--ink);
}

.paygroups {
    display: grid;
    gap: 14px;
}

.paygroup {
    display: grid;
    gap: 8px;
}

.paygh {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 6px;
}

.pay-opts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.pay-opts label {
    justify-content: flex-start;
}

.pay-box {
    border: 1px dashed var(--accent);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(11, 10, 8, 0.6);
}

.pay-box:empty {
    display: none;
}

.kv {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.kv .k {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.kv .row {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.kv code {
    flex: 1;
    min-width: 0;
    font-family: var(--mono);
    font-size: 0.85rem;
    overflow-wrap: anywhere;
    user-select: all;
    color: var(--gold);
    background: var(--bg);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--line);
}

.mini {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    border-radius: 6px;
    padding: 4px 8px;
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.mini:hover {
    border-color: var(--accent);
    color: var(--gold);
}

.paysend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.substep {
    font-weight: 700;
    color: var(--ink);
}

.cryptonote {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
}

/* Cart Items & Summary */
.cart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.empty-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 24px 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.empty-card b {
    font-size: 1.1rem;
    color: var(--ink);
}

.empty-card span {
    font-size: 0.88rem;
    color: var(--muted);
}

.cline {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
}

.cthumb {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.cthumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cthumb span {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 700;
}

.cinfo {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.cname {
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.3;
}

.cname:hover {
    color: var(--gold);
}

.csub {
    font-size: 0.78rem;
    color: var(--muted);
}

.cunit {
    font-size: 0.82rem;
    color: var(--muted);
}

.cunit s {
    color: var(--bad);
    margin-left: 4px;
}

.cact {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

.ctrl {
    display: flex;
    align-items: center;
    border: 1px solid var(--accent);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg);
}

.ctrl button {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--gold);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ctrl button:hover:not(:disabled) {
    background: rgba(212, 175, 55, 0.15);
}

.ctrl button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.ctrl output {
    min-width: 28px;
    text-align: center;
    font-family: var(--mono);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.cremove {
    color: var(--muted);
}

.cremove:hover {
    color: var(--bad);
    border-color: var(--bad);
}

.cline-total {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--ink);
    font-size: 0.95rem;
    padding-top: 2px;
}

/* Totals */
.ctotals {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-variant-numeric: tabular-nums;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.92rem;
    color: var(--muted);
}

.line span:last-child {
    font-family: var(--mono);
    white-space: nowrap;
    color: var(--ink);
}

.csave {
    color: var(--ok);
}

.csave span:last-child {
    color: var(--ok);
    font-weight: 700;
}

.total {
    border-top: 1px solid var(--line);
    padding-top: 8px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink);
}

.total span:last-child {
    font-size: 1.15rem;
    color: var(--gold);
}

.mugi-coupon-row {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.mugi-coupon-row input {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.85rem;
}

.more {
    color: var(--gold);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 6px;
    display: inline-block;
}

.more:hover {
    text-decoration: underline;
}

/* Step 4 & Actions */
.pv-msg {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.88rem;
}

.pv-msg summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--gold);
}

.chat {
    margin-top: 10px;
    padding: 10px;
    background: var(--chat);
    border-radius: 8px;
}

.bubble {
    background: var(--bubble);
    color: var(--bubble-ink);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: pre-wrap;
    font-family: var(--body);
}

.warn {
    font-size: 0.85rem;
    color: var(--bad);
    margin: 0;
    min-height: 1.2em;
    font-weight: 600;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rv-line {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px 6px;
    text-decoration: none;
    color: var(--gold);
    font-size: 0.86rem;
    font-weight: 700;
    padding: 4px 0;
}

.stars {
    letter-spacing: 1px;
    margin-right: 6px;
    background: linear-gradient(100deg, #FFC93C 0%, #FFC93C 38%, #fff6cf 48%, #ffffff 50%, #fff6cf 52%, #FFC93C 62%, #FFC93C 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
    -webkit-text-fill-color: transparent;
    animation: starShine 3.2s ease-in-out infinite;
}

@keyframes starShine {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 10px;
    padding: 13px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
}

.btn[aria-disabled="true"], .btn:disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

.btn-gold {
    background: linear-gradient(180deg, var(--gold), var(--accent));
    color: var(--accent-ink);
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
}

.btn-gold:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(212, 175, 55, 0.45);
}

.btn-place {
    font-size: 1.05rem;
    padding: 15px 18px;
    width: 100%;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--gold);
}

.btn-wa {
    background: var(--wa);
    color: #fff;
}

.btn-wa:hover {
    filter: brightness(1.1);
}

/* Order Success Modal (.odone) */
.odone {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(5, 4, 6, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.od-card {
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 18px;
    padding: 28px 24px;
    max-width: 440px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
    align-items: stretch;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8);
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.od-tick {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ok);
    color: var(--accent-ink);
    font-size: 28px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.od-card h2 {
    margin: 0;
    font-family: var(--display);
    font-weight: 400;
    font-size: 1.6rem;
    color: var(--ink);
}

.od-ref {
    font-size: 0.95rem;
    color: var(--muted);
    margin: 0;
}

.od-ref b {
    color: var(--gold);
    font-family: var(--mono);
}

.od-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.od-card .mini {
    align-self: center;
    margin-top: 4px;
}

/* Multi-Step Wizard Mode */
.mugi-wizard-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mugi-wizard-progress {
    height: 4px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
}

.mugi-wizard-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--accent));
    transition: width 0.3s ease;
}

.mugi-wizard-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.mugi-wizard-step {
    background: transparent;
    border: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px;
}

.mugi-wizard-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mugi-wizard-title {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 700;
    transition: color 0.2s ease;
}

.mugi-wizard-step.active .mugi-wizard-badge {
    border-color: var(--accent);
    color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
}

.mugi-wizard-step.active .mugi-wizard-title {
    color: var(--gold);
}

.mugi-wizard-step.completed .mugi-wizard-badge {
    background: var(--ok);
    border-color: var(--ok);
    color: var(--accent-ink);
}

/* Wizard Steps Visibility */
.mugi-checkout-wrap[data-mode="wizard"] .mugi-step-block:not(.active-step) {
    display: none;
}

.mugi-step-nav {
    display: flex;
    margin-top: 12px;
}

.mugi-split-nav {
    justify-content: space-between;
    gap: 12px;
}

.mugi-step-back-row {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
}

/* Responsive Styles */
@media (max-width: 420px) {
    .grid2 {
        grid-template-columns: 1fr;
    }

    .cline {
        grid-template-columns: 60px minmax(0, 1fr);
    }

    .cthumb {
        width: 60px;
        height: 60px;
    }

    .cline-total {
        grid-column: 2;
    }

    .pay-opts {
        grid-template-columns: 1fr;
    }

    .mugi-wizard-title {
        display: none;
    }
}
