/* ===========================
   RizeHost Checkout Styles
   File: /assets/css/checkout.css
   =========================== */

/* --- Color system (tweak if needed) --- */
:root {
  --rh-bg: #0f0f10;
  --rh-surface: #151618;
  --rh-surface-2: #1b1d20;
  --rh-text: #e9eaec;
  --rh-text-dim: #b9bcc2;
  --rh-primary: #ce2430;   /* RizeHost red */
  --rh-primary-600: #b61f29;
  --rh-primary-700: #971a22;
  --rh-accent: #308382;    /* optional accent from your palette */
  --rh-border: #26282c;
  --rh-success: #2ecc71;
  --rh-warning: #f1c40f;
  --rh-danger: #e74c3c;
  --rh-focus: #3a9df9;
  --rh-shadow: 0 10px 30px rgba(0,0,0,.35);
  --rh-radius: 16px;
  --rh-radius-sm: 12px;
  --rh-radius-xs: 8px;
  --rh-spacing: 20px;
  --rh-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

/* Light-mode fallback (if your site is light) */
@media (prefers-color-scheme: light) {
  :root {
    --rh-bg: #f6f7f9;
    --rh-surface: #ffffff;
    --rh-surface-2: #ffffff;
    --rh-text: #151718;
    --rh-text-dim: #5a616a;
    --rh-border: #e6e8eb;
    --rh-shadow: 0 8px 24px rgba(17, 17, 26, 0.08);
  }
}

/* --- Page shell --- */
body.checkout-page {
  background: var(--rh-bg);
  color: var(--rh-text);
  font-family: var(--rh-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.rh-container {
  width: min(1100px, 94vw);
  margin: 40px auto 80px;
}

/* --- Header / tagline --- */
.checkout-header {
  margin-bottom: 22px;
}
.checkout-title {
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: .2px;
  margin: 0 0 8px;
}
.checkout-tagline {
  color: var(--rh-text-dim);
  font-size: 15px;
}

/* --- Layout: two columns on desktop, one on mobile --- */
.checkout-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr; /* main form | order summary */
  gap: 22px;
}
@media (max-width: 920px) {
  .checkout-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Cards --- */
.rh-card {
  background: var(--rh-surface);
  border: 1px solid var(--rh-border);
  border-radius: var(--rh-radius);
  box-shadow: var(--rh-shadow);
  overflow: hidden;
}

.rh-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--rh-border);
}
.rh-card__title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .2px;
}
.rh-card__body {
  padding: 18px 20px;
}

/* --- Form sections --- */
.form-grid {
  display: grid;
  gap: 14px;
}
.form-row {
  display: grid;
  gap: 12px;
}
@media (min-width: 640px) {
  .form-row.two {
    grid-template-columns: 1fr 1fr;
  }
  .form-row.three {
    grid-template-columns: 1.2fr .8fr .8fr;
  }
}

.label {
  display: block;
  font-size: 12.5px;
  color: var(--rh-text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--rh-surface-2);
  border: 1px solid var(--rh-border);
  color: var(--rh-text);
  border-radius: var(--rh-radius-xs);
  padding: 12px 14px;
  outline: none;
  transition: border .15s ease, box-shadow .15s ease, background .15s ease;
}
.input::placeholder,
.textarea::placeholder {
  color: #8a8f98;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--rh-focus);
  box-shadow: 0 0 0 3px rgba(58,157,249,.15);
}
.input.error,
.select.error,
.textarea.error {
  border-color: var(--rh-danger);
}

/* --- Inline help / errors --- */
.help {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--rh-text-dim);
}
.error-text {
  color: var(--rh-danger);
}

/* --- Buttons --- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--rh-radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: transform .04s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  text-decoration: none;
  user-select: none;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--rh-primary);
  border-color: var(--rh-primary-600);
  color: #fff;
  box-shadow: 0 8px 18px rgba(206,36,48,.25);
}
.btn-primary:hover { background: var(--rh-primary-600); }
.btn-primary:focus { box-shadow: 0 0 0 3px rgba(206,36,48,.25); }

.btn-outline {
  background: transparent;
  color: var(--rh-text);
  border-color: var(--rh-border);
}
.btn-outline:hover {
  border-color: var(--rh-text-dim);
}

/* --- Cart table --- */
.cart-table {
  width: 100%;
  border-collapse: collapse;
}
.cart-table th,
.cart-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--rh-border);
  vertical-align: middle;
  text-align: left;
  font-size: 14px;
}
.cart-table th {
  color: var(--rh-text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-size: 12px;
}
.cart-item__name {
  font-weight: 600;
  line-height: 1.35;
}
.qty-input {
  width: 72px;
  text-align: center;
}
.remove-btn {
  background: transparent;
  border: none;
  color: var(--rh-danger);
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
}
.remove-btn:hover { text-decoration: underline; }

/* --- Totals box --- */
.totals {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--rh-text);
}
.totals-row.dim { color: var(--rh-text-dim); }
.totals-grand {
  font-size: 18px;
  font-weight: 800;
  padding-top: 6px;
  border-top: 1px dashed var(--rh-border);
}

/* --- Inline badges (coupon, secure, etc.) --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  border: 1px solid var(--rh-border);
  background: var(--rh-surface-2);
  color: var(--rh-text-dim);
}

/* --- Payment brands row (optional icons) --- */
.pay-brands {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  opacity: .9;
}
.pay-brands img {
  height: 22px;
  filter: grayscale(10%);
}

/* --- Sticky summary (desktop) --- */
@media (min-width: 921px) {
  .summary-sticky {
    position: sticky;
    top: 20px;
  }
}

/* --- Notices --- */
.notice {
  padding: 12px 14px;
  border-radius: var(--rh-radius-xs);
  border: 1px solid var(--rh-border);
  background: var(--rh-surface-2);
  color: var(--rh-text);
  font-size: 14px;
}
.notice.success { border-color: rgba(46, 204, 113, .6); }
.notice.warn { border-color: rgba(241, 196, 15, .6); }
.notice.error { border-color: rgba(231, 76, 60, .6); }

/* --- Footer CTA --- */
.checkout-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 16px;
}

/* --- Small utilities --- */
.mt-0 { margin-top: 0!important; }
.mt-8 { margin-top: 8px!important; }
.mt-16 { margin-top: 16px!important; }
.mb-0 { margin-bottom: 0!important; }
.w-100 { width: 100%!important; }
.center { text-align: center!important; }

/* --- Accessibility focus ring for clickable elements --- */
a:focus, button:focus, .remove-btn:focus, .btn:focus, .input:focus, .select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(58,157,249,.18);
}

/* --- Loading skeleton (optional) --- */
.skeleton {
  position: relative;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.04), rgba(255,255,255,0));
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
  min-height: 14px;
}
@keyframes shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: -135% 0; }
}
