/* ===== CSS Variables (overridden by brand config) ===== */
:root {
  --primary:      #2563EB;
  --primary-text: #FFFFFF;
  --bg:           #F3F4F6;
  --surface:      #FFFFFF;
  --text:         #111827;
  --muted:        #6B7280;
  --border:       #E5E7EB;
  --success:      #059669;
  --danger:       #DC2626;
  --bump:         #D97706;
  --radius:       8px;
  --font:         'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background:  var(--bg);
  color:       var(--text);
  min-height:  100vh;
  font-size:   15px;
  line-height: 1.5;
}

body.is-loading { opacity: 0; }
body { transition: opacity 0.2s; }

/* ===== Layout ===== */
.page {
  max-width: 520px;
  margin:    0 auto;
  padding:   24px 16px 48px;
}

@media (min-width: 768px) {
  .page { padding: 40px 24px 64px; }
}

/* ===== Header ===== */
.header {
  display:         flex;
  justify-content: center;
  align-items:     center;
  gap:             12px;
  padding:         0 0 24px;
  border-bottom:   1px solid var(--border);
  margin-bottom:   24px;
}

.header__logo {
  height:    40px;
  max-width: 160px;
  object-fit: contain;
}

.header__name {
  font-size:   20px;
  font-weight: 700;
  color:       var(--text);
}

.header__secure {
  display:     flex;
  align-items: center;
  gap:         6px;
  font-size:   12px;
  color:       var(--success);
  font-weight: 500;
}

.header__secure svg { flex-shrink: 0; }

/* ===== Timer bar ===== */
.timer-bar {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             8px;
  padding:         10px 16px;
  border-radius:   var(--radius);
  font-size:       13px;
  font-weight:     600;
  margin-bottom:   20px;
}

/* ===== Order Summary ===== */
.order-summary {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow:      hidden;
}

.order-toggle {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  width:           100%;
  padding:         14px 16px;
  background:      none;
  border:          none;
  cursor:          pointer;
  font:            inherit;
  color:           var(--text);
  font-weight:     600;
  font-size:       14px;
}

.order-toggle__left {
  display:     flex;
  align-items: center;
  gap:         8px;
}

.order-toggle__count {
  font-weight: 400;
  color:       var(--muted);
  font-size:   13px;
}

.order-toggle__right {
  display:     flex;
  align-items: center;
  gap:         8px;
  font-size:   15px;
  color:       var(--primary);
}

.order-toggle__chevron {
  transition: transform 0.2s;
}
.order-toggle[aria-expanded="true"] .order-toggle__chevron {
  transform: rotate(180deg);
}

.order-body {
  overflow: hidden;
}
.order-body.is-collapsed {
  display: none;
}
.order-body__inner {
  padding:    0 16px 16px;
  border-top: 1px solid var(--border);
}

.order-item {
  display:     flex;
  align-items: center;
  gap:         12px;
  padding:     12px 0;
  border-bottom: 1px solid var(--border);
}
.order-item:last-child { border-bottom: none; }

.order-item__img {
  width:         56px;
  height:        56px;
  object-fit:    contain;
  border-radius: 6px;
  border:        1px solid var(--border);
  flex-shrink:   0;
  background:    var(--bg);
}

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

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

.order-item__desc {
  font-size: 12px;
  color:     var(--muted);
  margin-top: 2px;
}

.order-item__price {
  text-align:  right;
  flex-shrink: 0;
}

.order-item__original {
  font-size:       12px;
  color:           var(--muted);
  text-decoration: line-through;
  display:         block;
}

.order-item__current {
  font-weight: 700;
  font-size:   15px;
  color:       var(--primary);
}

.order-item__badge {
  font-size:        10px;
  font-weight:      700;
  background:       var(--success);
  color:            #fff;
  padding:          2px 5px;
  border-radius:    3px;
  display:          inline-block;
  margin-top:       3px;
  letter-spacing:   0.5px;
}

.order-totals {
  padding-top: 12px;
}

.totals-row {
  display:         flex;
  justify-content: space-between;
  font-size:       14px;
  margin-bottom:   6px;
}

.totals-row--savings {
  color:       var(--success);
  font-weight: 500;
}

.totals-row--savings .s-orig {
  text-decoration: line-through;
  color:           var(--muted);
  font-weight:     400;
}

