/* ============================================================
   CP Mattress Calculator — Frontend Styles v1.3.0
   ============================================================ */

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

#cpmc-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 980px;
  margin: 0 auto 40px;
  color: #1a1a2e;
}

/* ── Header ─────────────────────────────────────────────── */
.cpmc-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  color: #fff;
  padding: 24px 32px;
  border-radius: 12px 12px 0 0;
}
.cpmc-company  { font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.cpmc-tagline  { font-size: 13px; opacity: .75; margin-top: 4px; }

/* ── Tabs ───────────────────────────────────────────────── */
.cpmc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 4px;
  background: #0f3460;
}
.cpmc-tab {
  flex: 1 1 auto;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.65);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.cpmc-tab:hover  { background: rgba(255,255,255,.1); color: #fff; }
.cpmc-tab.active { background: #fff; color: #0f3460; font-weight: 700; border-radius: 6px 6px 0 0; }

/* ── Comfort Filter Strip ───────────────────────────────── */
.cpmc-comfort-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  background: #f0f4ff;
  border: 1px solid #e2e6f0;
  border-top: none;
}
.cpmc-cf-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #6b7280;
  margin-right: 4px;
}
.cpmc-cf-btn {
  padding: 4px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 20px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: #374151;
  transition: all .15s;
}
.cpmc-cf-btn:hover  { border-color: #0f3460; color: #0f3460; }
.cpmc-cf-btn.active { background: #0f3460; border-color: #0f3460; color: #fff; font-weight: 700; }
.cpmc-cf-btn.active[data-comfort="Soft"]        { background: #1d4ed8; border-color: #1d4ed8; }
.cpmc-cf-btn.active[data-comfort="Medium Soft"] { background: #059669; border-color: #059669; }
.cpmc-cf-btn.active[data-comfort="Medium Firm"] { background: #d97706; border-color: #d97706; }
.cpmc-cf-btn.active[data-comfort="Firm"]        { background: #dc2626; border-color: #dc2626; }
.cpmc-cf-btn.active[data-comfort="Extra Firm"]  { background: #7c3aed; border-color: #7c3aed; }

/* ── Body ───────────────────────────────────────────────── */
.cpmc-body {
  display: flex;
  gap: 24px;
  padding: 24px 20px;
  background: #f8f9fc;
  border: 1px solid #e2e6f0;
  border-top: none;
  border-radius: 0 0 12px 12px;
}
.cpmc-left  { flex: 1 1 340px; min-width: 0; }
.cpmc-right { flex: 0 0 290px; }

/* ── Field / Label ──────────────────────────────────────── */
.cpmc-field  { margin-bottom: 20px; }
.cpmc-label  { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: #6b7280; margin-bottom: 8px; }

/* ── Product Select ─────────────────────────────────────── */
.cpmc-select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: #1a1a2e;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color .2s;
}
.cpmc-select:focus { outline: none; border-color: #0f3460; }

/* ── Product Preview ─────────────────────────────────────── */
.cpmc-preview {
  margin-bottom: 20px;
  background: #fff;
  border: 1.5px solid #e2e6f0;
  border-radius: 10px;
  overflow: hidden;
}
.cpmc-preview-img-wrap {
  position: relative;
  cursor: zoom-in;
  background: #f8f9fc;
  overflow: hidden;
}
.cpmc-preview-img {
  width: 100%;
  max-height: 230px;
  object-fit: contain;
  display: block;
  padding: 14px 20px;
  transition: transform .25s ease;
}
.cpmc-preview-img-wrap:hover .cpmc-preview-img { transform: scale(1.03); }
.cpmc-zoom-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.cpmc-preview-img-wrap:hover .cpmc-zoom-hint { opacity: 1; }
.cpmc-preview-info {
  border-top: 1px solid #f0f2f8;
  padding: 10px 14px 14px;
}
.cpmc-preview-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.cpmc-cert-badges    { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.cpmc-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.cpmc-comfort-soft        { background: #dbeafe; color: #1d4ed8; }
.cpmc-comfort-medium-soft { background: #d1fae5; color: #065f46; }
.cpmc-comfort-medium-firm { background: #fef3c7; color: #92400e; }
.cpmc-comfort-firm        { background: #fee2e2; color: #991b1b; }
.cpmc-comfort-extra-firm  { background: #ede9fe; color: #5b21b6; }
.cpmc-badge-neutral { background: #f3f4f6; color: #374151; }
.cpmc-badge-green   { background: #d1fae5; color: #065f46; }
.cpmc-badge-cert    { background: #1e3a5f; color: #fff; font-size: 10px; }
.cpmc-preview-desc {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.6;
  margin: 0;
}

/* ── Lightbox ────────────────────────────────────────────── */
#cpmc-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}
#cpmc-lightbox-img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
#cpmc-lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
#cpmc-lightbox-close:hover { background: rgba(255,255,255,.3); }

/* ── Size Buttons ───────────────────────────────────────── */
.cpmc-size-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cpmc-size-btn {
  padding: 9px 16px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  color: #374151;
}
.cpmc-size-btn:hover  { border-color: #0f3460; color: #0f3460; }
.cpmc-size-btn.active { background: #0f3460; border-color: #0f3460; color: #fff; }

/* ── Qty ────────────────────────────────────────────────── */
.cpmc-qty-row {
  display: flex;
  align-items: center;
  width: fit-content;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.cpmc-qty-btn {
  width: 38px; height: 38px;
  border: none; background: #f3f4f6;
  font-size: 18px; cursor: pointer; color: #374151;
  transition: background .15s;
}
.cpmc-qty-btn:hover { background: #e5e7eb; }
.cpmc-qty-input {
  width: 60px; height: 38px;
  border: none; text-align: center;
  font-size: 15px; font-weight: 600; color: #1a1a2e;
}
.cpmc-qty-input:focus { outline: none; }

/* ── Note ───────────────────────────────────────────────── */
.cpmc-note {
  background: #fffbea;
  border-left: 3px solid #f59e0b;
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 16px;
}

/* ── Foundation Upsell ──────────────────────────────────── */
.cpmc-foundation-upsell {
  background: #f0fdf4;
  border: 1.5px solid #a7f3d0;
  border-radius: 10px;
  padding: 14px;
  margin-top: 4px;
}
.cpmc-upsell-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #065f46;
  margin-bottom: 10px;
}
.cpmc-foundation-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cpmc-foundation-btn {
  padding: 8px 14px;
  background: #fff;
  border: 1.5px solid #6ee7b7;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #065f46;
  cursor: pointer;
  transition: all .15s;
}
.cpmc-foundation-btn:hover { background: #d1fae5; border-color: #10b981; }

/* ── Summary Card ───────────────────────────────────────── */
.cpmc-summary-card {
  background: #fff;
  border: 1.5px solid #e2e6f0;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
}
.cpmc-summary-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: #6b7280; margin-bottom: 12px; }
.cpmc-summary-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; font-size: 14px; }
.cpmc-summary-lbl { color: #6b7280; }
.cpmc-summary-val { font-weight: 600; color: #1a1a2e; text-align: right; max-width: 60%; word-break: break-word; }
.cpmc-summary-divider { border-top: 1.5px solid #e2e6f0; margin: 10px 0; }
.cpmc-total-row .cpmc-summary-lbl { font-size: 15px; font-weight: 700; color: #1a1a2e; }
.cpmc-total-val { font-size: 22px !important; font-weight: 800 !important; color: #0f3460 !important; }

/* ── Actions ─────────────────────────────────────────────── */
.cpmc-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.cpmc-btn {
  width: 100%; padding: 12px;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.cpmc-btn:disabled { opacity: .4; cursor: not-allowed; }
.cpmc-btn-primary   { background: #0f3460; color: #fff; }
.cpmc-btn-primary:hover:not(:disabled)   { background: #1a4a80; }
.cpmc-btn-teal      { background: #0d9488; color: #fff; }
.cpmc-btn-teal:hover:not(:disabled)      { background: #0f766e; }
.cpmc-btn-secondary { background: #fff; color: #0f3460; border: 2px solid #0f3460; }
.cpmc-btn-secondary:hover:not(:disabled) { background: #eef2ff; }
.cpmc-btn-ghost     { background: transparent; color: #6b7280; border: 1.5px solid #d1d5db; }
.cpmc-btn-ghost:hover { background: #f3f4f6; }

/* ── Quote List ──────────────────────────────────────────── */
.cpmc-ql-section {
  background: #fff;
  border: 1.5px solid #e2e6f0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
}
.cpmc-ql-header {
  background: #1a1a2e;
  color: #fff;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cpmc-ql-count {
  background: #0d9488;
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 20px;
}
.cpmc-ql-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f2f8;
  font-size: 13px;
}
.cpmc-ql-name  { flex: 1; color: #1a1a2e; font-weight: 500; }
.cpmc-ql-price { font-weight: 700; color: #0f3460; white-space: nowrap; }
.cpmc-ql-remove {
  background: none; border: none;
  color: #9ca3af; cursor: pointer;
  font-size: 14px; padding: 2px 4px;
  transition: color .15s;
  line-height: 1;
}
.cpmc-ql-remove:hover { color: #dc2626; }
.cpmc-ql-footer {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8f9fc;
}
.cpmc-ql-grand {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #e2e6f0;
  margin-bottom: 2px;
}

/* ── Message ─────────────────────────────────────────────── */
.cpmc-msg { margin-bottom: 12px; padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.cpmc-msg.success { background: #d1fae5; color: #065f46; }
.cpmc-msg.error   { background: #fee2e2; color: #991b1b; }

/* ── Quote Form ──────────────────────────────────────────── */
.cpmc-quote-form { margin-top: 4px; }
.cpmc-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid #d1d5db; border-radius: 8px;
  font-size: 14px; color: #1a1a2e; background: #fff;
  transition: border-color .2s;
}
.cpmc-input:focus { outline: none; border-color: #0f3460; }
.cpmc-textarea { resize: vertical; min-height: 80px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 720px) {
  .cpmc-body { flex-direction: column; padding: 18px 14px; }
  .cpmc-right { flex: 1 1 auto; }
  .cpmc-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .cpmc-tab  { flex: 0 0 auto; }
  .cpmc-comfort-filter { gap: 5px; padding: 8px 12px; }
}
