
/* WebIQ_CALC Frontend Styles */
.webiq-calc {
  --webiq-bg: #ffffff;
  --webiq-surface: #f7f8fb;
  --webiq-border: rgba(20, 30, 50, 0.12);
  --webiq-text: #111827;
  --webiq-muted: rgba(17, 24, 39, 0.62);
  --webiq-accent: #2563eb;
  --webiq-accent-2: #0ea5e9;
  --webiq-radius: 14px;
  --webiq-shadow: 0 14px 45px rgba(16, 24, 40, 0.10);

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--webiq-text);
}

.webiq-calc .webiq-calc__body {
  background: var(--webiq-bg);
  border: 1px solid var(--webiq-border);
  border-radius: var(--webiq-radius);
  box-shadow: var(--webiq-shadow);
  padding: 18px;
}

.webiq-calc .webiq-calc__block {
  background: var(--webiq-surface);
  border: 1px solid var(--webiq-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.webiq-calc .webiq-calc__block.is-hidden {
  display: none;
}

.webiq-calc .webiq-calc__block-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 12px;
  letter-spacing: 0.2px;
}

.webiq-calc .webiq-calc__fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 700px) {
  .webiq-calc .webiq-calc__fields {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}

/* Optional single-column layout */
.webiq-calc.webiq-layout-vertical .webiq-calc__fields {
  grid-template-columns: 1fr !important;
}

.webiq-calc .webiq-field {
  background: #fff;
  border: 1px solid var(--webiq-border);
  border-radius: 12px;
  padding: 12px;
  transition: opacity 160ms ease, transform 160ms ease;
}

.webiq-calc .webiq-field.is-hidden {
  display: none;
}

.webiq-calc .webiq-field__label {
  display: block;
  font-size: 13px;
  color: var(--webiq-muted);
  margin-bottom: 8px;
}

.webiq-calc .webiq-field__control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.webiq-calc .webiq-input {
  width: 100%;
  background: #fff;
  border: 1px solid var(--webiq-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.webiq-calc select.webiq-input {
  appearance: none;
  cursor: pointer;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, #6b7280 50%),
    linear-gradient(135deg, #6b7280 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) calc(1em + 2px),
    calc(100% - 13px) calc(1em + 2px),
    100% 0;
  background-size:
    5px 5px,
    5px 5px,
    2.5em 2.5em;
  background-repeat: no-repeat;
}

.webiq-calc .webiq-input:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.webiq-calc .webiq-field__help {
  margin-top: 8px;
  font-size: 12px;
  color: var(--webiq-muted);
}

/* Number input with +/- */
.webiq-calc .webiq-number {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--webiq-border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.webiq-calc .webiq-number__btn {
  width: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  color: var(--webiq-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.webiq-calc .webiq-number__btn:hover {
  background: rgba(15, 23, 42, 0.04);
}

.webiq-calc .webiq-number__btn:active {
  background: rgba(15, 23, 42, 0.07);
}

.webiq-calc .webiq-number .webiq-input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
}

.webiq-calc .webiq-number .webiq-input:focus {
  border-color: transparent;
  box-shadow: none;
}

/* Checkbox */
.webiq-calc .webiq-checkbox,
.webiq-calc .webiq-radio,
.webiq-calc .webiq-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.webiq-calc .webiq-checkbox input,
.webiq-calc .webiq-radio input,
.webiq-calc .webiq-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.webiq-calc .webiq-checkbox__ui {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid var(--webiq-border);
  background: #fff;
  display: inline-block;
  position: relative;
}

.webiq-calc .webiq-checkbox input:checked + .webiq-checkbox__ui {
  border-color: rgba(37, 99, 235, 0.7);
  background: rgba(37, 99, 235, 0.12);
}

.webiq-calc .webiq-checkbox input:checked + .webiq-checkbox__ui::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 4px;
  background: var(--webiq-accent);
}

.webiq-calc .webiq-checkbox__text {
  font-size: 14px;
}

/* Toggle */
.webiq-calc .webiq-toggle__ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--webiq-border);
  background: rgba(17,24,39,0.06);
  position: relative;
  transition: background 160ms ease, border-color 160ms ease;
}

.webiq-calc .webiq-toggle__ui::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  box-shadow: 0 6px 16px rgba(16,24,40,0.18);
  transition: left 160ms ease, background 160ms ease;
}

.webiq-calc .webiq-toggle input:checked + .webiq-toggle__ui {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.45);
}

.webiq-calc .webiq-toggle input:checked + .webiq-toggle__ui::after {
  left: 21px;
  background: var(--webiq-accent);
}

.webiq-calc .webiq-toggle__text {
  font-size: 14px;
}

/* Radio */
.webiq-calc .webiq-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.webiq-calc .webiq-radio__ui {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--webiq-border);
  background: #fff;
  display: inline-block;
  position: relative;
}

