/* ── Surf Repair Calculator — Public Styles ─────────────────────────────────
   All selectors are scoped under .src-calc to avoid conflicts with the theme.
   Edit variables in .src-calc to match your site's design system.
────────────────────────────────────────────────────────────────────────────── */

.src-calculator-wrap { /* Wrapper injected by shortcode/block */ }

.src-calc {
  --src-bg:        #f5f5f3;
  --src-white:     #ffffff;
  --src-border:    #e8e8e6;
  --src-text:      #1c1c1a;
  --src-muted:     #888884;
  --src-active-bg: #f5f5f2;
  --src-dark:      #1c1c1a;
  --src-radius:    16px;
  --src-radius-sm: 8px;
  --src-error:     #c0392b;
  --src-error-bg:  #fdf0ef;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--src-text);
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.src-calc-header   { margin-bottom: 32px; }
.src-calc-title    { font-size: clamp(22px, 3vw, 32px); font-weight: 700; letter-spacing: -0.5px; margin: 0 0 8px; }
.src-calc-subtitle { font-size: 15px; color: var(--src-muted); margin: 0; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.src-calc-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 700px) {
  .src-calc-layout { grid-template-columns: 1fr; }
  .src-calc-sidebar { position: static !important; }
}

.src-calc-main    { display: flex; flex-direction: column; gap: 12px; }
.src-calc-sidebar { position: sticky; top: 20px; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.src-card {
  background: var(--src-white);
  border-radius: var(--src-radius);
  border: 1px solid var(--src-border);
  overflow: hidden;
}

.src-card-header        { padding: 16px 24px; border-bottom: 1px solid #f0f0ee; }
.src-card-title         { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--src-text); margin: 0; }

/* ── Customer fields ─────────────────────────────────────────────────────── */
.src-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: #f0f0ee;
}

@media (max-width: 480px) { .src-fields-grid { grid-template-columns: 1fr; } }

.src-field          { background: var(--src-white); padding: 14px 20px; position: relative; }
.src-field--error   { background: var(--src-error-bg); }

.src-field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #b0b0ac;
  margin-bottom: 5px;
}

.src-field--error label { color: var(--src-error); }

.src-field input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--src-text);
  background: transparent;
  font-family: inherit;
}

.src-field input::placeholder { color: #c8c8c4; }

/* Inline error message under a field */
.src-field-error-msg {
  display: block;
  font-size: 11px;
  color: var(--src-error);
  margin-top: 4px;
}

/* Items-level error (no repairs selected) */
.src-items-error {
  background: var(--src-error-bg);
  color: var(--src-error);
  border: 1px solid #f5c6c2;
  border-radius: var(--src-radius-sm);
  padding: 10px 16px;
  font-size: 13px;
}

/* ── Repair list ─────────────────────────────────────────────────────────── */
.src-repair-list { padding: 4px 0; }

.src-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 10px 24px;
  gap: 12px;
  transition: background 0.1s;
}

