/* ============================================================
   RB Fireworks — Checkout / Review Page Styles
   Extends style.css + shop.css
   ============================================================ */

/* ─────────────────────────────────────────────
   ORDER STEPS INDICATOR
───────────────────────────────────────────── */
.review-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 36px;
}
.review-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
}
.review-step.active { color: var(--orange-light); }
.review-step.done   { color: #4ade80; }
.review-step-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 800;
    flex-shrink: 0;
}
.review-step.active .review-step-dot { background: rgba(234,88,12,0.12); }
.review-step.done   .review-step-dot { background: rgba(74,222,128,0.12); }
.review-step-line {
    width: 48px; height: 2px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

/* Steps: compact on mobile */
@media (max-width: 480px) {
    .review-steps { gap: 0; margin-bottom: 24px; }
    .review-step { gap: 4px; font-size: 0.68rem; }
    .review-step-dot { width: 24px; height: 24px; font-size: 0.65rem; }
    .review-step-line { width: 24px; margin: 0 2px; }
    .review-step > span { display: none; }
    .review-step.active > span { display: inline; }
    .checkout-card { padding: 20px 16px; }
    .co-payment-card { padding: 16px 14px; }
}

/* ─────────────────────────────────────────────
   PAGE WRAPPER
───────────────────────────────────────────── */
.page-checkout .checkout-main {
    padding: 100px 0 80px;
    min-height: 100vh;
    background: var(--black);
}

.checkout-breadcrumb {
    margin-bottom: 36px;
}

/* Flash message */
.co-flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 24px;
    line-height: 1.5;
}
.co-flash svg { width: 18px; height: 18px; flex-shrink: 0; }
.co-flash-error   { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.25); color: #f87171; }
.co-flash-success { background: rgba(74,222,128,0.1);  border: 1px solid rgba(74,222,128,0.25);  color: #4ade80; }

/* ─────────────────────────────────────────────
   GRID LAYOUT
───────────────────────────────────────────── */
.checkout-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: clamp(24px, 4vw, 56px);
    align-items: start;
}

@media (max-width: 900px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
    .checkout-summary { order: 2; }
    .checkout-form-wrap { order: 1; }
}

/* ─────────────────────────────────────────────
   CARD SHELL
───────────────────────────────────────────── */
.checkout-card {
    background: var(--black-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
    min-width: 0;
    overflow: hidden;
}
.checkout-card:last-child { margin-bottom: 0; }

.checkout-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.checkout-card-title svg { width: 18px; height: 18px; color: var(--orange-light); flex-shrink: 0; }

/* ─────────────────────────────────────────────
   ORDER SUMMARY
───────────────────────────────────────────── */
.checkout-summary { position: sticky; top: 90px; }
@media (max-width: 900px) { .checkout-summary { position: static; } }

/* Empty state */
.co-empty { text-align: center; padding: 20px 0; color: var(--muted); }

/* Item list */
.co-item {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.co-item:last-child { border-bottom: none; }
.co-item-img {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--black-4);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.co-item-img img { width: 100%; height: 100%; object-fit: cover; }
.co-item-name { font-size: 0.88rem; font-weight: 600; color: var(--white); margin-bottom: 2px; }
.co-item-meta { font-size: 0.78rem; color: var(--muted); }
.co-item-price { font-size: 0.9rem; font-weight: 700; color: var(--orange-light); white-space: nowrap; }

/* Totals */
.co-totals {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.co-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--muted-2);
    margin-bottom: 8px;
}
.co-totals-row strong { font-size: 1.1rem; color: var(--orange-light); font-weight: 800; }
.co-totals-note { font-size: 0.75rem; color: var(--muted); display: block; }
.co-totals-note span { display: block; width: 100%; }

/* Payment reminder card */
.co-payment-card { padding: 20px 24px; }
.co-payment-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 12px;
}
.co-payment-hint {
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.6;
}

/* ─────────────────────────────────────────────
   FORM FIELDS
───────────────────────────────────────────── */
.co-field { margin-bottom: 20px; }

.co-form-row--2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 480px) { .co-form-row--2 { grid-template-columns: 1fr; } }

.co-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted-2);
    margin-bottom: 8px;
}
.co-required { color: var(--orange-light); margin-left: 2px; }
.co-optional  { color: var(--muted); font-weight: 400; font-style: italic; }

.co-input {
    width: 100%;
    background: var(--black-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--white);
    font-family: inherit;
    font-size: 0.92rem;
    padding: 12px 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.co-input::placeholder { color: var(--muted); }
.co-input:focus {
    border-color: rgba(234, 88, 12, 0.5);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}
.co-input.co-invalid { border-color: #f87171; }
.co-textarea { resize: vertical; min-height: 80px; }

.co-error {
    display: block;
    font-size: 0.76rem;
    color: #f87171;
    margin-top: 5px;
    min-height: 18px;
}

.co-hint {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 10px;
    line-height: 1.55;
}

/* ─────────────────────────────────────────────
   DELIVERY OPTIONS
───────────────────────────────────────────── */
.co-delivery-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 520px) { .co-delivery-options { grid-template-columns: 1fr; } }

.co-delivery-card {
    display: block;
    cursor: pointer;
}
.co-delivery-card input[type="radio"] { display: none; }

.co-delivery-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--black-4);
    transition: border-color 0.2s, background 0.2s;
}
.co-delivery-inner svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--muted);
    margin-top: 2px;
    transition: color 0.2s;
}
.co-delivery-inner strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 2px;
}
.co-delivery-inner span {
    display: block;
    font-size: 0.76rem;
    color: var(--muted);
    line-height: 1.45;
}
.co-delivery-note {
    font-size: 0.72rem !important;
    color: var(--orange-light) !important;
    margin-top: 4px;
    font-style: italic;
}

