/* ============================================================
   SOCIAL SALES STRATEGY — App Dashboard CSS
   Design system: Maroon primary, Gold secondary, Teal tertiary
   ============================================================ */
:root {
  --maroon: #7B2D3B;
  --maroon-light: #F5E6E9;
  --gold: #D4AF37;
  --gold-light: #FBF5E5;
  --teal: #2A7D7B;
  --teal-light: #E6F4F4;
  --bg: #FAFAF8;
  --white: #FFFFFF;
  --text-dark: #1A1A1A;
  --text: #2D2D2D;
  --text-muted: #777;
  --border: #E8E5E0;
  --border-focus: #D4AF37;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --radius: 14px;
  --radius-sm: 10px;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Nav ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--white); border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 900px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-size: 16px; font-weight: 800; color: var(--text-dark);
  text-decoration: none; letter-spacing: -0.3px;
}
.nav-links { display: flex; gap: 20px; }
.nav-link {
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  text-decoration: none; transition: color var(--transition);
}
.nav-link:hover { color: var(--text-dark); }
.nav-link--active { color: var(--maroon); font-weight: 700; }

/* ── Screens ── */
.screen { display: none; min-height: calc(100vh - 60px); }
.screen--active { display: flex; align-items: center; justify-content: center; }

/* ── Loading ── */
.loading-wrap { text-align: center; padding: 40px; }
.loading-spinner {
  width: 40px; height: 40px; margin: 0 auto 16px;
  border: 3px solid var(--border); border-top-color: var(--maroon);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.loading-spinner--large { width: 56px; height: 56px; border-width: 4px; }
.loading-text { font-size: 15px; color: var(--text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards ── */
.card {
  background: var(--white); border-radius: var(--radius); padding: 36px 28px;
  box-shadow: var(--shadow); width: 100%; margin: 20px;
}
.card--narrow { max-width: 420px; }
.card--wide { max-width: 600px; }
.card-title { font-size: 22px; font-weight: 800; color: var(--text-dark); margin-bottom: 8px; }
.card-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.card-footer { font-size: 13px; color: var(--text-muted); margin-top: 20px; text-align: center; }
.card-footer a { color: var(--gold); text-decoration: none; font-weight: 600; }

/* ── Form fields ── */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-dark); margin-bottom: 5px;
}
.field input, .field textarea {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; outline: none;
  transition: border var(--transition); background: var(--white);
}
.field input:focus, .field textarea:focus { border-color: var(--border-focus); }

.auth-error { font-size: 13px; color: #E53E3E; margin-top: 12px; text-align: center; min-height: 18px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700; font-family: inherit;
  cursor: pointer; border: 2px solid transparent;
  transition: all var(--transition); text-decoration: none;
}
.btn--gold { background: var(--maroon); color: #fff; }
.btn--gold:hover { background: #6B2433; }
.btn--outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn--outline:hover { border-color: var(--text-muted); }
.btn--full { width: 100%; }
.btn--large { padding: 16px 28px; font-size: 16px; }
.btn--small { padding: 8px 16px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Diagnosis Dashboard ── */
.dash-wrap {
  max-width: 560px; width: 100%; margin: 0 auto; padding: 32px 20px;
}
.screen#screen-diagnosis { align-items: flex-start; }

.dash-header { text-align: center; margin-bottom: 28px; }
.dash-greeting {
  font-size: 14px; font-weight: 600; color: var(--teal);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px;
}
.score-circle {
  width: 120px; height: 120px; border-radius: 50%;
  border: 4px solid var(--border); margin: 0 auto 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: border-color 0.5s ease;
}
.score-num { font-size: 42px; font-weight: 900; line-height: 1; color: var(--text-dark); }
.score-of { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.score-label { font-size: 15px; color: var(--text-muted); font-weight: 500; }

.dash-bars { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.bar-row { display: flex; flex-direction: column; gap: 4px; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.bar-score { font-weight: 700; }
.bar-track {
  height: 8px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 4px; width: 0;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.bar-problem { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.dash-assessment {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  font-size: 14px; line-height: 1.7; margin-bottom: 28px;
}

.dash-cta { text-align: center; }
.dash-cta-text { font-size: 15px; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.dash-cta-note { font-size: 13px; color: var(--text-muted); margin-top: 10px; }

/* ── Gap Questions ── */
.gaps-wrap {
  max-width: 520px; width: 100%; margin: 0 auto; padding: 32px 20px;
}
.screen#screen-gaps { align-items: flex-start; padding-top: 40px; }

.gaps-progress {
  height: 4px; background: var(--border); border-radius: 2px;
  margin-bottom: 32px; overflow: hidden;
}
.gaps-progress-fill {
  height: 100%; background: var(--gold); border-radius: 2px;
  transition: width 0.4s ease; width: 0;
}

.gaps-question {
  font-size: 20px; font-weight: 700; color: var(--text-dark);
  line-height: 1.4; margin-bottom: 8px;
}
.gaps-tip {
  font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5;
}

.gaps-textarea {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 15px; font-family: inherit; line-height: 1.6;
  resize: vertical; min-height: 100px; outline: none;
  transition: border var(--transition);
}
.gaps-textarea:focus { border-color: var(--border-focus); }

/* IG handle input override */
.gaps-input-short {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 15px; font-family: inherit; outline: none;
  transition: border var(--transition);
}
.gaps-input-short:focus { border-color: var(--border-focus); }

.gaps-options {
  display: flex; flex-direction: column; gap: 10px; margin-top: 16px;
}
.gaps-option {
  display: block; width: 100%; text-align: left;
  padding: 14px 16px; background: var(--white);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 15px; font-family: inherit; cursor: pointer;
  transition: all var(--transition);
}
.gaps-option:hover { border-color: var(--maroon); background: var(--maroon-light); }
.gaps-option.selected { border-color: var(--maroon); background: var(--maroon-light); font-weight: 600; color: var(--maroon); }

.gaps-actions {
  display: flex; gap: 12px; margin-top: 24px;
}
.gaps-actions .btn { flex: 1; }

/* ── Chat ── */
.chat-wrap {
  max-width: 640px; width: 100%; margin: 0 auto;
  display: flex; flex-direction: column; height: calc(100vh - 60px);
}
.screen#screen-chat { align-items: stretch; }

.chat-progress {
  height: 3px; background: var(--border); flex-shrink: 0;
}
.chat-progress-fill {
  height: 100%; background: var(--gold); width: 0;
  transition: width 0.4s ease;
}

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}

.msg {
  max-width: 85%; padding: 14px 18px;
  border-radius: 18px; font-size: 15px; line-height: 1.6;
  animation: msgIn 0.25s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg--ai {
  background: var(--white); border: 1px solid var(--border);
  border-bottom-left-radius: 4px; align-self: flex-start;
}
.msg--user {
  background: var(--maroon); color: #fff;
  border-bottom-right-radius: 4px; align-self: flex-end;
}
.msg--system {
  background: var(--gold-light); border: 1px solid #E8D9A0;
  align-self: center; text-align: center;
  font-size: 13px; color: var(--text-muted); max-width: 90%;
}
.msg--ai strong { color: var(--maroon); }
.msg--ai em { color: var(--teal); }

.chat-options {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.chat-option {
  padding: 8px 16px; background: var(--gold-light);
  border: 1.5px solid #E8D9A0; border-radius: 20px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all var(--transition);
}
.chat-option:hover { border-color: var(--maroon); background: var(--maroon-light); color: var(--maroon); }

.typing-indicator {
  display: flex; gap: 4px; padding: 14px 18px; align-self: flex-start;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 18px; border-bottom-left-radius: 4px;
}
.typing-dot {
  width: 8px; height: 8px; background: var(--text-muted);
  border-radius: 50%; animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-input-bar {
  display: flex; gap: 10px; padding: 12px 20px;
  border-top: 1px solid var(--border); background: var(--white);
  flex-shrink: 0;
}
.chat-textarea {
  flex: 1; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 20px;
  font-size: 15px; font-family: inherit; outline: none;
  resize: none; max-height: 120px; line-height: 1.5;
  transition: border var(--transition);
}
.chat-textarea:focus { border-color: var(--border-focus); }
.chat-send {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--maroon); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; transition: background var(--transition);
  flex-shrink: 0;
}
.chat-send:hover { background: #6B2433; }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Confirmation ── */
.confirm-summary {
  background: var(--bg); border-radius: var(--radius);
  padding: 20px; font-size: 14px; line-height: 1.7;
  margin-bottom: 24px;
}
.confirm-summary strong { color: var(--maroon); }
.confirm-actions { display: flex; flex-direction: column; gap: 10px; }

/* ── Generating ── */
.gen-wrap { text-align: center; padding: 40px 20px; max-width: 400px; }
.gen-icon { margin-bottom: 24px; }
.gen-title { font-size: 22px; font-weight: 800; color: var(--text-dark); margin-bottom: 8px; }
.gen-step { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.gen-steps { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.gen-step-item {
  font-size: 13px; color: var(--text-muted); padding: 8px 12px;
  border-radius: var(--radius-sm); transition: all 0.3s ease;
}
.gen-step-item.active { color: var(--gold); font-weight: 700; }
.gen-step-item.done { color: var(--teal); }
.gen-step-item.done::before { content: '\2713  '; }

/* ── Plan Dashboard ── */
.plan-wrap {
  max-width: 720px; width: 100%; margin: 0 auto; padding: 24px 20px;
}
.screen#screen-plan { align-items: flex-start; }

.plan-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.plan-title { font-size: 22px; font-weight: 800; color: var(--text-dark); }
.plan-header-actions { display: flex; gap: 8px; }

.plan-tabs {
  display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px;
  margin-bottom: 20px; border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.plan-tab {
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); background: none; border: none;
  border-bottom: 2px solid transparent; cursor: pointer;
  white-space: nowrap; font-family: inherit;
  transition: all var(--transition);
}
.plan-tab:hover { color: var(--text-dark); }
.plan-tab--active { color: var(--maroon); border-bottom-color: var(--maroon); }

.plan-section { display: none; animation: fadeIn 0.3s ease; }
.plan-section--active { display: block; }
.plan-section h2 { font-size: 20px; font-weight: 800; color: var(--text-dark); margin-bottom: 12px; }
.plan-section h3 { font-size: 16px; font-weight: 700; color: var(--maroon); margin: 20px 0 8px; }
.plan-section p { font-size: 14px; line-height: 1.7; margin-bottom: 12px; }
.plan-section ul, .plan-section ol { margin: 8px 0 16px 20px; font-size: 14px; line-height: 1.7; }
.plan-section blockquote {
  border-left: 3px solid var(--gold); padding: 12px 16px;
  background: var(--gold-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px; margin: 12px 0;
}

/* Content blocks */
.content-block {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.content-block-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.content-block-title { font-size: 15px; font-weight: 700; color: var(--maroon); }

.copy-btn {
  padding: 4px 12px; font-size: 11px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
}
.copy-btn:hover { border-color: var(--gold); }
.copy-btn.copied { background: var(--teal-light); border-color: var(--teal); color: var(--teal); }

/* Collapsible prompt */
.collapsible-toggle {
  font-size: 12px; color: var(--gold); cursor: pointer;
  background: none; border: none; font-family: inherit; font-weight: 600;
  margin-top: 8px;
}
.collapsible-content {
  display: none; margin-top: 8px; padding: 12px;
  background: var(--bg); border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.6; color: var(--text-muted);
}
.collapsible-content.open { display: block; }

.plan-footer { text-align: center; padding: 32px 0 16px; font-size: 12px; color: #AAA; }

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

/* ── Responsive ── */
@media (max-width: 600px) {
  .nav-links { gap: 14px; }
  .nav-link { font-size: 12px; }
  .card { padding: 28px 20px; margin: 12px; }
  .plan-header { flex-direction: column; align-items: flex-start; }
  .plan-tabs { gap: 0; }
  .plan-tab { padding: 10px 12px; font-size: 12px; }
  .msg { max-width: 90%; }
  .score-circle { width: 100px; height: 100px; }
  .score-num { font-size: 36px; }
}
