
/* =========================================================
   SCANPOL LOGISTICS
   Freight CO2 Emissions Calculator
   ========================================================= */

/* 1. Main container */

#scanpol-co2 {
  --co2-primary: #176b52;
  --co2-border: #dce4e0;
  --co2-bg: #f4f8f6;

  width: 100%;
  max-width: 850px;
  margin: 30px auto;

  font-family: inherit;
  color: #24332c;
}

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

#scanpol-co2 [hidden] {
  display: none !important;
}

/* 2. Card and typography */

#scanpol-co2 .co2-card {
  background: #fff;
  border: 1px solid var(--co2-border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.04);
}

#scanpol-co2 h2 {
  font-size: clamp(24px, 4vw, 32px);
  margin: 0 0 10px;
}

#scanpol-co2 .co2-intro {
  color: #627169;
  margin-bottom: 28px;
}

/* 3. Form fields */

#scanpol-co2 label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

#scanpol-co2 input,
#scanpol-co2 select {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;

  background: #fff;
  color: #24332c;

  border: 1px solid #cbd5d0;
  border-radius: 8px;

  font: inherit;
}

#scanpol-co2 input:focus,
#scanpol-co2 select:focus {
  outline: 2px solid var(--co2-primary);
  outline-offset: 2px;
}

#scanpol-co2 .co2-field {
  margin-bottom: 22px;
}

#scanpol-co2 .co2-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

/* 4. Transport mode selector */

#scanpol-co2 .co2-mode-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 10px !important;

  width: 100%;
  margin: 12px 0 2px;
  align-items: start;
}

/*
   WordPress may insert paragraph wrappers.
   Do not let them occupy grid columns.
*/

#scanpol-co2 .co2-mode-grid > p {
  display: contents !important;
}

#scanpol-co2 .co2-mode-grid > p:empty {
  display: none !important;
}

/* Compact buttons — icons remain 30px */

#scanpol-co2 .co2-mode-grid .co2-mode-btn {
  appearance: none;

  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 65px !important;

  margin: 0 !important;
  padding: 6px 4px !important;

  background: #f8faf9 !important;
  border: 2px solid var(--co2-border) !important;
  border-radius: 10px !important;

  color: #24332c !important;

  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  text-align: center !important;
  text-decoration: none !important;

  gap: 4px;
  cursor: pointer !important;

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

#scanpol-co2 .co2-mode-grid .co2-mode-btn:hover {
  background: #edf6f0 !important;
  border-color: #86b5a0 !important;
}

#scanpol-co2 .co2-mode-grid .co2-mode-btn.is-active {
  background: #e8f4ed !important;
  border-color: var(--co2-primary) !important;
  color: var(--co2-primary) !important;
}

#scanpol-co2 .co2-mode-grid .co2-mode-btn:focus-visible {
  outline: 3px solid var(--co2-primary);
  outline-offset: 3px;
}

/* Keep icon size unchanged */

#scanpol-co2 .co2-mode-grid .co2-mode-btn svg {
  display: block !important;

  width: 30px !important;
  height: 30px !important;
  flex-shrink: 0;

  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

#scanpol-co2 .co2-mode-grid .co2-mode-btn span {
  display: block;
  width: 100%;
  overflow-wrap: anywhere;
}

/* Original select retained for calculator.js */

#scanpol-co2 #co2-mode.co2-visually-hidden {
  position: absolute !important;

  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;

  padding: 0 !important;
  margin: -1px !important;

  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;

  white-space: nowrap !important;
  border: 0 !important;
}

/* 5. Multimodal transport legs */

#scanpol-co2 .co2-leg {
  display: grid;
  grid-template-columns: 65px 1fr 1fr auto;
  gap: 12px;
  align-items: center;

  padding: 14px 0;
  border-bottom: 1px solid var(--co2-border);
}

/* 6. General buttons */

#scanpol-co2 button {
  cursor: pointer;
  border-radius: 8px;
  padding: 12px 18px;

  font: inherit;
  font-weight: 600;
}

#scanpol-co2 .co2-add {
  background: #fff;
  color: var(--co2-primary);
  border: 1px solid var(--co2-primary);
  margin-top: 16px;
}

#scanpol-co2 .co2-add:hover {
  background: #edf6f0;
}

#scanpol-co2 .co2-remove {
  background: transparent;
  color: #a33b3b;
  border: 0;
}

#scanpol-co2 button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 7. Results */

#scanpol-co2 .co2-results {
  background: var(--co2-bg);
  border: 1px solid #dbe8e0;
  border-radius: 12px;

  padding: 26px;
  margin-top: 30px;
}

#scanpol-co2 .co2-results h3 {
  margin: 0 0 16px;
  font-size: 19px;
}

#scanpol-co2 .co2-main-result {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;

  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  color: var(--co2-primary);

  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
}

#scanpol-co2 .co2-main-result #co2-wtw {
  font-size: clamp(36px, 6vw, 54px);
  font-weight: 800;
}

#scanpol-co2 .co2-stat {
  background: #fff;
  border: 1px solid var(--co2-border);
  border-radius: 10px;
  padding: 16px;
}

#scanpol-co2 .co2-stat span {
  display: block;
  font-size: 13px;
  color: #64736b;
  margin-bottom: 6px;
}

#scanpol-co2 .co2-stat strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

/* 8. Messages and disclaimers */

#scanpol-co2 .co2-error {
  color: #b42318;
  font-weight: 600;
  margin-top: 12px;
}

#scanpol-co2 .co2-disclaimer {
  font-size: 12px;
  color: #68776f;
  line-height: 1.6;
  margin-top: 24px;
}

#scanpol-co2 .co2-disclaimer a {
  color: var(--co2-primary);
  text-decoration: underline;
}

/* 9. Tablets and phones */

@media (max-width: 650px) {
  #scanpol-co2 .co2-card {
    padding: 20px;
  }

  #scanpol-co2 .co2-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #scanpol-co2 .co2-leg {
    grid-template-columns: 1fr;
  }

  #scanpol-co2 .co2-remove {
    justify-self: start;
  }

  #scanpol-co2 .co2-mode-grid {
    grid-template-columns:
      repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  #scanpol-co2 .co2-mode-grid .co2-mode-btn {
    min-height: 65px !important;
    padding: 6px 4px !important;
    gap: 4px;
  }
}

/* 10. Small phones */

@media (max-width: 380px) {
  #scanpol-co2 .co2-mode-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr)) !important;
  }
}