.totals-total {
  display:         flex;
  justify-content: space-between;
  align-items:     baseline;
  font-weight:     700;
  font-size:       16px;
  padding-top:     10px;
  border-top:      2px solid var(--border);
  margin-top:      6px;
}

.totals-total__value {
  font-size: 20px;
  color:     var(--primary);
}

/* ===== Section ===== */
.section {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       20px;
  margin-bottom: 16px;
}

.section__title {
  font-weight:   700;
  font-size:     14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color:         var(--muted);
  margin-bottom: 16px;
}

/* ===== Form fields ===== */
.field {
  margin-bottom: 14px;
}

.field:last-child { margin-bottom: 0; }

.field__label {
  display:       block;
  font-size:     13px;
  font-weight:   500;
  margin-bottom: 5px;
  color:         var(--text);
}

.field__input,
.field__select {
  display:       block;
  width:         100%;
  padding:       10px 12px;
  border:        1.5px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  font:          inherit;
  font-size:     15px;
  color:         var(--text);
  background:    var(--surface);
  transition:    border-color 0.15s, box-shadow 0.15s;
  outline:       none;
  appearance:    none;
}

.field__input:focus,
.field__select:focus {
  border-color: var(--primary);
  box-shadow:   0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.field__input.is-invalid,
.field__select.is-invalid {
  border-color: var(--danger);
}

.field__input::placeholder { color: var(--muted); }

.field-row {
  display: grid;
  gap:     12px;
}

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

@media (max-width: 400px) {
  .field-row--2 { grid-template-columns: 1fr; }
  .field-row--3 { grid-template-columns: 1fr 1fr; }
}

/* ===== Payment methods ===== */
.methods {
  display: flex;
  gap:     10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.method {
  display:       flex;
  align-items:   center;
  gap:           8px;
  padding:       10px 16px;
  border:        1.5px solid var(--border);
  border-radius: var(--radius);
  background:    var(--surface);
  font:          inherit;
  font-size:     14px;
  font-weight:   500;
  cursor:        pointer;
  transition:    border-color 0.15s, background 0.15s;
  color:         var(--text);
}

.method[aria-checked="true"] {
  border-color: var(--primary);
  background:   color-mix(in srgb, var(--primary) 8%, transparent);
  color:        var(--primary);
}

.method__icon svg {
  width:  18px;
  height: 18px;
}

/* ===== Card panel ===== */
.card-brand-row {
  display:     flex;
  gap:         8px;
  margin-bottom: 14px;
  flex-wrap:   wrap;
}

.card-brand-row img {
  height:        24px;
  opacity:       0.5;
  transition:    opacity 0.15s;
}

.card-brand-row img.active { opacity: 1; }

/* ===== Order Bump ===== */
.bump-box {
  margin-top: 4px;
}

.bump {
  display:       block;
  border:        2px dashed var(--bump);
  border-radius: var(--radius);
  padding:       16px;
  cursor:        pointer;
  margin-bottom: 10px;
  background:    color-mix(in srgb, var(--bump) 5%, transparent);
  transition:    background 0.15s, border-color 0.15s;
}

.bump.is-checked {
  border-style:  solid;
  background:    color-mix(in srgb, var(--bump) 12%, transparent);
}

.bump__head {
  display:     flex;
  align-items: center;
  gap:         10px;
  font-weight: 600;
  font-size:   14px;
  color:       var(--bump);
  margin-bottom: 10px;
}

.bump__head input[type="checkbox"] { display: none; }

.bump__check {
  width:         20px;
  height:        20px;
  border:        2px solid var(--bump);
  border-radius: 4px;
  flex-shrink:   0;
  display:       flex;
  align-items:   center;
  justify-content: center;
  color:         transparent;
  transition:    background 0.15s, color 0.15s;
}

.bump.is-checked .bump__check {
  background: var(--bump);
  color:      #fff;
}

.bump__body {
  display:     flex;
  gap:         12px;
  align-items: flex-start;
}

.bump__body img {
  width:         64px;
  height:        64px;
  object-fit:    contain;
  border-radius: 6px;
  border:        1px solid var(--border);
  flex-shrink:   0;
  background:    var(--bg);
}

.bump__body > div { flex: 1; }

.bump__body strong {
  display:     block;
  font-size:   14px;
  font-weight: 600;
  margin-bottom: 3px;
}

.bump__body p {
  font-size: 13px;
  color:     var(--muted);
  margin-bottom: 6px;
}

.bump__price {
  font-size: 14px;
  font-weight: 500;
}

.bump__price s {
  color:           var(--muted);
  font-weight:     400;
  margin-right:    6px;
  text-decoration: line-through;
}

.bump__price b {
  color: var(--bump);
}

/* ===== Mini total + Submit ===== */
.mini-total {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       16px 20px;
  margin-bottom: 12px;
}

.mini-total__row {
  display:         flex;
  justify-content: space-between;
  align-items:     baseline;
  font-size:       13px;
  margin-bottom:   4px;
}

.mini-total__label { color: var(--muted); }
.mini-total__orig  { text-decoration: line-through; color: var(--muted); }
.mini-total__save  { color: var(--success); font-weight: 600; }

.mini-total__total {
  display:         flex;
  justify-content: space-between;
  align-items:     baseline;
  font-weight:     700;
  font-size:       16px;
  padding-top:     10px;
  border-top:      1px solid var(--border);
  margin-top:      6px;
}

.mini-total__total-value {
  font-size: 22px;
  color:     var(--primary);
}

.btn-submit {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             8px;
  width:           100%;
  padding:         15px 24px;
  background:      var(--primary);
  color:           var(--primary-text);
  font:            inherit;
  font-size:       16px;
  font-weight:     700;
  border:          none;
  border-radius:   var(--radius);
  cursor:          pointer;
  transition:      opacity 0.15s, transform 0.1s;
  letter-spacing:  0.01em;
}

.btn-submit:hover:not(:disabled) { opacity: 0.9; }
.btn-submit:active:not(:disabled) { transform: scale(0.99); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-submit.is-loading::after {
  content:       '';
  width:         16px;
  height:        16px;
  border:        2px solid color-mix(in srgb, var(--primary-text) 40%, transparent);
  border-top-color: var(--primary-text);
  border-radius: 50%;
  animation:     spin 0.6s linear infinite;
}

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

/* ===== Error ===== */
.form-error {
  background:    color-mix(in srgb, var(--danger) 10%, transparent);
  border:        1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--radius);
  padding:       12px 16px;
  font-size:     14px;
  color:         var(--danger);
  font-weight:   500;
  margin-bottom: 12px;
}

/* ===== Trust badges ===== */
.trust {
  margin-top:  20px;
  text-align:  center;
  font-size:   12px;
  color:       var(--muted);
  display:     flex;
  flex-direction: column;
  align-items: center;
  gap:         6px;
}

.trust__badges {
  display:     flex;
  align-items: center;
  gap:         12px;
  flex-wrap:   wrap;
  justify-content: center;
}

.trust__badge {
  display:     flex;
  align-items: center;
  gap:         5px;
  font-size:   12px;
  font-weight: 500;
  color:       var(--muted);
}

.trust__badge svg {
  color:      var(--success);
  flex-shrink: 0;
}

/* ===== Result screen ===== */
#result { display: none; }

.result {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       32px 24px;
  text-align:    center;
}

.result__icon {
  width:         64px;
  height:        64px;
  border-radius: 50%;
  display:       flex;
  align-items:   center;
  justify-content: center;
  margin:        0 auto 20px;
  background:    color-mix(in srgb, var(--success) 12%, transparent);
  color:         var(--success);
}

.result__icon--pending {
  background: color-mix(in srgb, #F59E0B 12%, transparent);
  color:      #F59E0B;
}

.result h2 {
  font-size:     22px;
  font-weight:   700;
  margin-bottom: 10px;
}

.result p {
  color:         var(--muted);
  font-size:     15px;
  margin-bottom: 10px;
  line-height:   1.6;
}

.result__id {
  font-size:   13px;
  color:       var(--muted);
  margin-top:  16px;
  padding:     8px 12px;
  background:  var(--bg);
  border-radius: 6px;
  display:     inline-block;
  font-family: monospace;
}

/* ===== Footer ===== */
.footer {
  margin-top:  32px;
  text-align:  center;
  font-size:   12px;
  color:       var(--muted);
  line-height: 1.6;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}
