/* Checkout page (#/checkout). All classes are prefixed with .chk- */

/* ---------------- layout ---------------- */

.chk-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 28px;
    align-items: start;
    padding-bottom: 56px;
}

.chk-main { min-width: 0; }

/* ---------------- step cards ---------------- */

.chk-card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-xl);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.chk-card + .chk-card { margin-top: 18px; }

.chk-card__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.chk-step {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gold-grad);
    color: #221803;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: var(--shadow-gold);
}

.chk-card__title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
}

/* ---------------- fields ---------------- */

.chk-fields {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

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

.chk-field--ro { cursor: default; }
.chk-field--ro .field__input { color: var(--text-2); }
.chk-field--ro:focus-within {
    border-color: var(--hairline-strong);
    box-shadow: none;
}
.chk-field--ro:focus-within .field__label { color: var(--text-2); }

.chk-field--select { cursor: pointer; }
.chk-select-chev { color: var(--text-3); pointer-events: none; }
.chk-select-chev svg {
    width: 16px;
    height: 16px;
    transform: rotate(90deg);
    transition: transform 0.25s var(--ease-out);
}
.chk-field--select:focus-within .chk-select-chev { color: var(--gold); }

/* ---------------- delivery: date pills ---------------- */

.chk-days {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    scrollbar-width: thin;
}

.chk-day {
    flex: 0 0 auto;
    min-width: 74px;
    padding: 10px 12px 9px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: var(--surface);
    border: 1.5px solid var(--hairline-strong);
    border-radius: var(--r-md);
    cursor: pointer;
    color: var(--text);
    transition: border-color 0.22s ease, background 0.22s ease, transform 0.3s var(--ease-spring), box-shadow 0.22s ease;
}

.chk-day:not(:disabled):not(.is-active):hover {
    border-color: var(--gold);
    transform: translateY(-2px);
}

.chk-day:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.chk-day.is-active {
    background: var(--gold-grad);
    border-color: transparent;
    box-shadow: var(--shadow-gold);
    transform: translateY(-2px);
}

.chk-day__dow {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-3);
}

.chk-day__num {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.15;
}

.chk-day__mon {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
}

.chk-day.is-active .chk-day__dow,
.chk-day.is-active .chk-day__num,
.chk-day.is-active .chk-day__mon {
    color: #221803;
}

/* ---------------- delivery: slot chips ---------------- */

.chk-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.chk-slot {
    height: 38px;
    padding-inline: 16px;
    font-variant-numeric: tabular-nums;
}

.chk-note {
    font-size: 13.5px;
    color: var(--text-3);
    padding-block: 6px;
}

/* ---------------- promo ---------------- */

.chk-promo {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.chk-promo__field { flex: 1; }

.chk-promo .btn { flex-shrink: 0; }

.chk-coupon {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px solid var(--success);
    border-radius: var(--r-md);
    background: color-mix(in srgb, var(--success) 10%, transparent);
    animation: chk-pop 0.45s var(--ease-spring);
}

.chk-coupon__icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    flex-shrink: 0;
}
.chk-coupon__icon svg { width: 16px; height: 16px; }

.chk-coupon__info { flex: 1; min-width: 0; }

.chk-coupon__code {
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 14px;
}

.chk-coupon__sub {
    font-size: 12.5px;
    color: var(--success);
    font-weight: 700;
    margin-top: 1px;
}

.chk-coupon__rm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--text-3);
    background: transparent;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s var(--ease-spring);
}
.chk-coupon__rm:hover {
    color: var(--danger);
    background: var(--surface);
    transform: scale(1.08);
}
.chk-coupon__rm svg { width: 15px; height: 15px; }

