/* WinProposal App Styles - Matches landing page design tokens */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@400;500;600&display=swap');

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

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #1a1a26;
  --surface-3: #222233;
  --border: #2a2a3a;
  --border-hover: #3a3a4f;
  --text: #e8e8ef;
  --text-muted: #8888a0;
  --text-dim: #555570;
  --accent: #00d4aa;
  --accent-hover: #00eabb;
  --accent-glow: rgba(0, 212, 170, 0.15);
  --accent-glow-strong: rgba(0, 212, 170, 0.25);
  --warm: #ff6b4a;
  --warm-glow: rgba(255, 107, 74, 0.15);
  --yellow: #ffd93d;
  --yellow-glow: rgba(255, 217, 61, 0.15);
  --blue: #4d9fff;
  --blue-glow: rgba(77, 159, 255, 0.15);
  --red: #ff4d6a;
  --red-glow: rgba(255, 77, 106, 0.15);
  --green: #00d4aa;
  --green-glow: rgba(0, 212, 170, 0.15);
}

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.sidebar-logo span { color: var(--accent); }

.sidebar-nav {
  padding: 16px 0;
  list-style: none;
}

.sidebar-nav li {
  padding: 0;
}

.sidebar-nav a, .sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.sidebar-nav a:hover, .sidebar-nav button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.sidebar-nav a.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-right: 3px solid var(--accent);
}

.sidebar-nav .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-section {
  padding: 16px 24px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}

.sidebar-usage {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
}

.usage-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  margin: 8px 0;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

.usage-bar-fill.warning { background: var(--warm); }
.usage-bar-fill.danger { background: var(--red); }

.usage-text {
  font-size: 12px;
  color: var(--text-muted);
}

.usage-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.main-content {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  padding: 32px 40px;
}

/* Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

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

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface-2);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}

.btn-danger:hover {
  background: var(--red-glow);
}

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

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

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

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

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

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 600;
}

/* Stats Cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.stat-card-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-card-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Industry Grid */
.industry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.industry-option {
  padding: 16px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.industry-option:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.industry-option.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 20px var(--accent-glow);
}

.industry-option-name {
  font-size: 14px;
  font-weight: 600;
}

/* Proposal List */
.proposal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.proposal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.proposal-item:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.proposal-item-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.proposal-item-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

.proposal-item-score {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Win Score Gauge */
.win-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 16px;
}

.win-score.high { background: var(--green-glow); color: var(--green); border: 2px solid var(--green); }
.win-score.medium { background: var(--yellow-glow); color: var(--yellow); border: 2px solid var(--yellow); }
.win-score.low { background: var(--red-glow); color: var(--red); border: 2px solid var(--red); }

.win-score-lg {
  width: 120px;
  height: 120px;
  font-size: 36px;
  margin: 0 auto;
}

.win-score-label {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* Wizard Steps */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 40px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.wizard-step {
  flex: 1;
  padding: 16px 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  border-right: 1px solid var(--border);
  transition: all 0.3s;
}

.wizard-step:last-child { border-right: none; }

.wizard-step.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.wizard-step.completed {
  background: var(--surface-2);
  color: var(--text);
}

.wizard-step-num {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* Proposal Viewer */
.proposal-view {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

.proposal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
}

.proposal-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.proposal-content h1 { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 700; margin-bottom: 24px; letter-spacing: -0.5px; }
.proposal-content h2 { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 600; margin: 32px 0 16px; color: var(--accent); letter-spacing: -0.3px; }
.proposal-content h3 { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 600; margin: 24px 0 12px; }
.proposal-content p { margin-bottom: 12px; color: var(--text); line-height: 1.7; }
.proposal-content ul, .proposal-content ol { margin: 0 0 16px 24px; }
.proposal-content li { margin-bottom: 8px; line-height: 1.6; }
.proposal-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.proposal-content th, .proposal-content td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; font-size: 14px; }
.proposal-content th { background: var(--surface-2); font-weight: 600; }
.proposal-content strong { color: var(--accent); }
.proposal-content blockquote { border-left: 3px solid var(--accent); padding-left: 16px; margin: 16px 0; color: var(--text-muted); font-style: italic; }

/* Strengths/Risks Tags */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
}

.tag-green { background: var(--green-glow); color: var(--green); border: 1px solid rgba(0,212,170,0.3); }
.tag-red { background: var(--red-glow); color: var(--red); border: 1px solid rgba(255,77,106,0.3); }
.tag-blue { background: var(--blue-glow); color: var(--blue); border: 1px solid rgba(77,159,255,0.3); }
.tag-yellow { background: var(--yellow-glow); color: var(--yellow); border: 1px solid rgba(255,217,61,0.3); }

/* Section Actions */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-header h2 { margin: 0; }

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.loading-text {
  font-size: 16px;
  color: var(--text-muted);
}

.loading-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 40px;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
}

.empty-state-desc {
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto 24px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast.error { border-color: var(--red); color: var(--red); }
.toast.success { border-color: var(--accent); color: var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Auth Screen */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 40px;
}

.auth-logo span { color: var(--accent); }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
}

.auth-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
}

.auth-toggle {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-toggle a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.auth-toggle a:hover {
  text-decoration: underline;
}

/* Knowledge Base */
.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.kb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s;
}

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

.kb-card-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 8px;
}

.kb-card-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.kb-card-content {
  font-size: 13px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kb-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 24px;
}

/* Pricing Page */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  position: relative;
}

.pricing-card.featured {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(0,212,170,0.08) 0%, var(--surface) 100%);
}

.pricing-card.featured::before {
  content: 'MOST POPULAR';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 16px;
  border-radius: 100px;
}

.pricing-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.pricing-price {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 48px;
  font-weight: 700;
  margin: 16px 0 4px;
}

.pricing-card.featured .pricing-price { color: var(--accent); }

.pricing-period {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 24px;
}

.pricing-features li {
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pricing-features li::before {
  content: '✓';
  color: var(--accent);
  font-weight: 700;
}

/* Refine Panel */
.refine-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
}

/* Markdown preview helpers */
.md-content h1 { font-size: 24px; margin-bottom: 16px; }
.md-content h2 { font-size: 20px; margin: 24px 0 12px; color: var(--accent); }
.md-content h3 { font-size: 17px; margin: 20px 0 10px; }

/* Mobile */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 20px; }
  .proposal-view { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .wizard-steps { flex-direction: column; }
  .page-header { flex-direction: column; gap: 16px; align-items: flex-start; }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 99;
  }

  .mobile-menu-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
  }
}

@media (min-width: 769px) {
  .mobile-header { display: none; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pulse { animation: pulse 2s infinite; }
