/* ═══════════════════════════════════════════════════
   Sticker Price Calculator — Public CSS  v1.7.0
   • No body/html resets (WordPress controls those)
   • All rules scoped to .spc-* classes
   • Mobile-first, works inside any WP theme/container
   ═══════════════════════════════════════════════════ */

:root {
  --spc-navy:      #1a2744;
  --spc-navy2:     #2d3e6b;
  --spc-border:    #c8d0e0;
  --spc-bg:        #f4f6fb;
  --spc-white:     #ffffff;
  --spc-text:      #1a2744;
  --spc-muted:     #6b7a99;
  --spc-green:     #00a32a;
  --spc-red:       #c0392b;
  --spc-r:         20px;   /* radio size */
}

/* ── Outer wrapper ─────────────────────────────── */
.spc-wrap {
  padding: 12px 12px 100px;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Card ──────────────────────────────────────── */
.spc-card {
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
  background: var(--spc-white);
  border: 2px solid var(--spc-navy);
  border-radius: 6px;
  padding: 18px 16px;
  box-sizing: border-box;
}

/* ── Section ───────────────────────────────────── */
.spc-section {
  padding-bottom: 10px;
}
.spc-section + .spc-section {
  border-top: 1px solid var(--spc-border);
  padding-top: 10px;
}

.spc-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--spc-navy);
  margin: 0 0 8px;
  line-height: 1.3;
}

/* ── Radio options ─────────────────────────────── */
.spc-radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.spc-radio-circle {
  width: var(--spc-r);
  height: var(--spc-r);
  min-width: var(--spc-r);
  border-radius: 50%;
  border: 2px solid var(--spc-navy);
  background: var(--spc-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s;
  box-sizing: border-box;
}
.spc-radio-circle::after {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--spc-navy);
  transform: scale(0);
  transition: transform .15s cubic-bezier(.34,1.56,.64,1);
}
.spc-radio-option.selected .spc-radio-circle::after { transform: scale(1); }
.spc-radio-option.selected .spc-radio-label { font-weight: 600; }

.spc-radio-label {
  font-size: 14px;
  color: var(--spc-text);
  flex: 1;
  line-height: 1.4;
}
.spc-radio-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--spc-navy);
  white-space: nowrap;
}
.spc-radio-price.empty { color: var(--spc-border); font-weight: 400; font-size: 12px; }

/* Per-sticker price in the middle of qty rows */
.spc-radio-per {
  font-size: 13px;
  font-weight: 500;
  color: var(--spc-green);
  white-space: nowrap;
  min-width: 100px;
  text-align: right;
}
.spc-radio-per.empty { color: var(--spc-border); font-weight: 400; font-size: 12px; }

/* ── Horizontal scroll row (shapes & materials) ─ */
.spc-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.spc-scroll::-webkit-scrollbar { display: none; }

.spc-card-item {
  flex: 0 0 84px;
  min-width: 0;
  border: 2px solid var(--spc-border);
  border-radius: 8px;
  padding: 0 4px 8px;
  cursor: pointer;
  text-align: center;
  position: relative;
  background: var(--spc-white);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}
.spc-card-item:active, .spc-card-item:hover {
  border-color: var(--spc-navy2);
}
.spc-card-item.selected {
  border-color: var(--spc-navy);
  /* outline renders outside the box so it never interacts with the border — no jagging on mobile */
  outline: 2px solid var(--spc-navy);
  outline-offset: -2px;
}

.spc-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin: 4px auto 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--spc-bg);
}

/* icon margin below badge */
.spc-badge-popular + .spc-card-icon,
.spc-badge-popular.spc-badge-visible + .spc-card-icon {
  margin-top: 6px;
}
.spc-badge-popular:not(.spc-badge-visible) + .spc-card-icon {
  margin-top: 6px;
}

.spc-card-icon svg { width: 26px; height: 26px; display: block; }

/* Material image inside the icon circle */
.spc-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.spc-card-name {
  font-size: 9px;
  font-weight: 600;
  color: var(--spc-text);
  line-height: 1.3;
  letter-spacing: .01em;
}

