/* Commerce Stack Loss Calculator — Plugin Styles
   Scoped to .csc-wrap to avoid conflicts with theme CSS
   Landscape two-column on desktop, stacked on mobile
   -------------------------------------------------------- */

:root {
  --csc-accent: #E24B4A;
  --csc-accent-dark: #A32D2D;
  --csc-border: #e5e4df;
  --csc-surface: #f9f9f8;
  --csc-muted: #888;
  --csc-text: #1a1a1a;
}

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

/* ---------- Outer wrapper ---------- */
.csc-wrap {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--csc-text);
  background: #fff;
  border: 1px solid var(--csc-border);
  border-radius: 14px;
  max-width: 900px;
  margin: 2.5rem auto;
  overflow: hidden;
}

/* ---------- Header ---------- */
.csc-header {
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid var(--csc-border);
  border-left: 4px solid var(--csc-accent);
}
.csc-title {
  font-size: 1.2rem !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  margin: 0 0 0.25rem !important;
  color: var(--csc-text) !important;
}
.csc-subtitle {
  font-size: 0.875rem !important;
  color: #666 !important;
  margin: 0 !important;
  line-height: 1.5 !important;
}

/* ---------- Landscape two-column body ---------- */
.csc-body {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  min-height: 0;
}
.csc-col-divider {
  background: var(--csc-border);
}
.csc-left {
  padding: 1.5rem 1.75rem;
}
.csc-right {
  padding: 1.5rem 1.75rem;
  background: var(--csc-surface);
}

/* ---------- Slider group labels ---------- */
.csc-group-label {
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.07em !important;
  text-transform: uppercase !important;
  color: #aaa !important;
  margin: 1.1rem 0 0.6rem !important;
}
.csc-group-label:first-of-type {
  margin-top: 0 !important;
}

/* ---------- Individual slider row ---------- */
.csc-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.6rem;
}
.csc-slider-row:last-child {
  margin-bottom: 0;
}
.csc-slider-row label {
  font-size: 0.82rem;
  color: #444;
  flex: 1;
  line-height: 1.35;
  margin: 0;
}
.csc-val {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--csc-text);
  min-width: 54px;
  text-align: right;
  flex-shrink: 0;
}

/* Range input */
.csc-wrap input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  flex-shrink: 0;
  height: 4px;
  background: #e0deda;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  margin: 0;
  padding: 0;
  border: none;
  box-shadow: none;
}
.csc-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--csc-accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--csc-accent);
  transition: transform 0.15s;
}
.csc-wrap input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}
.csc-wrap input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--csc-accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--csc-accent);
}

/* ---------- Results panel heading ---------- */
.csc-results-head {
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.07em !important;
  text-transform: uppercase !important;
  color: #aaa !important;
  margin: 0 0 0.75rem !important;
}

/* Mobile pill — hidden on desktop */
.csc-mobile-badge {
  display: none;
  font-size: 0.7rem;
  font-weight: 600;
  background: #ede9e4;
  color: #888;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 0.75rem;
  width: fit-content;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- Bucket cards grid ---------- */
.csc-buckets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 0.85rem;
}
.csc-bucket {
  background: #fff;
  border: 1px solid var(--csc-border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}
.csc-bucket-label {
  font-size: 0.72rem;
  color: var(--csc-muted);
  margin-bottom: 3px;
  display: block;
}
.csc-bucket-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--csc-text);
  display: block;
  line-height: 1;
}

/* ---------- Total box ---------- */
.csc-total-box {
  background: #fff;
  border: 2px solid var(--csc-accent);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.csc-total-label {
  font-size: 0.82rem;
  color: var(--csc-accent-dark);
  font-weight: 600;
}
.csc-total-val {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--csc-accent);
  line-height: 1;
}

/* ---------- Bar chart ---------- */
.csc-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 0.85rem;
}
.csc-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.csc-bar-name {
  font-size: 0.75rem;
  color: #666;
  width: 84px;
  flex-shrink: 0;
  text-align: right;
}
.csc-bar-track {
  flex: 1;
  background: #e8e7e2;
  border-radius: 3px;
  height: 6px;
  overflow: hidden;
}
.csc-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.csc-bar-amt {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--csc-text);
  width: 52px;
  flex-shrink: 0;
}

/* ---------- Insight ---------- */
.csc-insight {
  font-size: 0.82rem;
  color: #555;
  line-height: 1.65;
  border-top: 1px solid var(--csc-border);
  padding-top: 0.75rem;
}
.csc-insight strong {
  color: var(--csc-text);
  font-weight: 600;
}

/* ==========================================================
   RESPONSIVE — stacked single column on mobile
   ========================================================== */
@media (max-width: 560px) {

  .csc-header {
    padding: 1.25rem 1.25rem 1rem;
  }

  .csc-body {
    grid-template-columns: 1fr;
  }

  .csc-col-divider {
    display: none;
  }

  .csc-left {
    padding: 1.25rem 1.25rem 1rem;
  }

  .csc-right {
    border-top: 1px solid var(--csc-border);
    padding: 1.25rem;
  }

  .csc-mobile-badge {
    display: block;
  }

  .csc-wrap input[type="range"] {
    width: 100px;
  }

  .csc-bar-name {
    width: 72px;
    font-size: 0.7rem;
  }

  .csc-bar-amt {
    font-size: 0.7rem;
    width: 46px;
  }

  .csc-total-val {
    font-size: 1.35rem;
  }
}
