/* ============ DASHBOARD SHELL ============ */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo {
  text-decoration: none;
  color: var(--fg);
}

.sidebar-nav {
  padding: 16px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.nav-item:hover,
.nav-item.active {
  background: var(--bg-card);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.nav-icon {
  font-size: 16px;
  line-height: 1;
}

.sidebar-history {
  padding: 16px 12px;
  flex: 1;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--fg-dim);
  padding: 0 4px;
  margin-bottom: 10px;
}

.sidebar-empty {
  font-size: 13px;
  color: var(--fg-dim);
  padding: 8px 4px;
}

.history-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.history-item:hover {
  background: var(--bg-card);
  border-color: var(--border);
}

.history-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-geo {
  font-size: 12px;
  color: var(--fg-dim);
}

/* Status dots */
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.status-pending { background: var(--fg-dim); }
.status-dot.status-processing { background: #f59e0b; animation: pulse 1.5s infinite; }
.status-dot.status-complete { background: #10b981; }
.status-dot.status-error { background: #ef4444; }
.status-dot.status-empty { background: var(--fg-dim); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ICP summary (sidebar on results page) */
.icp-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.icp-summary-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.icp-summary-row:last-child {
  border-bottom: none;
}

.icp-label {
  color: var(--fg-dim);
  min-width: 48px;
  font-weight: 500;
}

.run-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 4px;
}

.run-status.status-processing { color: #f59e0b; }
.run-status.status-complete { color: #10b981; }
.run-status.status-error { color: #ef4444; }

/* ============ MAIN CONTENT ============ */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============ PAGE HEADER (dashboard) ============ */
.page-header {
  background: radial-gradient(ellipse 80% 60% at 50% -20%, var(--accent-glow), transparent);
  border-bottom: 1px solid var(--border);
  padding: 60px 48px 48px;
}

.page-header-inner {
  max-width: 680px;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1.5px;
  color: var(--fg);
  margin: 16px 0 16px;
}

.accent-text {
  color: var(--accent);
}

.page-subtitle {
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg-muted);
  max-width: 520px;
  font-weight: 300;
}

/* ============ ICP FORM ============ */
.form-section {
  padding: 40px 48px;
  flex: 1;
}

.form-card {
  max-width: 800px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
}

.form-card-header {
  margin-bottom: 32px;
}

.form-card-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.form-card-header p {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.6;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0.3px;
}

.form-group .optional {
  color: var(--fg-dim);
  font-weight: 400;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a5860' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-dim);
  background: var(--bg-elevated);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--fg-dim);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.form-note {
  font-size: 13px;
  color: var(--fg-dim);
  line-height: 1.5;
  max-width: 380px;
}

/* ============ BUTTONS ============ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--accent);
  color: #0a0a0f;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.loading {
  opacity: 0.7;
  cursor: wait;
}

/* Landing page CTA button */
.btn-primary-landing {
  display: inline-block;
  padding: 16px 36px;
  background: var(--accent);
  color: #0a0a0f;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s;
  margin-top: 36px;
}

.btn-primary-landing:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.hero-cta {
  margin-top: 8px;
}

/* ============ RESULTS HEADER ============ */
.results-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 32px 48px;
}

.results-header-inner {
  max-width: 900px;
}

.back-link {
  font-size: 13px;
  color: var(--fg-dim);
  text-decoration: none;
  font-weight: 500;
  display: inline-block;
  margin-bottom: 16px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--fg-muted);
}

.results-title-row {
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
}

.results-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--fg);
}

.results-icp-pill {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  color: var(--fg-muted);
  white-space: nowrap;
}

/* ============ LOADING STATE ============ */
.loading-state {
  padding: 60px 48px;
  max-width: 600px;
}

.loading-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px;
  text-align: center;
}

.loading-animation {
  margin-bottom: 32px;
}

.loading-pulse {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  background: var(--accent-glow);
  border: 2px solid rgba(212, 160, 83, 0.4);
  border-radius: 50%;
  animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; border-color: rgba(212,160,83,0.4); }
  50% { transform: scale(1.15); opacity: 1; border-color: rgba(212,160,83,0.8); }
}

.loading-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 12px;
}

.loading-card p {
  font-size: 15px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.loading-step {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--fg-dim);
  transition: all 0.5s ease;
}

.loading-step.active {
  background: var(--accent-glow);
  border-color: rgba(212, 160, 83, 0.3);
  color: var(--fg);
}

/* ============ ERROR STATE ============ */
.error-state {
  padding: 60px 48px;
  max-width: 500px;
}

.error-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px;
  text-align: center;
}

.error-icon {
  font-size: 40px;
  margin-bottom: 20px;
  line-height: 1;
}

.error-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 12px;
}

.error-card p {
  font-size: 15px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ============ PROSPECT CARDS ============ */
.prospects-list {
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 900px;
}

.prospect-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  transition: border-color 0.2s;
}

.prospect-card:hover {
  border-color: rgba(212, 160, 83, 0.25);
}

.prospect-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 16px;
}

.prospect-company-info {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.prospect-index {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--fg-dim);
  line-height: 1;
  min-width: 40px;
  padding-top: 2px;
}

.prospect-company-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.company-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.company-link:hover {
  color: var(--accent);
}

.prospect-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  color: var(--fg-muted);
}

.prospect-contact {
  text-align: right;
  flex-shrink: 0;
}

.contact-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

.contact-title {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.linkedin-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.linkedin-link:hover {
  text-decoration: underline;
}

.prospect-description {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  padding-left: 56px;
}

.why-fit {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  margin-bottom: 20px;
  margin-left: 56px;
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.why-fit-label {
  color: #10b981;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============ EMAIL DRAFT ============ */
.email-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 20px;
}

.email-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(212, 160, 83, 0.04);
}

.email-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.3px;
}

.copy-btn {
  padding: 5px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  border-color: var(--accent-dim);
  color: var(--fg);
}

.copy-btn.copied {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.email-body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
  white-space: pre-wrap;
  font-family: var(--font-body);
}

/* ============ ENRICHMENT SIGNALS ============ */
.enrichment-signals {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.signal-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex: 1;
  min-width: 200px;
}

.signal-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.signal-value {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
    min-width: 220px;
  }

  .page-header,
  .form-section,
  .prospects-list,
  .loading-state,
  .error-state,
  .results-header {
    padding-left: 32px;
    padding-right: 32px;
  }
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-history {
    display: none;
  }

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

  .page-header,
  .form-section,
  .prospects-list,
  .loading-state,
  .error-state,
  .results-header {
    padding-left: 20px;
    padding-right: 20px;
  }

  .prospect-card {
    padding: 20px;
  }

  .prospect-card-header {
    flex-direction: column;
  }

  .prospect-contact {
    text-align: left;
  }

  .prospect-description,
  .why-fit {
    padding-left: 0;
    margin-left: 0;
  }

  .results-title-row {
    flex-direction: column;
    gap: 10px;
  }

  .form-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}
