/* 1. Stepper */
.checkout-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 auto 32px auto;
    max-width: 500px;
    padding: 0 16px;
    position: relative;
    z-index: 10;
}

.cs-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    transition: color 0.3s ease;
}

.cs-step.active {
    color: var(--ink);
}

.cs-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
}

.cs-step.active .cs-circle {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.cs-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cs-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 16px;
    transform: translateY(-10px);
    position: relative;
    overflow: hidden;
}

.cs-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--ink);
    transition: width 0.3s ease;
}

.cs-step.active + .cs-line::after {
    width: 100%;
}

/* 2. Items & Qty Stepper */
.qty-stepper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    width: max-content;
    margin-top: 8px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--ink);
    border-radius: 4px;
    transition: background 0.2s;
}

.qty-btn:hover {
    background: rgba(0,0,0,0.05);
}

.qty-val {
    font-size: 14px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

.cart-item-unit-price {
    font-size: 13px;
    color: var(--muted);
}
.cart-item-subtotal {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    margin-top: 2px;
}

@keyframes slideOutRight {
    to { transform: translateX(100%); opacity: 0; }
}
@keyframes collapseHeight {
    to { height: 0; padding: 0; margin: 0; border: none; }
}

.empty-cart-view {
    text-align: center;
    padding: 48px 16px;
}
.empty-cart-icon {
    width: 48px;
    height: 48px;
    color: var(--muted);
    margin-bottom: 16px;
}
.empty-cart-view h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}
.empty-cart-view p {
    color: var(--muted);
    margin-bottom: 24px;
}
.empty-cart-rec {
    margin-top: 48px;
    text-align: left;
}
.empty-cart-rec h4 {
    margin-bottom: 16px;
    font-size: 1.2rem;
}

/* 3. Form Float Labels */
.float-label {
    position: relative;
    padding-top: 16px;
}

.float-label label {
    position: absolute;
    top: 28px;
    left: 16px;
    font-size: 14px;
    color: var(--muted);
    pointer-events: none;
    transition: all 0.2s ease;
    background: transparent;
    padding: 0 4px;
}

.float-label input,
.float-label select,
.float-label textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-size: 15px;
    color: var(--ink);
    transition: border-color 0.2s;
}

.float-label input:focus,
.float-label select:focus,
.float-label textarea:focus {
    border-color: var(--ink);
    outline: none;
}

/* Float label logic */
.float-label input:focus ~ label,
.float-label input:not(:placeholder-shown) ~ label,
.float-label textarea:focus ~ label,
.float-label textarea:not(:placeholder-shown) ~ label,
.float-label select:focus ~ label,
.float-label select:valid ~ label,
.float-label select:not([value=""]) ~ label {
    top: 8px;
    left: 12px;
    font-size: 11px;
    background: var(--bg);
    color: var(--ink);
}

.float-label select ~ label {
    top: 8px;
    left: 12px;
    font-size: 11px;
    background: var(--bg);
}

.field-error-msg {
    color: var(--error);
    font-size: 12px;
    margin-top: 4px;
    min-height: 16px;
}

.form-group.has-error input {
    border-color: var(--error);
}

/* 4. Hover Border Gradient */
.hbg-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 2px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: transparent;
    margin-bottom: 12px;
}

.hbg-btn::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: conic-gradient(from 0deg, transparent 0 340deg, var(--hbg-color) 360deg);
    animation: hbg-spin 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

.hbg-btn:hover::before, .hbg-btn:focus-within::before {
    opacity: 1;
}

@keyframes hbg-spin {
    to { transform: rotate(360deg); }
}

.hbg-mp { --hbg-color: #009EE3; }
.hbg-stripe { --hbg-color: var(--ink); }

.hbg-btn > button {
    position: relative;
    z-index: 1;
    margin: 0 !important;
    border: none;
    border-radius: calc(var(--radius-md) - 2px);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: var(--bg);
    color: var(--ink);
    transition: background 0.3s;
}

.hbg-mp > button {
    background: #009EE3;
    color: #fff;
}
.hbg-mp:hover > button {
    background: #0087C1;
}

.hbg-stripe > button {
    background: var(--ink);
    color: var(--bg);
}
.hbg-stripe:hover > button {
    background: #000;
}

.btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}

.hbg-sub {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 4px;
}

/* 5. Multi Step Loader */
.msl-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.msl-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.msl-container {
    position: relative;
    height: 24rem; /* 384px */
    width: 100%;
    max-width: 32rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 10rem;
    overflow: hidden;
}

.msl-step {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 1.125rem;
    transition: all 0.5s ease;
    padding-left: 2rem;
}

.msl-icon {
    width: 24px;
    height: 24px;
    position: relative;
}

.msl-check, .msl-filled {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s;
}

.msl-check { opacity: 1; color: var(--ink); }
.msl-filled { opacity: 0; color: #10B981; }

.msl-step.completed .msl-check { opacity: 0; }
.msl-step.completed .msl-filled { opacity: 1; }
.msl-step.completed span { color: var(--ink); }

.msl-step.active .msl-check { opacity: 0; }
.msl-step.active .msl-filled { opacity: 1; }
.msl-step.active span { color: #10B981; }

.msl-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
    mask-image: radial-gradient(900px at center, transparent 30%, white);
    -webkit-mask-image: radial-gradient(900px at center, transparent 30%, white);
    z-index: 20;
    pointer-events: none;
}

/* 6. Confetti & Result */
.confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}
.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

/* 7. Mobile */
@media (max-width: 768px) {
    #page-cart {
        overflow-x: hidden;
    }
    .checkout-stepper {
        padding: 0 8px;
    }
    .cs-circle {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    .cs-label {
        font-size: 10px;
    }
    .cs-line {
        margin: 0 8px;
    }
    
    .cart-layout {
        display: flex;
        flex-direction: column;
    }
    
    .cart-summary {
        order: 2; /* below items */
        margin-top: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hbg-btn::before {
        animation: none;
        opacity: 0;
    }
    .msl-step {
        transition: none;
    }
    .confetti-canvas {
        display: none !important;
    }
    .shake {
        animation: none;
    }
}

.lock-icon { width: 16px; height: 16px; }
.minus { cursor: pointer; }
.plus { cursor: pointer; }

.success-check { width: 64px; height: 64px; }
.success-check circle, .success-check path { stroke-dasharray: 100; stroke-dashoffset: 100; animation: drawCheck 1s ease-in-out forwards; }
.success-check path { animation-delay: 0.3s; }
@keyframes drawCheck { to { stroke-dashoffset: 0; } }
