/*
 * Module      : Checkout (styles)
 * Description : Styles for the checkout flow: the step grid and stepper, form
 *               cards and fields, shipping and payment options, the sticky
 *               order summary, the confirmation, pending and failure screens,
 *               and the Stripe payment and address element surfaces.
 */

.co-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 28%, 380px);
  gap: 18px;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.co-main {
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  scrollbar-width: thin;
  min-width: 0;
}
.co-stepper {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 22px;
  padding: 12px 16px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
}
.co-step { display: flex; align-items: center; gap: 8px; opacity: 0.5; }
.co-step.active { opacity: 1; }
.co-step.done { opacity: 0.8; color: var(--ok); }
.co-step .n {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px;
}
.co-step.active .n { background: var(--accent-cyan); color: #07140d; border-color: var(--accent-cyan); }
.co-step.done .n { background: var(--ok); color: #07140d; border-color: var(--ok); }
.co-step .label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.co-sep { flex: 1; height: 1px; background: var(--panel-border); }

.co-card {
  padding: 18px 22px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
}
.co-card h3 {
  font-family: var(--font-title);
  font-size: 14px;
  letter-spacing: 0.2em;
  margin-bottom: 14px;
  color: var(--text-bright);
  text-transform: uppercase;
}

.form-row { display: grid; gap: 10px; margin-bottom: 10px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }

.field { display: flex; flex-direction: column; min-width: 0; }
.field input, .field select, .field textarea { width: 100%; box-sizing: border-box; }
.field label {
  font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-dim);
  margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  padding: 10px 12px;
  background: rgba(20,40,70,0.4);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  color: var(--text-bright);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent-cyan);
}

.ship-option, .pay-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: rgba(20,40,70,0.3);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}
.ship-option:hover, .pay-option:hover { border-color: var(--panel-border-hover); }
.ship-option.sel, .pay-option.sel {
  border-color: var(--accent-cyan);
  background: rgba(230, 181, 168,0.08);
}
.radio-pip {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--panel-border);
  flex-shrink: 0;
}
.sel .radio-pip { border-color: var(--accent-cyan); background: radial-gradient(circle, var(--accent-cyan) 35%, transparent 40%); }
.ship-name, .pay-name { font-weight: 600; }
.ship-sub, .pay-sub { font-size: 11px; color: var(--text-dim); }
.ship-price { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

.co-side { overflow-y: auto; min-height: 0; }
.co-summary {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: sticky; top: 0;
}
.co-summary h4 {
  font-family: var(--font-title);
  font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--panel-border);
}
.co-summary .row {
  display: flex; justify-content: space-between;
  padding: 4px 0; font-size: 12px; color: var(--text-mid);
  font-variant-numeric: tabular-nums;
}
.co-summary .row.total {
  color: var(--text-bright); font-weight: 700; font-size: 15px;
  padding-top: 10px; margin-top: 8px;
  border-top: 1px dashed var(--panel-border);
}
.co-sum-items {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 14px;
}
.co-sum-item { display: flex; align-items: center; gap: 11px; }
.co-sum-thumb {
  width: 48px; height: 48px; flex: 0 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(20,40,70,0.3);
  border: 1px solid var(--panel-border);
}
.co-sum-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.co-sum-info { flex: 1 1 auto; min-width: 0; }
.co-sum-brand {
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim);
}
.co-sum-name {
  font-size: 12px; color: var(--text-bright);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.co-sum-size { font-size: 11px; color: var(--text-mid); }
.co-sum-price {
  flex: 0 0 auto;
  font-size: 12px; color: var(--text-bright);
  font-variant-numeric: tabular-nums;
}
.co-sum-actions { display: flex; gap: 8px; margin-top: 16px; }

.main-interface[data-page="checkout"] .shop-col {
  bottom: calc(var(--vn-h) + 32px); /* reserve exactly the dock, not a 300px band — fixes the truncated form */
}

@media (max-width: 960px) {
  .co-grid {
    grid-template-columns: 1fr;
    flex: none;
    overflow: visible;
    height: auto;
  }
  .co-main, .co-side { overflow: visible; min-height: 0; height: auto; }
  .main-interface[data-page="checkout"] .shop-col {
    bottom: calc(var(--vn-h) + 20px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.co-confirm {
  text-align: center;
  padding: 40px 20px;
  max-width: 560px; margin: 0 auto;
}
.co-confirm .mark {
  width: 96px; height: 96px; margin: 0 auto 22px;
  border-radius: 50%;
  border: 2px solid var(--ok);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: var(--ok);
  box-shadow: 0 0 60px rgba(196, 216, 154,0.3);
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 60px rgba(196, 216, 154,0.3); }
  50% { transform: scale(1.04); box-shadow: 0 0 80px rgba(196, 216, 154,0.5); }
}
.co-confirm h2 { font-family: var(--font-title); font-size: 28px; letter-spacing: 0.14em; margin-bottom: 10px; }
.co-confirm .ord {
  font-family: var(--font-mono); font-size: 14px;
  color: var(--accent-cyan); letter-spacing: 0.15em;
  padding: 8px 18px;
  display: inline-block;
  border: 1px dashed var(--panel-border);
  border-radius: 4px;
  margin: 14px 0;
}
.co-confirm p { color: var(--text-mid); line-height: 1.7; max-width: 460px; margin: 0 auto; }

.co-confirm--pending .mark--pending {
  border-color: var(--warn);
  color: var(--warn);
  font-size: 40px;
  box-shadow: 0 0 60px rgba(201, 138, 85, 0.22);
  animation: pulse-pending 2.2s ease-in-out infinite;
}
@keyframes pulse-pending {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.05); opacity: 1; }
}
.co-confirm--failed .mark--fail {
  border-color: var(--err);
  color: var(--err);
  font-weight: 700;
  box-shadow: 0 0 60px rgba(122, 58, 42, 0.3);
  animation: none;
}
.co-confirm-admin {
  margin: 16px auto 0;
  max-width: 460px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.co-pay-label { font-size: 10px; letter-spacing: 0.16em; color: var(--text-dim); text-transform: uppercase; margin-bottom: 8px; }
.co-pay-mount { min-height: 44px; margin-bottom: 8px; }
.co-pay-loading { font-size: 12px; color: var(--text-dim); padding: 12px 0; }
.co-pay-error { color: var(--err, #d47a8a); font-size: 12px; min-height: 16px; margin: 4px 0; }
.co-pay-test { font-size: 10px; color: var(--text-dim); margin-top: 10px; line-height: 1.5; }
.co-pay-test b { color: var(--text-mid); letter-spacing: 0.05em; }

.co-email-label { display:block; font-size:10px; letter-spacing:.16em; color:var(--text-dim); text-transform:uppercase; margin-bottom:6px; }
.co-req { color: var(--err, #d47a8a); }
.co-email-input { width:100%; padding:10px 12px; background:#160e12; border:1px solid var(--panel-border); border-radius:4px; color:var(--text); font:inherit; font-size:14px; }
.co-email-input:focus { outline:none; border-color:#e6b5a8; }
.co-email-hint { font-size:11px; color:var(--text-dim); margin:6px 0 16px; }
.co-addr-mount { min-height:60px; }
.co-ship-dest { font-size:12px; color:var(--text-dim); margin-bottom:12px; }
.co-ship-dest b { color:var(--text-mid); }
.ship-option[role="radio"] { cursor:pointer; }
.ship-option:focus-visible { outline:2px solid #e6b5a8; outline-offset:2px; }