.co-delivery-card input:checked + .co-delivery-inner {
    border-color: var(--orange);
    background: rgba(234, 88, 12, 0.07);
}
.co-delivery-card input:checked + .co-delivery-inner svg { color: var(--orange-light); }

/* ─────────────────────────────────────────────
   RECEIPT UPLOAD
───────────────────────────────────────────── */
.co-upload-wrap {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
}
.co-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.co-upload-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 20px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--black-4);
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
}
.co-upload-wrap:hover .co-upload-ui,
.co-upload-wrap.drag-over .co-upload-ui {
    border-color: rgba(234, 88, 12, 0.4);
    background: rgba(234, 88, 12, 0.05);
}
.co-upload-ui svg { width: 32px; height: 32px; color: var(--muted); }
.co-upload-text { font-size: 0.88rem; font-weight: 600; color: var(--muted-2); }
.co-upload-sub  { font-size: 0.74rem; color: var(--muted); }

/* Preview state */
.co-upload-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(234, 88, 12, 0.3);
    border-radius: var(--radius-md);
    background: rgba(234, 88, 12, 0.05);
}
.co-upload-preview img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.co-upload-preview-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
#previewName {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--white);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.co-upload-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.08);
    color: #f87171;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}
.co-upload-remove:hover { background: rgba(248, 113, 113, 0.2); }
.co-upload-remove svg { width: 12px; height: 12px; }

/* ─────────────────────────────────────────────
   SUBMIT ROW
───────────────────────────────────────────── */
.co-submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.co-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 50px;
    transition: var(--transition);
}
.co-back-btn svg { width: 14px; height: 14px; }
.co-back-btn:hover { color: var(--orange-light); border-color: rgba(234, 88, 12, 0.3); }

.co-submit-btn {
    flex: 1;
    min-width: 180px;
    justify-content: center;
}
.co-submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.co-submit-btn svg { width: 16px; height: 16px; }

@media (max-width: 480px) {
    .co-submit-row { flex-direction: column-reverse; align-items: stretch; }
    .co-back-btn { text-align: center; justify-content: center; }
}

/* ─────────────────────────────────────────────
   LIGHT MODE
───────────────────────────────────────────── */
[data-theme="light"] .page-checkout .checkout-main { background: #f5f2ee; }
[data-theme="light"] .checkout-card {
    background: #fff;
    border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .checkout-card-title { color: #111; border-bottom-color: rgba(0,0,0,0.08); }
[data-theme="light"] .co-item-name { color: #111; }
[data-theme="light"] .co-input {
    background: #f9f7f4;
    border-color: rgba(0,0,0,0.12);
    color: #111;
}
[data-theme="light"] .co-input::placeholder { color: #999; }
[data-theme="light"] .co-delivery-inner { background: #f9f7f4; border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .co-delivery-inner strong { color: #111; }
[data-theme="light"] .co-upload-ui { background: #f9f7f4; border-color: rgba(0,0,0,0.14); }
[data-theme="light"] .co-back-btn { color: #555; border-color: rgba(0,0,0,0.14); }
[data-theme="light"] .co-back-btn:hover { color: var(--orange); }
[data-theme="light"] .co-item { border-bottom-color: rgba(0,0,0,0.07); }
[data-theme="light"] .co-totals { border-top-color: rgba(0,0,0,0.07); }
[data-theme="light"] .co-submit-row { border-top-color: rgba(0,0,0,0.07); }

/* ─────────────────────────────────────────────
   QR PAYMENT SECTION
───────────────────────────────────────────── */
.qr-payment-section {
    margin-bottom: 24px;
}

.qr-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.qr-tab {
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted-2);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}
.qr-tab:hover {
    border-color: rgba(234,88,12,0.3);
    color: var(--warm-white);
}
.qr-tab.active {
    background: var(--gradient-brand);
    border-color: transparent;
    color: #fff;
}

.qr-display {
    position: relative;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 300px;
    aspect-ratio: 3/4;
}

.qr-img {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.qr-img.active {
    display: block;
}

/* Light mode */
[data-theme="light"] .qr-tab:not(.active) {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.1);
    color: #555;
}
[data-theme="light"] .qr-tab:not(.active):hover {
    border-color: rgba(234,88,12,0.3);
    color: var(--orange);
}
[data-theme="light"] .qr-display {
    border-color: rgba(0,0,0,0.1);
}
