/* ============================================
   Costapedia tool widget styles
   Mobile-first, then desktop enhancements
   ============================================ */

.tool-widget {
  margin: 32px 0;
  font-family: 'Inter Tight', -apple-system, sans-serif;
}

.tool-widget-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* ---- Form column ---- */
.tool-form {
  background: var(--white, #FFF);
  border: 1px solid var(--border, #E8E2D8);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(60, 40, 20, 0.04);
}

.tool-field {
  margin-bottom: 18px;
}

.tool-field:last-of-type {
  margin-bottom: 24px;
}

.tool-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #1A1A1A);
  margin-bottom: 8px;
}

.tool-hint {
  display: inline-block;
  margin-left: 6px;
  color: var(--ink-3, #888);
  cursor: help;
  font-weight: 400;
  font-size: 13px;
}

.tool-input-group {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border, #E8E2D8);
  border-radius: 12px;
  background: var(--white, #FFF);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tool-input-group:focus-within {
  border-color: var(--primary, #E54B4B);
  box-shadow: 0 0 0 3px rgba(229, 75, 75, 0.12);
}

.tool-input-group input {
  flex: 1;
  border: none;
  padding: 14px 16px;
  font-size: 17px;
  font-family: inherit;
  background: transparent;
  color: var(--ink, #1A1A1A);
  -moz-appearance: textfield;
  min-width: 0;
}

.tool-input-group input:focus {
  outline: none;
}

.tool-input-group input::-webkit-outer-spin-button,
.tool-input-group input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tool-prefix,
.tool-suffix {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--surface, #F7F4EE);
  color: var(--ink-2, #444);
  font-size: 16px;
  font-weight: 500;
  border: none;
}

.tool-prefix {
  border-right: 1px solid var(--border-light, #EEE8DC);
}

.tool-suffix {
  border-left: 1px solid var(--border-light, #EEE8DC);
}

/* Native select */
.tool-field select {
  width: 100%;
  border: 1.5px solid var(--border, #E8E2D8);
  border-radius: 12px;
  padding: 13px 40px 13px 16px;
  font-size: 16px;
  font-family: inherit;
  background: var(--white, #FFF) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23888'%3E%3Cpath d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E") no-repeat right 12px center;
  background-size: 18px;
  appearance: none;
  -webkit-appearance: none;
  color: var(--ink, #1A1A1A);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tool-field select:focus {
  outline: none;
  border-color: var(--primary, #E54B4B);
  box-shadow: 0 0 0 3px rgba(229, 75, 75, 0.12);
}

/* Checkbox */
.tool-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface, #F7F4EE);
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
}

.tool-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary, #E54B4B);
  cursor: pointer;
}

.tool-help {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3, #888);
  line-height: 1.4;
}

/* Submit button */
.tool-submit {
  width: 100%;
  padding: 16px 24px;
  background: var(--primary, #E54B4B);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  margin-bottom: 12px;
}

.tool-submit:hover {
  background: var(--primary-dark, #BF3838);
}

.tool-submit:active {
  transform: scale(0.985);
}

.tool-disclaimer {
  font-size: 12px;
  color: var(--ink-3, #888);
  text-align: center;
  line-height: 1.4;
}

/* ---- Result column ---- */
.tool-result {
  background: var(--surface, #F7F4EE);
  border-radius: 18px;
  padding: 24px;
  min-height: 180px;
  display: block;
}

.tool-result-empty {
  text-align: center;
  color: var(--ink-3, #888);
  padding: 24px 16px;
}

.tool-result-icon {
  font-size: 32px;
  opacity: 0.4;
  margin-bottom: 12px;
}

.tool-result-loading {
  text-align: center;
  padding: 24px 16px;
  color: var(--ink-2, #444);
}

.tool-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border, #E8E2D8);
  border-top-color: var(--primary, #E54B4B);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: tool-spin 0.7s linear infinite;
}

@keyframes tool-spin {
  to { transform: rotate(360deg); }
}

.tool-result-error {
  text-align: center;
  padding: 24px 16px;
  color: #991B1B;
}

.tool-result-error .tool-result-icon {
  color: #DC2626;
  opacity: 1;
}

/* Result hero */
.tool-result-hero {
  text-align: center;
  padding: 12px 0 20px;
  border-bottom: 1px solid var(--border-light, #EEE8DC);
  margin-bottom: 20px;
}

.tool-summary-big {
  font-family: 'Fraunces', 'Inter Tight', serif;
  font-size: 42px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink, #1A1A1A);
  margin-bottom: 6px;
}

.tool-summary-sub {
  font-family: 'Instrument Serif', 'Fraunces', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--primary, #E54B4B);
}

/* Highlight chips */
.tool-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.tool-highlight {
  background: var(--white, #FFF);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
}

.tool-highlight-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3, #888);
  margin-bottom: 4px;
}

.tool-highlight-value {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink, #1A1A1A);
}

/* Detail rows */
.tool-rows {
  margin-bottom: 20px;
}

.tool-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light, #EEE8DC);
  font-size: 14px;
}

.tool-row:last-child {
  border-bottom: none;
}

.tool-row-label {
  color: var(--ink-2, #444);
}

.tool-row-value {
  color: var(--ink, #1A1A1A);
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}

/* Comparison table */
.tool-compare {
  margin: 24px 0;
  padding-top: 16px;
  border-top: 1px solid var(--border-light, #EEE8DC);
}

.tool-compare h4 {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--ink, #1A1A1A);
}

.tool-compare table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tool-compare th {
  text-align: left;
  padding: 8px 4px;
  font-weight: 600;
  color: var(--ink-3, #888);
  border-bottom: 1px solid var(--border-light, #EEE8DC);
}

.tool-compare th:last-child,
.tool-compare td:last-child {
  text-align: right;
}

.tool-compare td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--border-light, #EEE8DC);
}

/* Explain section */
.tool-explain {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light, #EEE8DC);
}

.tool-explain h3 {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--ink, #1A1A1A);
}

.tool-explain p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2, #444);
  margin-bottom: 10px;
}

.tool-explain a {
  color: var(--primary, #E54B4B);
}

/* Share buttons */
.tool-share {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.tool-share-btn {
  flex: 1;
  min-width: 130px;
  padding: 10px 14px;
  background: var(--white, #FFF);
  border: 1px solid var(--border, #E8E2D8);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink-2, #444);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.tool-share-btn:hover {
  border-color: var(--primary, #E54B4B);
  background: var(--surface, #F7F4EE);
}

/* ---- Desktop layout ---- */
@media (min-width: 760px) {
  .tool-widget-grid {
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
  }

  .tool-form {
    position: sticky;
    top: 100px;
  }

  .tool-summary-big {
    font-size: 52px;
  }

  .tool-highlights {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .tool-widget-grid {
    grid-template-columns: 420px 1fr;
  }
}
