/* ── ASSESSMENT CHAT WIDGET ── */

.as-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(10, 15, 46, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: asFadeIn 0.2s ease;
}

.as-overlay.as-hidden { display: none; }

@keyframes asFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes asSlideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes asSpin { to { transform: rotate(360deg); } }
@keyframes asStepFade { from { opacity: 0.3; } to { opacity: 1; } }

/* ── Modal Shell ── */
.as-modal {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: asSlideUp 0.25s ease;
  box-shadow: 0 32px 80px rgba(10, 15, 46, 0.5);
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}

.as-modal::-webkit-scrollbar { width: 5px; }
.as-modal::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

/* ── Modal Top Bar ── */
.as-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-radius: 20px 20px 0 0;
}

.as-modal-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0a0f2e;
  letter-spacing: -0.2px;
}

.as-modal-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
}

.as-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}

.as-close-btn:hover { background: #e2e8f0; color: #0f172a; }

/* ── Progress Bar ── */
.as-progress-wrap {
  padding: 0.75rem 1.25rem 0;
  background: #fff;
  position: sticky;
  top: 52px;
  z-index: 1;
}

.as-progress-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.4rem;
  letter-spacing: 0.3px;
}

.as-progress-track {
  height: 4px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}

.as-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1d4ed8, #7c3aed);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ── Content Screens ── */
.as-screen { padding: 1.5rem 1.5rem 2rem; }

.as-screen.as-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  min-height: 320px;
  justify-content: center;
}

/* ── Badges ── */
.as-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(29, 78, 216, 0.08);
  color: #1d4ed8;
  border: 1px solid rgba(29, 78, 216, 0.2);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.9rem;
  border-radius: 100px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.as-badge-returning {
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.2);
}

/* ── Typography ── */
.as-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  letter-spacing: -0.4px;
  margin-bottom: 0.5rem;
}

.as-subtitle {
  font-size: 0.95rem;
  color: #64748b;
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.as-question {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  letter-spacing: -0.3px;
  margin-bottom: 1.25rem;
}

.as-q-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

/* ── Welcome Features ── */
.as-welcome-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}

.as-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}

.as-feature span { color: #1d4ed8; font-size: 0.65rem; }

.as-time-note {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 0.75rem;
  text-align: center;
}

/* ── Options Grid ── */
.as-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.as-option-btn {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  line-height: 1.35;
  font-family: inherit;
}

.as-option-btn:hover:not(:disabled) {
  border-color: #1d4ed8;
  background: #eff6ff;
  color: #1d4ed8;
}

.as-option-btn.selected {
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
  color: #fff;
  font-weight: 600;
}

.as-option-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Buttons ── */
.as-btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
  color: #fff;
  border: none;
  padding: 0.85rem 1.75rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(29, 78, 216, 0.3);
  width: 100%;
  text-align: center;
}

.as-btn-primary:hover:not(:disabled) { opacity: 0.92; transform: translateY(-1px); }
.as-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.as-btn-secondary {
  display: inline-block;
  background: transparent;
  color: #334155;
  border: 1.5px solid #e2e8f0;
  padding: 0.85rem 1.75rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  width: 100%;
  text-align: center;
}

.as-btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }

.as-start-btn { margin-top: 0.5rem; }

/* ── Spinner ── */
.as-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: #1d4ed8;
  border-radius: 50%;
  animation: asSpin 0.8s linear infinite;
  margin: 0 auto 0.75rem;
}

.as-spinner-large { width: 52px; height: 52px; border-width: 4px; }

.as-loading-text { font-size: 0.9rem; color: #64748b; }

/* ── Generating Steps ── */
.as-generating-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.as-generating-sub {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 1.5rem;
}

.as-generating-steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
  width: 100%;
  max-width: 320px;
}

.as-gen-step {
  font-size: 0.85rem;
  color: #94a3b8;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: #f8fafc;
  border-left: 3px solid #e2e8f0;
  transition: all 0.3s;
}

.as-gen-step.active {
  color: #1d4ed8;
  background: #eff6ff;
  border-left-color: #1d4ed8;
  font-weight: 600;
  animation: asStepFade 0.3s ease;
}