/* Material gradient backgrounds (fallback if no image set) */
.mat-bg-promotional { background: linear-gradient(135deg,#f0f0f0,#d8d8d8); }
.mat-bg-premium     { background: linear-gradient(135deg,#e8e8e8,#c0c0c0); }
.mat-bg-holographic { background: linear-gradient(135deg,#ffd6e7,#c3b1e1,#b5ead7,#fffacd); }
.mat-bg-hightack    { background: linear-gradient(135deg,#fff3cd,#ffe0a3); }
.mat-bg-clear       { background: linear-gradient(135deg,#ddf0ff,#aad4f5); }
.mat-bg-glitter     { background: linear-gradient(135deg,#ffd700,#ff69b4,#00bfff); }

/* ── Most Popular badge — sits at the very TOP of the card ── */
/* A placeholder (visibility:hidden) keeps height consistent for non-popular cards */
.spc-badge-popular {
  visibility: hidden;
  background: #f6e000;
  color: var(--spc-navy);
  font-size: 7px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 0;          /* flush top: no rounding needed since overflow:hidden on card handles it */
  white-space: nowrap;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  display: block;
  line-height: 1.6;
  margin: 0;
  align-self: stretch;       /* stretch edge-to-edge ignoring parent's horizontal padding */
  margin-left: -4px;         /* counteract parent's 4px horizontal padding */
  margin-right: -4px;
  width: calc(100% + 8px);
}
.spc-badge-popular.spc-badge-visible {
  visibility: visible;
}

/* ── Out of stock material cards ─────────────── */
.spc-card-item.spc-mat-oos {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  filter: grayscale(80%) !important;
  box-shadow: inset 0 0 0 2px var(--spc-border) !important;
}
/* Block pointer events on card AND all its children */
.spc-card-item.spc-mat-oos,
.spc-card-item.spc-mat-oos * {
  pointer-events: none !important;
}
/* Cross overlay via pseudo-element */
.spc-card-item.spc-mat-oos::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background:
    linear-gradient(to bottom right, transparent calc(50% - 0.5px), rgba(0,0,0,0.22) calc(50% - 0.5px), rgba(0,0,0,0.22) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom left,  transparent calc(50% - 0.5px), rgba(0,0,0,0.22) calc(50% - 0.5px), rgba(0,0,0,0.22) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  pointer-events: none;
}
.spc-mat-oos-badge {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: #888;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 4px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  text-align: center;
  border-radius: 6px 6px 0 0;
}

/* ── Custom shape note ─────────────────────────── */
.spc-custom-shape-note {
  display: none;
  margin-top: 10px;
  background: var(--spc-bg);
  border-left: 3px solid var(--spc-navy);
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--spc-muted);
  line-height: 1.5;
}
.spc-custom-shape-note.visible { display: block; }

/* ── Unlaminated finish note ───────────────────── */
.spc-finish-note {
  display: none;
  margin-top: 10px;
  background: #f0faf3;
  border-left: 3px solid #4caf50;
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  font-size: 12px;
  color: #2e7d32;
  line-height: 1.5;
}

/* ── Proof yes note ────────────────────────────── */
.spc-proof-yes-note {
  display: none;
  margin-top: 10px;
  background: #f0f4ff;
  border-left: 3px solid var(--spc-navy);
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--spc-text);
  line-height: 1.5;
}

/* ── Custom size inputs ────────────────────────── */
.spc-custom-fields {
  display: none;
  gap: 10px;
  margin-top: 8px;
  padding-left: 30px;
}
.spc-custom-fields.visible { display: flex; }
.spc-inp-group { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.spc-inp-group label { font-size: 11px; font-weight: 600; color: var(--spc-muted); }

.spc-inp-group input,
.spc-custom-qty-wrap input {
  border: 1.5px solid var(--spc-border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--spc-text);
  background: var(--spc-bg);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  -moz-appearance: textfield;
  transition: border-color .15s;
  min-height: 40px;
}
.spc-inp-group input::-webkit-inner-spin-button,
.spc-inp-group input::-webkit-outer-spin-button,
.spc-custom-qty-wrap input::-webkit-inner-spin-button,
.spc-custom-qty-wrap input::-webkit-outer-spin-button { -webkit-appearance: none; }
.spc-inp-group input:focus,
.spc-custom-qty-wrap input:focus { border-color: var(--spc-navy); background: var(--spc-white); }

/* ── Custom qty ────────────────────────────────── */
.spc-custom-qty-wrap {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding-left: 30px;
}
.spc-custom-qty-wrap.visible { display: flex; }
.spc-custom-qty-wrap input { max-width: 200px; }
.spc-qty-result { font-size: 12px; color: var(--spc-muted); min-height: 16px; }

/* ── Upload zone ───────────────────────────────── */
.spc-upload-zone {
  border: 2px dashed var(--spc-border);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
  position: relative;
  background: var(--spc-bg);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  -webkit-tap-highlight-color: transparent;
}
.spc-upload-zone.dragover,
.spc-upload-zone:hover { border-color: var(--spc-navy); background: #eef0f8; }
.spc-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.spc-upload-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 6px;
  color: var(--spc-navy);
  opacity: .5;
  display: block;
}
.spc-upload-hint { font-size: 12px; color: var(--spc-muted); margin: 2px 0; }
.spc-upload-types { font-size: 11px; }

/* ── File items ────────────────────────────────── */
.spc-files-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.spc-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--spc-bg);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--spc-text);
  box-sizing: border-box;
}
.spc-file-item .spc-file-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spc-file-item .spc-file-status { font-size: 11px; color: var(--spc-muted); white-space: nowrap; }
.spc-file-item.uploading .spc-file-status { color: var(--spc-navy2); }
.spc-file-item.done      .spc-file-status { color: var(--spc-green); }
.spc-file-item.error     .spc-file-status { color: var(--spc-red); }
.spc-file-remove {
  background: none;
  border: none;
  color: var(--spc-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  min-width: 24px;
  min-height: 24px;
}
.spc-file-remove:hover { color: var(--spc-red); }

/* ── Sticky footer ─────────────────────────────── */
.spc-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--spc-navy);
  color: var(--spc-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 3px solid var(--spc-navy2);
  box-sizing: border-box;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.spc-footer-left { min-width: 0; flex: 1; }
.spc-footer-price {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
  white-space: nowrap;
}
.spc-footer-sub {
  font-size: 10px;
  color: #8fa3cc;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spc-footer-btn {
  background: var(--spc-white);
  color: var(--spc-navy);
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  min-height: 42px;
  transition: background .15s, opacity .15s;
  flex-shrink: 0;
}
.spc-footer-btn:active:not(:disabled),
.spc-footer-btn:hover:not(:disabled)  { background: #d8dff0; }
.spc-footer-btn:disabled              { opacity: .35; cursor: not-allowed; }
.spc-footer-btn.loading               { opacity: .6; pointer-events: none; }

/* ── Validation error banners ──────────────────── */
.spc-validation-error {
  display: none;
  background: #fdf0ef;
  border: 1.5px solid var(--spc-red);
  border-radius: 6px;
  color: var(--spc-red);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  margin-top: 8px;
}
.spc-validation-error.visible { display: block; }

/* Shake animation on invalid card sections */
.spc-section.spc-invalid-shake {
  animation: spc-shake .35s ease;
}
@keyframes spc-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  60%      { transform: translateX(6px); }
}

/* ── Upload required indicator ─────────────────── */
.spc-upload-req {
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  padding: 5px 10px;
  border-radius: 5px;
}
.spc-upload-req.required  { color: #c0392b; background: #fdf0ef; }
.spc-upload-req.uploading { color: var(--spc-navy2); background: var(--spc-bg); }
.spc-upload-req.ok        { color: var(--spc-green); background: #f0faf2; }

.spc-upload-zone.spc-upload-error {
  border-color: #c0392b;
  background: #fdf0ef;
  animation: spc-shake .35s ease;
}

/* ── Comments / Suggestions textarea ──────────── */
.spc-comments-input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--spc-border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--spc-text);
  background: var(--spc-bg);
  outline: none;
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
  transition: border-color .15s;
}
.spc-comments-input::placeholder { color: var(--spc-muted); }
.spc-comments-input:focus { border-color: var(--spc-navy); background: var(--spc-white); }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 480px) {
  .spc-wrap  { padding: 10px 8px 96px; }
  .spc-card  { padding: 14px 12px; border-radius: 4px; }
  .spc-section-title { font-size: 14px; }
  .spc-card-item { flex: 0 0 76px; }
  .spc-footer-price { font-size: 18px; }
  .spc-footer-btn   { padding: 9px 12px; font-size: 12px; }
}

/* ── WordPress admin bar offset ────────────────── */
.admin-bar .spc-footer { bottom: 0; }
