/* ================================================================
   brief.css — Brief submission page styles
   Follows the dark design system (tokens.css + booking-flow.css patterns)
   ================================================================ */

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

@keyframes spinRing {
  to { transform: rotate(360deg); }
}

/* ── Page shell ─────────────────────────────────────────────────── */
#brief-app {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(24px, 2.8vw, 56px) 24px clamp(64px, 6.9vw, 160px);
  min-height: calc(100vh - 60px);
}

#brief-app.is-success {
  max-width: 960px;
  padding-left: 0;
  padding-right: 0;
}

/* ── State screens ──────────────────────────────────────────────── */
#brief-loading:not([hidden]),
#brief-error:not([hidden]),
#brief-already-done:not([hidden]),
#brief-form-wrap:not([hidden]),
#brief-success:not([hidden]) {
  animation: briefIn 0.25s ease both;
}

#brief-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  gap: 18px;
}

.brief-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(46, 247, 199, 0.18);
  border-top-color: var(--aqua);
  animation: spinRing 0.75s linear infinite;
}

.brief-spinner-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Error / already-done state cards ───────────────────────────── */
.brief-state-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  text-align: center;
  max-width: 520px;
  margin: 60px auto 0;
}

.brief-state-card.is-error {
  background: rgba(254, 95, 85, 0.05);
  border-color: rgba(254, 95, 85, 0.25);
}

.brief-state-card.is-done {
  background: rgba(46, 247, 199, 0.04);
  border-color: rgba(46, 247, 199, 0.2);
}

.brief-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 22px;
}

.is-error .brief-state-icon {
  background: rgba(254, 95, 85, 0.1);
  border: 1.5px solid rgba(254, 95, 85, 0.3);
}

.is-done .brief-state-icon {
  background: rgba(46, 247, 199, 0.1);
  border: 1.5px solid rgba(46, 247, 199, 0.3);
}

.brief-state-heading {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 0 0 10px;
}

.brief-state-body {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 24px;
}

.brief-state-link {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--aqua);
  text-decoration: none;
  padding: 9px 18px;
  border: 1px solid rgba(46, 247, 199, 0.3);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  transition: background 0.15s, border-color 0.15s;
}

.brief-state-link:hover {
  background: rgba(46, 247, 199, 0.08);
  border-color: rgba(46, 247, 199, 0.5);
}

/* ── Form heading area ──────────────────────────────────────────── */
.brief-header {
  margin-bottom: 32px;
}

.brief-eyebrow {
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(46, 247, 199, 0.75);
  margin-bottom: 8px;
}

.brief-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin: 0 0 8px;
  line-height: 1.1;
}

.brief-lede {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

.brief-context-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 12px;
}

.brief-context-bar span {
  color: var(--fg);
}

/* ── Form card ──────────────────────────────────────────────────── */
.brief-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 14px;
}

.brief-card-label {
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 10px;
}

.brief-card-question {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  color: var(--fg);
  margin: 0 0 6px;
}

.brief-card-hint {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 16px;
}

/* ── Radio choice group (visual direction) ──────────────────────── */
.brief-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brief-radio-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.brief-radio-item:hover {
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.04);
}

.brief-radio-item.selected {
  border-color: rgba(46, 247, 199, 0.45);
  background: rgba(46, 247, 199, 0.06);
}

.brief-radio-pip {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brief-radio-item.selected .brief-radio-pip {
  border: 4px solid var(--aqua);
  background: rgba(46, 247, 199, 0.1);
}

.brief-radio-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: rgba(243, 244, 248, 0.7);
  transition: color 0.15s;
}

.brief-radio-item.selected .brief-radio-label {
  color: var(--fg);
}

/* ── Checkbox group (commercial goals) ──────────────────────────── */
.brief-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brief-checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--font-body);
  font-size: 13px;
  color: rgba(243, 244, 248, 0.55);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}

.brief-checkbox-pill:hover {
  border-color: var(--line-2);
  color: var(--fg);
}

.brief-checkbox-pill.selected {
  border-color: rgba(46, 247, 199, 0.45);
  background: rgba(46, 247, 199, 0.09);
  color: var(--aqua);
}

.brief-checkbox-tick {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--line-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  font-size: 9px;
  font-weight: 700;
  color: var(--ink);
}