@keyframes chk-pop {
    from { transform: scale(0.94); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ---------------- payment ---------------- */

.chk-pays {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.chk-pay {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 14px 15px;
    text-align: left;
    background: var(--surface);
    border: 1.5px solid var(--hairline-strong);
    border-radius: var(--r-lg);
    cursor: pointer;
    color: var(--text);
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.3s var(--ease-spring);
}

.chk-pay:not(.is-disabled):not(.is-active):hover {
    border-color: var(--gold);
    transform: translateY(-2px);
}

.chk-pay.is-active {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(241, 164, 36, 0.14);
}

.chk-pay.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.chk-pay__dot {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border-radius: 50%;
    border: 2px solid var(--hairline-strong);
    flex-shrink: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chk-pay.is-active .chk-pay__dot {
    border-color: var(--gold);
    box-shadow: inset 0 0 0 4px var(--gold);
}

.chk-pay__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.chk-pay__name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14.5px;
    font-weight: 800;
}

.chk-pay__sub {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 600;
}

.chk-pay__soon {
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--hairline);
    white-space: nowrap;
}

/* ---------------- summary ---------------- */

.chk-summary {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-xl);
    padding: 22px;
    box-shadow: var(--shadow-card);
}

.chk-summary__title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.chk-items {
    display: flex;
    flex-direction: column;
    gap: 13px;
    max-height: 292px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
}

.chk-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chk-item__img {
    width: 52px;
    height: 62px;
    object-fit: cover;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    flex-shrink: 0;
}

.chk-item__info { flex: 1; min-width: 0; }

.chk-item__name {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chk-item__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
}

.chk-item__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--hairline-strong);
    flex-shrink: 0;
}

.chk-item__price {
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.chk-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-block: 4px;
    font-size: 14px;
    color: var(--text-2);
}

.chk-row__val {
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.chk-row--discount .chk-row__val { color: var(--danger); }
.chk-row--coupon .chk-row__val { color: var(--success); }

.chk-row--total {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.chk-row--total .chk-row__val {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
}

.chk-submit { margin-top: 16px; }

/* ---------------- auth gate ---------------- */

.chk-gate { margin-top: 40px; }

/* ---------------- success panel ---------------- */

.chk-success {
    max-width: 560px;
    margin: 0 auto;
    padding: 72px 16px 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
}

.chk-success > * { animation: chk-rise 0.7s var(--ease-out) both; }
.chk-success > *:nth-child(2) { animation-delay: 0.5s; }
.chk-success > *:nth-child(3) { animation-delay: 0.65s; }
.chk-success > *:nth-child(4) { animation-delay: 0.8s; }
.chk-success > *:nth-child(5) { animation-delay: 0.95s; }

.chk-ok {
    position: relative;
    width: 108px;
    height: 108px;
    margin-bottom: 8px;
}

.chk-ok::before {
    content: "";
    position: absolute;
    inset: -22px;
    border-radius: 50%;
    /* gold is theme-invariant; matches the rgba() glows in components.css */
    background: radial-gradient(circle, rgba(241, 164, 36, 0.22), transparent 68%);
    animation: chk-halo 1.4s var(--ease-out) 0.7s both;
}

.chk-ok svg {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
}

.chk-ok__ring {
    fill: none;
    stroke: var(--gold);
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transform: rotate(-90deg);
    transform-origin: center;
    animation: chk-draw 0.9s var(--ease-out) 0.15s forwards;
}

.chk-ok__tick {
    fill: none;
    stroke: var(--gold);
    stroke-width: 5.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: chk-draw 0.5s var(--ease-out) 0.9s forwards;
}

@keyframes chk-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes chk-halo {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes chk-rise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}

.chk-success__title {
    font-family: var(--font-display);
    font-size: clamp(28px, 4.5vw, 40px);
    font-weight: 700;
}

.chk-success__order {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-2);
}

.chk-success__num {
    font-weight: 800;
    color: var(--gold-deep);
}
[data-theme="dark"] .chk-success__num { color: var(--gold-soft); }

.chk-success__note {
    font-size: 14.5px;
    color: var(--text-2);
    max-width: 400px;
    line-height: 1.6;
}

.chk-success__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
}

/* ---------------- responsive ---------------- */

@media (max-width: 1020px) {
    .chk-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }
}

@media (max-width: 880px) {
    .chk-layout { grid-template-columns: 1fr; }
    .chk-summary { position: static; }
    .chk-pays { grid-template-columns: 1fr; }
    .chk-items { max-height: none; }
}

@media (max-width: 560px) {
    .chk-card { padding: 18px 16px; }
    .chk-grid2 { grid-template-columns: 1fr; }
    .chk-promo { flex-direction: column; }
    .chk-promo .btn { width: 100%; }
}
