/* ========================================
   DELIVERGUARD CALCULATOR — HOMEPAGE WIDGET
   Condensed version for embedding in hero / below hero
   ======================================== */

.dg-widget {
  --navy: #1a2332;
  --green: #16a34a;
  --green-hover: #15803d;
  --green-glow: rgba(22, 163, 74, 0.15);
  --white: #ffffff;
  --off-white: #f8f7f4;
  --border: #e2dfd8;
  --text: #1a2332;
  --text-secondary: #5a6577;
  --text-muted: #8a92a1;
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.08);
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'Instrument Sans', -apple-system, sans-serif;
  --radius: 8px;
  --radius-lg: 16px;

  font-family: var(--font-body);
  max-width: 520px;
  margin: 0 auto;
}

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

.dg-widget-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 8px 32px rgba(26, 35, 50, 0.08),
    0 2px 8px rgba(26, 35, 50, 0.04);
  overflow: hidden;
}

.dg-widget-header {
  padding: 0.75rem 1.25rem;
  background: var(--off-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dg-widget-header-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dg-widget-header-icon svg {
  width: 14px;
  height: 14px;
  color: var(--white);
}

.dg-widget-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
}

.dg-widget-body {
  padding: 1.25rem;
}

/* Form state */
.dg-widget-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.dg-widget-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dg-widget-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.dg-widget-input-wrap {
  position: relative;
}

.dg-widget-input-wrap .dg-w-prefix {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.88rem;
  color: var(--text-muted);
  pointer-events: none;
}

.dg-widget-input {
  width: 100%;
  padding: 0.6rem 0.65rem 0.6rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -moz-appearance: textfield;
}

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

.dg-widget-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}

.dg-widget-input::placeholder {
  color: var(--text-muted);
}

.dg-widget-btn {
  grid-column: 1 / -1;
  padding: 0.7rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
  background: var(--green);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

.dg-widget-btn:hover {
  background: var(--green-hover);
  transform: translateY(-1px);
}

/* Result state */
.dg-widget-result {
  display: none;
  text-align: center;
}

.dg-widget-result.active {
  display: block;
  animation: dgWidgetFadeIn 0.4s ease;
}

@keyframes dgWidgetFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dg-widget-result-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--red);
  margin-bottom: 0.15rem;
}

.dg-widget-result-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  color: var(--red);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.dg-widget-result-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.dg-widget-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--green);
  text-decoration: none;
  transition: gap 0.2s;
}

.dg-widget-cta:hover {
  gap: 0.6rem;
}

.dg-widget-cta svg {
  width: 16px;
  height: 16px;
}

.dg-widget-reset {
  display: block;
  margin: 0.5rem auto 0;
  padding: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.dg-widget-reset:hover {
  color: var(--text);
}

/* Responsive: stack on very small screens */
@media (max-width: 380px) {
  .dg-widget-form {
    grid-template-columns: 1fr;
  }
}