.brief-checkbox-pill.selected .brief-checkbox-tick {
  background: var(--aqua);
  border-color: var(--aqua);
}

.brief-checkbox-pill.selected .brief-checkbox-tick::after {
  content: '✓';
}

/* ── Textarea fields ────────────────────────────────────────────── */
.brief-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 300;
  color: var(--fg);
  line-height: 1.6;
  resize: vertical;
  min-height: 100px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.brief-textarea:focus {
  border-color: rgba(46, 247, 199, 0.4);
}

.brief-textarea::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

.brief-textarea.error {
  border-color: rgba(254, 95, 85, 0.5);
}

/* ── File upload ────────────────────────────────────────────────── */
.brief-file-drop {
  border: 1.5px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.brief-file-drop:hover,
.brief-file-drop.drag-over {
  border-color: rgba(46, 247, 199, 0.4);
  background: rgba(46, 247, 199, 0.04);
}

.brief-file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.brief-file-drop-icon {
  font-size: 24px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.brief-file-drop-label {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 13px;
  color: rgba(243, 244, 248, 0.6);
  margin-bottom: 4px;
}

.brief-file-drop-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* File selected state */
.brief-file-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(46, 247, 199, 0.06);
  border: 1px solid rgba(46, 247, 199, 0.25);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 10px;
}

.brief-file-selected-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--aqua);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brief-file-clear {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.brief-file-clear:hover { color: var(--bittersweet); }

/* File error */
.brief-file-error {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bittersweet);
  margin-top: 8px;
  display: none;
}

.brief-file-error.visible { display: block; }

/* File upload progress */
.brief-upload-progress {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
  display: none;
}

.brief-upload-progress.visible { display: block; }

.brief-upload-progress-bar {
  height: 100%;
  background: var(--aqua);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 2px;
}

/* ── Field error text ───────────────────────────────────────────── */
.brief-field-error {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bittersweet);
  margin-top: 8px;
  display: none;
}

.brief-field-error.visible { display: block; }

/* ── Error banner ───────────────────────────────────────────────── */
.brief-error-banner {
  background: rgba(254, 95, 85, 0.08);
  border: 1px solid rgba(254, 95, 85, 0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  color: rgba(254, 95, 85, 0.85);
  margin-bottom: 14px;
  display: none;
}

.brief-error-banner.visible { display: block; }

/* ── Submit button ──────────────────────────────────────────────── */
.brief-submit-btn {
  background: var(--aqua);
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  border: none;
  border-radius: var(--radius);
  padding: 15px 32px;
  cursor: pointer;
  width: 100%;
  transition: filter 0.12s ease, transform 0.1s ease, opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.brief-submit-btn:hover:not(:disabled) { filter: brightness(1.08); }
.brief-submit-btn:active:not(:disabled) { transform: scale(0.98); }

.brief-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.brief-submit-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(6, 9, 32, 0.3);
  border-top-color: var(--ink);
  animation: spinRing 0.65s linear infinite;
  display: none;
  flex-shrink: 0;
}

.brief-submit-btn.loading .brief-submit-spinner { display: block; }
.brief-submit-btn.loading .brief-submit-label::after { content: '…'; }

/* ── Success screen ─────────────────────────────────────────────── */
#brief-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(44px, 4.4vw, 96px) 24px clamp(56px, 5.6vw, 120px);
  max-width: 540px;
  margin: 0 auto;
}

.brief-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1.5px solid rgba(46, 247, 199, 0.35);
  background: rgba(46, 247, 199, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  font-size: 28px;
}

.brief-success-heading {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin: 0 0 12px;
}

.brief-success-sub {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 36px;
  max-width: 46ch;
}

.brief-success-next {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: left;
  margin-bottom: 12px;
}

.brief-success-next p {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin: 4px 0 0;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
  #brief-app {
    padding: 24px 16px 80px;
  }

  .brief-title { font-size: 22px; }

  .brief-state-card {
    padding: 28px 20px;
  }

  .brief-radio-group { gap: 6px; }

  /* Touch target minimums (44px) */
  .brief-radio-item { min-height: 44px; }
  .brief-checkbox-pill { min-height: 44px; }
  .brief-submit-btn { min-height: 44px; }
}
