/* =====================================================
   YKB Clothing — Checkout
   Design language: streetwear / Gen Z drop.
   Tokens shared with cart.css & wishlist.css
   ----------------------------------------------------- */

:root {
    --teal:      #088178;
    --teal-dark: #066b63;
    --teal-tint: #e6f6f4;
    --ink:       #0e1414;
    --ink-70:    rgba(14,20,20,.68);
    --stone:     #9aa3a2;
    --line:      rgba(8,129,120,.22);
    --white:     #ffffff;
    --pop:       #ff5a4e;
    --pop-dark:  #d6473d;

    --font-display: "Space Grotesk", sans-serif;
    --font-body: "Inter", sans-serif;
    --font-mono: "Space Mono", monospace;

    --radius-lg: 20px;
    --radius-sm: 10px;
    --shadow-card: 0 16px 32px rgba(8,129,120,.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--teal-tint);
    font-family: var(--font-body);
    color: var(--ink);
}

/* ===== Top bar ===== */

.site-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 8%;
    background: var(--white);
    border-bottom: 1.5px solid var(--line);
}

.site-bar__mark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 1px;
    color: var(--teal);
    text-decoration: none;
}

.site-bar__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-70);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color .2s ease;
}

.site-bar__back:hover { color: var(--teal); }

/* ===== Layout ===== */

.checkout-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 8% 120px;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 60px;
    align-items: start;
}

.checkout-eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--teal-dark);
    background: var(--teal-tint);
    padding: 6px 14px;
    border-radius: 50px;
    margin-bottom: 14px;
}

.checkout-left h1 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -.5px;
    font-size: clamp(30px, 3.6vw, 42px);
    margin: 0 0 8px;
    color: var(--ink);
}

.checkout-sub {
    color: var(--ink-70);
    font-size: 15px;
    margin: 0 0 38px;
}

.saved-address-card{
    display:flex;
    gap:15px;
    margin:24px 0 28px;
    padding:18px;
    border:1px solid rgba(8,129,120,.2);
    border-radius:16px;
    background:#fff;
    box-shadow:0 12px 30px rgba(14,20,20,.045);
}

.saved-address-card[hidden]{ display:none; }
.saved-address-card__icon{ display:grid; place-items:center; flex:none; width:42px; height:42px; border-radius:13px; background:var(--teal-tint); color:var(--teal); }
.saved-address-card__content{ min-width:0; }
.saved-address-card__label{ display:block; margin-bottom:7px; color:var(--teal-dark); font:700 9px/1.4 var(--font-mono); letter-spacing:1.4px; text-transform:uppercase; }
.saved-address-card__content strong{ color:var(--ink); font-size:14px; }
.saved-address-card__content p{ margin:6px 0 11px; color:var(--ink-70); font-size:13px; line-height:1.6; overflow-wrap:anywhere; }
.saved-address-card__content a{ color:var(--teal-dark); font-size:12px; font-weight:700; text-decoration:none; }
.saved-address-card__content a:hover{ color:var(--teal); }

/* ===== Form fields (floating label) ===== */

#checkout-form { display: flex; flex-direction: column; gap: 20px; }

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.field {
    position: relative;
}

.field input {
    width: 100%;
    padding: 20px 16px 8px;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--ink);
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .2s ease;
}

.field label {
    position: absolute;
    left: 16px;
    top: 18px;
    font-size: 15px;
    color: var(--stone);
    pointer-events: none;
    transform-origin: left top;
    transition: transform .16s ease, color .16s ease, top .16s ease;
}

.field input:focus {
    border-color: var(--teal);
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label {
    top: 8px;
    transform: scale(.74);
    color: var(--teal-dark);
}

.field input.has-error {
    border-color: var(--pop);
}

.field-error {
    display: block;
    min-height: 16px;
    font-size: 12px;
    color: var(--pop-dark);
    margin-top: 5px;
    font-weight: 600;
}

/* ===== Payment method ===== */

.section-label {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    margin: 14px 0 4px;
    color: var(--ink);
}

.payment-method {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pay-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}

.pay-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pay-option__icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--teal-tint);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.pay-option__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.35;
}