/* ── Returning User Screen ── */
.as-returning-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.as-returning-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s;
  width: 100%;
}

.as-returning-btn:hover {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.as-ret-icon { font-size: 1.5rem; flex-shrink: 0; }

.as-returning-btn span strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}

.as-returning-btn span small {
  font-size: 0.8rem;
  color: #64748b;
}

/* ── Limit Reached Screen ── */
.as-limit-icon { font-size: 3rem; margin-bottom: 0.25rem; }

.as-limit-benefits {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.75rem 0 1.25rem;
  text-align: left;
  width: 100%;
  max-width: 320px;
}

.as-benefit {
  font-size: 0.88rem;
  color: #334155;
  font-weight: 500;
  padding: 0.4rem 0;
}

/* ── Results ── */
.as-readonly-banner {
  background: linear-gradient(135deg, #7c3aed, #1d4ed8);
  color: #fff;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 0.5rem;
  margin: -1.5rem -1.5rem 1.25rem;
  border-radius: 0;
}

.as-score-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.as-score-ring {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 5px solid var(--score-color, #3b82f6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.as-score-num {
  font-size: 1.6rem;
  font-weight: 900;
  color: #0f172a;
  line-height: 1;
}

.as-score-denom {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 600;
}

.as-score-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}

.as-score-label {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.as-score-desc {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.5;
}

/* Result Cards */
.as-result-card {
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.75rem;
  background: #fff;
}

.as-result-card-highlight {
  border-color: rgba(29, 78, 216, 0.2);
  background: #eff6ff;
}

.as-result-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.as-result-icon { font-size: 1rem; }

.as-result-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
}

.as-result-card-body {
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.65;
}

.as-solution-badge {
  display: inline-block;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.5rem 1.25rem;
  border-radius: 100px;
}

/* 30-Day Plan */
.as-plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.65rem;
}

.as-plan-phase {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 0.85rem;
}

.as-plan-phase-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 0.4rem;
}

.as-plan-phase p {
  font-size: 0.82rem;
  color: #334155;
  line-height: 1.55;
}

/* Prompt Box */
.as-prompt-box {
  background: #0f172a;
  border-radius: 10px;
  padding: 1rem;
  position: relative;
}

.as-prompt-box pre {
  font-size: 0.82rem;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Courier New', monospace;
  line-height: 1.6;
  margin: 0;
  padding-right: 3rem;
}

.as-copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.as-copy-btn:hover { background: rgba(255, 255, 255, 0.2); }

/* CTA Section */
.as-cta-section {
  background: linear-gradient(135deg, #0a0f2e, #0f1a4a);
  border-radius: 14px;
  padding: 1.75rem;
  margin-top: 1rem;
  text-align: center;
}

.as-cta-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.4rem;
  letter-spacing: -0.3px;
}

.as-cta-sub {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 1.25rem;
  line-height: 1.55;
}

.as-cta-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.as-cta-section .as-btn-secondary {
  color: rgba(255, 255, 255, 0.75);
  border-color: rgba(255, 255, 255, 0.2);
}

.as-cta-section .as-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

/* Email Form */
.as-form { display: flex; flex-direction: column; gap: 0.75rem; }

.as-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.as-field { display: flex; flex-direction: column; gap: 0.35rem; }

.as-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.as-optional { font-weight: 400; color: #94a3b8; }

.as-input {
  padding: 0.7rem 0.9rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
}

.as-input:focus { border-color: #1d4ed8; }
.as-input::placeholder { color: #94a3b8; }

.as-consent-text {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.55;
  padding: 0.5rem 0;
}

/* Thank You */
.as-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

/* Error state */
.as-error-icon { font-size: 2.5rem; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .as-overlay { padding: 0; align-items: flex-end; }

  .as-modal {
    max-height: 95vh;
    border-radius: 20px 20px 0 0;
  }

  .as-options { grid-template-columns: 1fr; }

  .as-plan-grid { grid-template-columns: 1fr; }

  .as-form-grid { grid-template-columns: 1fr; }

  .as-score-section { flex-direction: column; text-align: center; }

  .as-welcome-features { grid-template-columns: 1fr; }

  .as-title { font-size: 1.25rem; }
}
