/* ═══════════════════════════════════════
   WinBrief App — SPA Styles
   Extends theme.css variables
   ═══════════════════════════════════════ */

/* ── App Shell ── */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── App Header ── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 56px;
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.app-header .nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.app-header .brand-mark {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.app-header .brand-name {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
}

.app-header .brand-name .brand-dot { color: var(--accent); }

.app-header .nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-main {
  margin-top: 56px;
  flex: 1;
  padding: 40px 32px;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* ── Page Header ── */
.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 15px;
  color: var(--fg-muted);
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s;
}

.card:hover { border-color: var(--border-bright); }

.card-title {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 4px;
}

.card-meta {
  font-size: 13px;
  color: var(--fg-muted);
}

.card-body { margin-top: 12px; font-size: 14px; color: var(--fg-muted); }

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* ── RFP List ── */
.rfp-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rfp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.rfp-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.rfp-card-info { flex: 1; }

.rfp-card-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 4px;
}

.rfp-card-meta {
  font-size: 13px;
  color: var(--fg-muted);
}

.rfp-card-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.rfp-count-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}

.rfp-status-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rfp-status-badge.processing { background: rgba(96, 165, 250, 0.12); color: var(--ai-blue); }
.rfp-status-badge.complete { background: rgba(34, 197, 94, 0.12); color: var(--success); }
.rfp-status-badge.failed { background: rgba(239, 68, 68, 0.12); color: #ef4444; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.1s;
}

.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #0d0d0d;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--fg);
}

.btn-outline:hover { border-color: var(--fg-muted); }

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ── Forms ── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 12px 16px;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus,
.form-textarea:focus { border-color: var(--accent); }

.form-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border-bright);
  border-radius: 12px;
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  font-size: 40px;
  color: var(--accent);
  margin-bottom: 16px;
}

.upload-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 6px;
}

.upload-subtitle {
  font-size: 13px;
  color: var(--fg-muted);
}

.upload-file-name {
  margin-top: 16px;
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
}

/* ── Response Display ── */
.response-list { display: flex; flex-direction: column; gap: 20px; }

.response-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.response-question {
  padding: 14px 18px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 500;
}

.response-answer {
  padding: 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
}

.response-sources {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: rgba(245, 158, 11, 0.04);
}

.sources-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
}

/* ── Loading States ── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-bright);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--fg-muted);
  font-size: 14px;
  gap: 10px;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 32px;
}

.empty-icon {
  font-size: 48px;
  color: var(--fg-dim);
  margin-bottom: 16px;
}

.empty-title {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.empty-subtitle {
  font-size: 14px;
  color: var(--fg-dim);
  margin-bottom: 24px;
}

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Error / Success Messages ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

/* ── Question Form ── */
.question-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
}

.question-form textarea {
  min-height: 80px;
  margin-bottom: 12px;
}

.questions-hint {
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 12px;
}

/* ── RFP Detail Meta ── */
.rfp-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.rfp-meta-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

.rfp-meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

.rfp-meta-value {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
}

/* ── Back Link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: none;
  margin-bottom: 20px;
  transition: color 0.2s;
}

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

/* ── Question History (compact) ── */
.question-history-list { display: flex; flex-direction: column; gap: 8px; }

.question-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--fg-muted);
}

.question-history-item .qi-num {
  color: var(--accent);
  font-weight: 500;
  min-width: 20px;
}

/* ── Progress Bar ── */
.progress-bar-wrap {
  background: var(--bg-elevated);
  border-radius: 20px;
  height: 4px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 20px;
  transition: width 0.3s;
  animation: progress-pulse 1.5s ease-in-out infinite;
  width: 70%;
}

@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}