.pay-option__text strong { font-size: 14.5px; color: var(--ink); }
.pay-option__text small { color: var(--stone); font-size: 12.5px; }

.pay-option__check {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: transparent;
    transition: all .2s ease;
    flex-shrink: 0;
}

.pay-option:has(input:checked) {
    border-color: var(--teal);
    background: var(--teal-tint);
}

.pay-option:has(input:checked) .pay-option__check {
    background: var(--teal);
    border-color: var(--teal);
    color: var(--white);
}

/* ===== Order ticket ===== */

.checkout-right { position: sticky; top: 30px; }

.ticket {
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 28px 26px 26px;
}

.ticket__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 18px;
}

.ticket__eyebrow {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    color: var(--ink);
}

.ticket__count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--teal-dark);
    background: var(--teal-tint);
    padding: 3px 10px;
    border-radius: 50px;
}

.ticket__items {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.order-item {
    display: grid;
    grid-template-columns: 54px 1fr auto;
    gap: 12px;
    align-items: center;
}

.order-item__img {
    width: 54px;
    height: 54px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--teal-tint);
    border: 1.5px solid var(--line);
    flex-shrink: 0;
}

.order-item__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.order-item__info h4 {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ink);
}

.order-item__info span {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--stone);
}

.order-item__price {
    font-family: var(--font-mono);
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--ink);
}

.ticket__empty {
    text-align: center;
    padding: 30px 10px;
    color: var(--ink-70);
    font-size: 14px;
}

.ticket__empty a {
    display: inline-block;
    margin-top: 12px;
    color: var(--teal);
    font-weight: 700;
    text-decoration: none;
}

/* Perforated tear line */

.ticket__perf {
    position: relative;
    height: 0;
    margin: 22px -26px;
    border-top: 1.5px dashed var(--line);
}

.ticket__perf::before,
.ticket__perf::after {
    content: "";
    position: absolute;
    top: -9px;
    width: 18px;
    height: 18px;
    background: var(--teal-tint);
    border-radius: 50%;
}

.ticket__perf::before { left: -9px; }
.ticket__perf::after { right: -9px; }

.ticket__totals {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 22px;
}

.ticket__row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--ink-70);
}

.ticket__row--total {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    padding-top: 8px;
    border-top: 1.5px solid var(--line);
}

.place-order-btn {
    width: 100%;
    border: none;
    background: var(--ink);
    color: var(--white);
    padding: 17px;
    border-radius: 50px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: .5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease;
}

.place-order-btn:hover:not(:disabled) {
    background: var(--teal);
    transform: translateY(-3px);
    box-shadow: 0 14px 26px rgba(8,129,120,.32);
}

.place-order-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: var(--white);
    border-radius: 50%;
}

.place-order-btn.is-loading .btn-label { opacity: .7; }
.place-order-btn.is-loading .btn-spinner {
    display: inline-block;
    animation: spin .7s linear infinite;
}

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

.ticket__note {
    text-align: center;
    font-size: 12px;
    color: var(--stone);
    margin: 14px 0 0;
}

/* ===== Toasts (shared pattern) ===== */

.toast-stack {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
}

.toast {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: var(--white);
    box-shadow: 0 14px 30px rgba(0,0,0,.22);
    animation: toastIn .25s ease;
    max-width: 320px;
}

.toast.toast--success { background: var(--teal-dark); }
.toast.toast--error { background: var(--pop-dark); }

.toast.is-leaving { animation: toastOut .25s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(12px); }
}

/* ===== Mobile ===== */

@media (max-width: 900px) {
    .checkout-container {
        grid-template-columns: 1fr;
        padding: 40px 6% 90px;
        gap: 40px;
    }

    .checkout-right { position: static; order: -1; }

    .row { grid-template-columns: 1fr; }

    .toast-stack { left: 16px; right: 16px; bottom: 16px; }
    .toast { max-width: none; }
}
