/*
 * Intelligent Form — The dark-theme widget standard.
 * Single source of truth for Scout, Ballparker, Closer, and all future widgets.
 *
 * Design tokens:
 *   --iw-bg:       #1C1A17  (deepest background)
 *   --iw-bg-2:     #242118  (card background)
 *   --iw-bg-3:     #2C2920  (header / elevated surface)
 *   --iw-border:   #3E3A30  (primary border)
 *   --iw-border-2: #504B3E  (secondary border — choice outlines)
 *   --iw-text:     #F0EBE0  (primary text)
 *   --iw-text-2:   #C8BFB0  (secondary text)
 *   --iw-text-3:   #8C8478  (muted text)
 *   --iw-accent:   var(--brand, #F26419)  (action color — inherits brand)
 *
 * All classes use .iw- prefix. Sharp corners (0 border-radius) everywhere.
 * Fonts: Barlow Condensed (headings), DM Sans (body).
 */

/* ── Card shell ── */
.iw-card {
  max-width: 600px;
  background: var(--iw-bg-2, #242118);
  border: 1px solid var(--iw-border, #3E3A30);
  display: flex;
  flex-direction: column;
  font-family: 'DM Sans', sans-serif;
}

/* ── Header ── */
.iw-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--iw-border, #3E3A30);
  background: var(--iw-bg-3, #2C2920);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.iw-header-left { display: flex; align-items: center; gap: 10px; }
.iw-header-icon {
  width: 28px; height: 28px;
  background: var(--iw-accent, var(--brand, #F26419));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.iw-header-icon svg { width: 13px; height: 13px; fill: #fff; }
.iw-header-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 14px;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--iw-text, #F0EBE0);
}
.iw-header-sub {
  font-size: 11px; color: var(--iw-text-3, #8C8478); margin-top: 1px;
}
.iw-pill {
  font-size: 11px; font-weight: 600;
  background: var(--iw-accent, var(--brand, #F26419));
  color: #fff; padding: 3px 10px;
  letter-spacing: 0.04em; text-transform: uppercase;
}

/* ── Progress bar (Scout only, but available to all) ── */
.iw-progress-wrap { height: 3px; background: var(--iw-bg, #1C1A17); flex-shrink: 0; }
.iw-progress-bar {
  height: 100%;
  background: var(--iw-accent, var(--brand, #F26419));
  transition: width 0.4s ease; width: 0%;
}

/* ── Body ── */
.iw-body {
  min-height: 220px; overflow-y: auto;
  padding: 24px 20px; display: flex; flex-direction: column;
  justify-content: center; scroll-behavior: smooth;
}

/* ── Question text ── */
.iw-question {
  font-size: 15px; line-height: 1.5;
  color: var(--iw-text, #F0EBE0); margin-bottom: 16px;
  animation: iw-in 0.25s ease;
}

/* ── Choice buttons — radio style, sharp corners ── */
.iw-choices {
  display: flex; flex-direction: column; gap: 6px;
  animation: iw-in 0.25s ease;
}
.iw-choice {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--iw-border-2, #504B3E);
  background: var(--iw-bg, #1C1A17);
  color: var(--iw-text, #F0EBE0);
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  cursor: pointer; text-align: left;
  transition: all 0.15s; line-height: 1.4;
}
.iw-choice:hover {
  border-color: var(--iw-accent, var(--brand, #F26419));
  background: rgba(242, 100, 25, 0.08);
}
.iw-radio {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--iw-border-2, #504B3E);
  flex-shrink: 0; position: relative;
  transition: border-color 0.15s;
}
.iw-choice:hover .iw-radio {
  border-color: var(--iw-accent, var(--brand, #F26419));
}

/* ── "Something else" input below choices ── */
.iw-other-wrap { margin-top: 10px; animation: iw-in 0.25s ease; }
.iw-other-label {
  font-size: 11px; color: var(--iw-text-3, #8C8478); margin-bottom: 6px;
}
.iw-other-row { display: flex; gap: 8px; }
.iw-other-input {
  flex: 1; background: var(--iw-bg, #1C1A17);
  border: 1px solid var(--iw-border, #3E3A30);
  color: var(--iw-text, #F0EBE0); padding: 9px 14px;
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  outline: none; transition: border-color 0.15s;
}
.iw-other-input:focus {
  border-color: var(--iw-accent, var(--brand, #F26419));
}
.iw-other-input::placeholder { color: var(--iw-text-3, #8C8478); }
.iw-other-send {
  width: 38px; height: 38px; flex-shrink: 0;
  background: var(--iw-accent, var(--brand, #F26419));
  border: none; color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
}
.iw-other-send:hover {
  background: var(--iw-accent-hover, #D95510);
}

/* ── Helper text ── */
.iw-helper {
  font-size: 11px; color: var(--iw-text-3, #8C8478);
  margin-top: -8px; margin-bottom: 8px;
  animation: iw-in 0.25s ease;
}

/* ── Footer input ── */
.iw-footer {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--iw-border, #3E3A30);
}
.iw-footer input {
  flex: 1; background: var(--iw-bg, #1C1A17);
  border: 1px solid var(--iw-border, #3E3A30);
  color: var(--iw-text, #F0EBE0); padding: 9px 14px;
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  outline: none; transition: border-color 0.15s;
}
.iw-footer input:focus {
  border-color: var(--iw-accent, var(--brand, #F26419));
}
.iw-footer input::placeholder { color: var(--iw-text-3, #8C8478); }
.iw-footer button {
  width: 38px; height: 38px; flex-shrink: 0;
  background: var(--iw-accent, var(--brand, #F26419));
  border: none; color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
}
.iw-footer button:hover:not(:disabled) {
  background: var(--iw-accent-hover, #D95510);
}
.iw-footer button:disabled { opacity: 0.3; cursor: default; }

/* ── Typing indicator ── */
.iw-typing {
  display: flex; gap: 4px; padding: 10px; justify-content: center;
}
.iw-typing span {
  display: inline-block; width: 6px; height: 6px;
  background: var(--iw-accent, var(--brand, #F26419));
  opacity: 0.3; animation: iw-dot 1.2s ease-in-out infinite;
}
.iw-typing span:nth-child(2) { animation-delay: 0.2s; }
.iw-typing span:nth-child(3) { animation-delay: 0.4s; }

/* ── Summary block ── */
.iw-summary {
  border: 1px solid var(--iw-border, #3E3A30);
  background: var(--iw-bg-3, #2C2920);
  padding: 16px 20px; animation: iw-in 0.25s ease;
}
.iw-summary-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 15px;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--iw-accent, var(--brand, #F26419));
  margin-bottom: 12px;
}
.iw-summary table { width: 100%; font-size: 12px; border-collapse: collapse; }
.iw-summary td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--iw-border, #3E3A30);
  vertical-align: top; color: var(--iw-text-2, #C8BFB0);
}
.iw-summary td:first-child {
  width: 35%; color: var(--iw-text-3, #8C8478); font-weight: 600;
  text-transform: uppercase; font-size: 10px; letter-spacing: 0.06em;
}

/* ── Checkout block ── */
.iw-checkout {
  border: 1px solid var(--iw-accent, var(--brand, #F26419));
  background: var(--iw-bg-3, #2C2920);
  padding: 20px; animation: iw-in 0.25s ease;
}
.iw-checkout-plan {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 18px;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--iw-text, #F0EBE0); margin-bottom: 4px;
}
.iw-checkout-price {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800; font-size: 28px;
  color: var(--iw-accent, var(--brand, #F26419));
  margin-bottom: 12px;
}
.iw-checkout-trial {
  font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600;
  background: var(--iw-accent, var(--brand, #F26419));
  color: #fff; padding: 3px 8px;
  text-transform: uppercase; letter-spacing: 0.04em;
  vertical-align: middle; margin-left: 8px;
}
.iw-checkout-desc {
  font-size: 13px; color: var(--iw-text-2, #C8BFB0);
  line-height: 1.6; margin-bottom: 16px;
}
.iw-checkout-btn {
  display: block; width: 100%; padding: 14px; text-align: center;
  background: var(--iw-accent, var(--brand, #F26419));
  color: #fff; font-size: 14px; font-weight: 700;
  font-family: 'DM Sans', sans-serif; letter-spacing: 0.02em;
  text-decoration: none; transition: background 0.15s;
  cursor: pointer; border: none;
}
.iw-checkout-btn:hover {
  background: var(--iw-accent-hover, #D95510);
}

/* ── Photo upload zone ── */
.iw-upload-zone {
  border: 2px dashed var(--iw-border-2, #504B3E);
  background: var(--iw-bg, #1C1A17);
  padding: 32px 20px; text-align: center;
  cursor: pointer; transition: all 0.15s;
  animation: iw-in 0.25s ease;
}
.iw-upload-zone:hover, .iw-upload-zone.iw-drag-over {
  border-color: var(--iw-accent, var(--brand, #F26419));
  background: rgba(242, 100, 25, 0.05);
}
.iw-upload-icon { color: var(--iw-text-3, #8C8478); margin-bottom: 8px; }
.iw-upload-zone:hover .iw-upload-icon,
.iw-upload-zone.iw-drag-over .iw-upload-icon {
  color: var(--iw-accent, var(--brand, #F26419));
}
.iw-upload-text {
  font-size: 13px; color: var(--iw-text-2, #C8BFB0); margin-bottom: 4px;
}
.iw-upload-link {
  color: var(--iw-accent, var(--brand, #F26419)); text-decoration: underline;
}
.iw-upload-hint { font-size: 11px; color: var(--iw-text-3, #8C8478); }
.iw-upload-size-req {
  font-size: 10px; color: var(--iw-accent, var(--brand, #F26419));
  margin-top: 4px; font-weight: 600; letter-spacing: 0.03em;
}

/* ── Photo previews ── */
.iw-upload-previews {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.iw-preview-item {
  position: relative; width: 88px;
  border: 1px solid var(--iw-border, #3E3A30); overflow: hidden;
  animation: iw-in 0.2s ease;
}
.iw-preview-item img {
  width: 100%; height: 68px; object-fit: cover; display: block;
}
.iw-preview-info { padding: 3px 5px; background: var(--iw-bg-3, #2C2920); }
.iw-preview-name {
  display: block; font-size: 8px; color: var(--iw-text-2, #C8BFB0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.iw-preview-dim {
  display: block; font-size: 8px; color: var(--iw-text-3, #8C8478);
  font-family: monospace;
}
.iw-preview-remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border: none;
  background: rgba(0,0,0,0.7); color: #fff;
  font-size: 12px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.iw-preview-remove:hover { background: #e74c3c; }

/* ── Upload warnings ── */
.iw-upload-warnings { margin-top: 8px; }
.iw-upload-warning {
  font-size: 11px; padding: 6px 10px; margin-bottom: 4px;
  display: flex; align-items: flex-start; gap: 6px; line-height: 1.4;
}
.iw-warn-error {
  background: rgba(231, 76, 60, 0.12); color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.3);
}
.iw-warn-soft {
  background: rgba(241, 196, 15, 0.1); color: #f1c40f;
  border: 1px solid rgba(241, 196, 15, 0.2);
}
.iw-warn-icon { flex-shrink: 0; }

/* ── Upload actions ── */
.iw-upload-actions {
  display: flex; justify-content: center; margin-top: 12px;
  animation: iw-in 0.2s ease;
}
.iw-upload-submit {
  padding: 11px 24px;
  background: var(--iw-accent, var(--brand, #F26419));
  border: none; color: #fff; font-size: 13px; font-weight: 700;
  font-family: 'DM Sans', sans-serif; cursor: pointer;
  transition: background 0.15s;
}
.iw-upload-submit:hover {
  background: var(--iw-accent-hover, #D95510);
}
.iw-uploading {
  font-size: 13px; color: var(--iw-text-3, #8C8478); padding: 11px;
}

/* ── Skip button ── */
.iw-skip-wrap { text-align: center; margin-top: 10px; }
.iw-skip-btn {
  background: none; border: none; color: var(--iw-text-3, #8C8478);
  font-size: 12px; font-family: 'DM Sans', sans-serif;
  cursor: pointer; text-decoration: underline;
  transition: color 0.15s;
}
.iw-skip-btn:hover { color: var(--iw-text-2, #C8BFB0); }

/* ── Animations ── */
@keyframes iw-dot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.4); }
}
@keyframes iw-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