.src-item:hover         { background: #fafaf8; }
.src-item--active       { background: var(--src-active-bg); }
.src-item--sep          { border-bottom: 1px solid #f0f0ee; }

.src-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  padding: 2px 0;
}

.src-checkbox {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid #d8d8d4;
  background: white;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

.src-checkbox--checked { background: var(--src-dark); border-color: var(--src-dark); }

.src-item-name  { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.src-item-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.src-item-note {
  font-size: 11px;
  color: var(--src-muted);
  background: #f0f0ee;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.src-item-price {
  font-size: 14px;
  font-weight: 500;
  min-width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.src-item-price--mod { color: var(--src-muted); font-weight: 400; }

/* ── Stepper ─────────────────────────────────────────────────────────────── */
.src-stepper {
  display: flex; align-items: center;
  background: #efefed; border-radius: 8px; overflow: hidden; height: 28px;
}

.src-stepper-btn {
  width: 28px; height: 28px; border: none; background: transparent;
  cursor: pointer; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s; flex-shrink: 0;
}

.src-stepper-btn:hover:not(:disabled) { background: #e2e2e0; }
.src-stepper-btn:disabled             { opacity: 0.3; cursor: default; }
.src-stepper-val { min-width: 22px; text-align: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Summary ─────────────────────────────────────────────────────────────── */
.src-summary {
  background: var(--src-dark); /* overridden by inline style when custom colour is set */
  border-radius: var(--src-radius);
  padding: 24px;
  color: #ffffff; /* always white regardless of background colour */
}

.src-summary-title  { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 2px; color: #ffffff; margin: 0 0 16px; }
.src-summary-lines  { display: flex; flex-direction: column; gap: 7px; min-height: 40px; }
.src-summary-empty  { font-size: 13px; color: rgba(255,255,255,0.45); font-style: italic; }

/* Line items: intentionally dimmer so the total stands out */
.src-summary-line   { display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: rgba(255,255,255,0.55); }
.src-summary-label  { flex: 1; }
.src-summary-qty    { color: rgba(255,255,255,0.4); font-size: 12px; flex-shrink: 0; }
.src-summary-amt    { flex-shrink: 0; font-variant-numeric: tabular-nums; }

.src-summary-divider  { height: 1px; background: rgba(255,255,255,0.15); margin: 16px 0; }

.src-summary-total-row  { display: flex; justify-content: space-between; align-items: baseline; }
.src-summary-total-label { font-size: 12px; color: #ffffff; text-transform: uppercase; letter-spacing: 1px; }
.src-summary-total-amt   { font-size: 32px; font-weight: 700; letter-spacing: -1px; color: #ffffff; }
.src-summary-footnote    { font-size: 11px; color: #ffffff; margin: 12px 0 16px; line-height: 1.5; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.src-order-btn {
  width: 100%; padding: 13px; border-radius: 10px; border: none;
  background: white; color: var(--src-dark);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all 0.15s; letter-spacing: -0.2px; font-family: inherit;
}
.src-order-btn:hover:not(:disabled) { background: #f0f0f0; }
.src-order-btn:disabled             { opacity: 0.35; cursor: not-allowed; }

.src-reset-btn {
  width: 100%; margin-top: 8px; padding: 9px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25); background: transparent;
  color: rgba(255,255,255,0.6); font-size: 13px; cursor: pointer;
  transition: all 0.15s; font-family: inherit;
}
.src-reset-btn:hover { background: rgba(255,255,255,0.1); color: #ffffff; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.src-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 24px;
}

.src-modal {
  background: var(--src-white); border-radius: 16px;
  width: 100%; max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2); overflow: hidden;
}

.src-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--src-border);
}
.src-modal-header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.src-modal-close     { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--src-muted); padding: 4px; line-height: 1; }
.src-modal-body      { padding: 20px 24px; }
.src-modal-section   { margin-bottom: 16px; }
.src-modal-section p { margin: 2px 0; font-size: 14px; color: var(--src-text); }
.src-modal-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: #b0b0ac; margin-bottom: 6px; }

.src-modal-item {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--src-muted);
  padding: 4px 0; border-bottom: 1px solid #f5f5f3;
}

.src-modal-total {
  display: flex; justify-content: space-between; align-items: baseline;
  background: #f5f5f3; border-radius: 8px; padding: 12px 16px;
  margin-top: 12px; font-weight: 600; font-size: 15px;
}

.src-modal-error {
  background: var(--src-error-bg); color: var(--src-error);
  border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-top: 12px;
}

.src-modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 16px 24px; border-top: 1px solid var(--src-border);
}

.src-modal-footer .src-order-btn { width: auto; background: var(--src-dark); color: white; padding: 10px 20px; }
.src-modal-footer .src-order-btn:hover:not(:disabled) { background: #333; }

.src-btn-secondary {
  padding: 10px 20px; border-radius: 8px; border: 1px solid var(--src-border);
  background: transparent; font-size: 14px; cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.src-btn-secondary:hover { background: #f5f5f3; }

/* ── Success state ───────────────────────────────────────────────────────── */
.src-modal-success { padding: 40px 32px; text-align: center; }
.src-modal-success-icon {
  width: 52px; height: 52px; background: #e8f7ed; color: #00a32a;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; margin: 0 auto 16px;
}
.src-modal-success h3                  { margin: 0 0 8px; font-size: 18px; }
.src-modal-success p                   { color: var(--src-muted); font-size: 14px; margin: 0 0 20px; }
.src-modal-success .src-order-btn      { background: var(--src-dark); color: white; width: auto; padding: 11px 24px; }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.src-calc-loading { padding: 40px; text-align: center; color: var(--src-muted); font-size: 14px; }

/* ── Mobile fixes ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {

  /* Prevent the whole page from getting a horizontal scrollbar */
  .src-calculator-wrap,
  .src-calc { max-width: 100%; overflow-x: hidden; }

  /* Tighter item row so name + price + stepper all fit */
  .src-item { padding: 10px 12px 10px 14px; gap: 8px; }

  /* Allow name to shrink more aggressively */
  .src-item-name { font-size: 13px; }

  /* Note badge: hide on very narrow screens to save space */
  .src-item-note { display: none; }

  /* Price: smaller, fixed width */
  .src-item-price { font-size: 13px; min-width: 40px; }

  /* Stepper: slightly smaller buttons */
  .src-stepper-btn { width: 24px; height: 24px; font-size: 14px; }
  .src-stepper      { height: 24px; }
  .src-stepper-val  { min-width: 18px; font-size: 12px; }

  /* Customer fields: always single column on mobile */
  .src-fields-grid { grid-template-columns: 1fr; }

  /* Modal: full screen on small phones, scrollable */
  .src-modal-overlay { padding: 0; align-items: flex-end; }
  .src-modal {
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
  }
  .src-modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
  }

  /* Input font-size 16px prevents iOS auto-zoom on focus */
  .src-field input { font-size: 16px; }
}