.webiq-calc .webiq-radio input:checked + .webiq-radio__ui {
  border-color: rgba(37, 99, 235, 0.65);
  background: rgba(37, 99, 235, 0.10);
}

.webiq-calc .webiq-radio input:checked + .webiq-radio__ui::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--webiq-accent);
}

.webiq-calc .webiq-radio__text {
  font-size: 14px;
}

/* Radio cards (optional) */
.webiq-calc .webiq-radio-group--cards {
  gap: 10px;
}

.webiq-calc .webiq-radio-card {
  position: relative;
}

.webiq-calc .webiq-radio-card__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.webiq-calc .webiq-radio-card__label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--webiq-border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.webiq-calc .webiq-radio-card__label:hover {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.10);
}

.webiq-calc .webiq-radio-card__ui {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--webiq-border);
  background: #fff;
  display: inline-block;
  position: relative;
  flex: 0 0 auto;
}

.webiq-calc .webiq-radio-card__input:checked + .webiq-radio-card__label {
  border-color: rgba(34, 197, 94, 0.75);
  background: rgba(34, 197, 94, 0.08);
}

.webiq-calc .webiq-radio-card__input:checked + .webiq-radio-card__label .webiq-radio-card__ui {
  border-color: rgba(34, 197, 94, 0.90);
}

.webiq-calc .webiq-radio-card__input:checked + .webiq-radio-card__label .webiq-radio-card__ui::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  background: #22c55e;
}

.webiq-calc .webiq-radio-card__text {
  font-size: 14px;
  font-weight: 700;
}

/* Native radio (no custom style) */
.webiq-calc .webiq-radio-group--native .webiq-radio-native {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

/* Multi-checkbox cards */
.webiq-calc .webiq-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.webiq-calc .webiq-check-card {
  position: relative;
}

.webiq-calc .webiq-check-card__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.webiq-calc .webiq-check-card__label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--webiq-border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.webiq-calc .webiq-check-card__label:hover {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.10);
}

.webiq-calc .webiq-check-card__ui {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 2px solid var(--webiq-border);
  background: #fff;
  display: inline-block;
  position: relative;
  flex: 0 0 auto;
}

.webiq-calc .webiq-check-card__input:checked + .webiq-check-card__label {
  border-color: rgba(34, 197, 94, 0.75);
  background: rgba(34, 197, 94, 0.08);
}

.webiq-calc .webiq-check-card__input:checked + .webiq-check-card__label .webiq-check-card__ui {
  border-color: rgba(34, 197, 94, 0.90);
  background: #22c55e;
}

.webiq-calc .webiq-check-card__input:checked + .webiq-check-card__label .webiq-check-card__ui::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.webiq-calc .webiq-check-card__text {
  font-size: 14px;
  font-weight: 700;
}

/* Results */
.webiq-calc .webiq-calc__results {
  margin-top: 16px;
  border-top: 1px dashed var(--webiq-border);
  padding-top: 16px;

  display: grid;
  gap: 12px;
}

@media (min-width: 700px) {
  .webiq-calc .webiq-calc__results {
    grid-template-columns: 1fr 1fr;
  }
}

.webiq-calc .webiq-output {
  background: linear-gradient(180deg, rgba(37,99,235,0.06), rgba(14,165,233,0.03));
  border: 1px solid rgba(37, 99, 235, 0.20);
  border-radius: 14px;
  padding: 14px;
}

.webiq-calc .webiq-output__label {
  font-size: 12px;
  color: var(--webiq-muted);
  margin-bottom: 6px;
}

.webiq-calc .webiq-output__value {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.2px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.webiq-calc .webiq-output__prefix,
.webiq-calc .webiq-output__suffix {
  font-weight: 700;
  font-size: 14px;
  color: rgba(17, 24, 39, 0.74);
}

.webiq-calc .webiq-output__result {
  color: var(--webiq-text);
}
