/* ===== APP SHELL ===== */
.app-body {
  min-height: 100vh;
  background: var(--bg);
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: rgba(12, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nav-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
}

.nav-brand:hover { color: var(--accent); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user {
  font-size: 14px;
  color: var(--fg-muted);
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #0c0f14;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  font-family: 'DM Sans', sans-serif;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary.btn-full { width: 100%; text-align: center; }

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(61, 214, 140, 0.35);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--accent-glow); }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.btn-ghost:hover { color: var(--fg); border-color: rgba(255,255,255,0.18); }

/* ===== FORMS ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}

.field input,
.field textarea {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}

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

.field input::placeholder,
.field textarea::placeholder {
  color: var(--fg-muted);
  opacity: 0.7;
}

.char-count {
  font-size: 12px;
  color: var(--fg-muted);
  text-align: right;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius);
  color: #f87171;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ===== AUTH ===== */
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 40px 24px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
}

.auth-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.auth-sub {
  font-size: 15px;
  color: var(--fg-muted);
  margin-bottom: 32px;
}

.auth-form {
  margin-top: 8px;
}

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

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.auth-switch a:hover { text-decoration: underline; }

/* ===== DASHBOARD ===== */
.dash-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* Usage bar */
.usage-bar-wrap {
  margin-bottom: 32px;
}

.usage-bar-inner {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 14px 20px;
}

.usage-label {
  font-size: 13px;
  color: var(--fg-muted);
  display: block;
  margin-bottom: 8px;
}
.usage-label a { color: var(--accent); }

.usage-track {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

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

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  align-items: start;
}

.panel-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 24px;
}

/* Input panel */
.dash-input-panel {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  padding: 36px;
}

.rescue-form { margin-top: 4px; }

/* Tone picker */
.tone-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tone-option {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  transition: all 0.15s;
  background: var(--bg-elevated);
}

.tone-option input[type="radio"] { display: none; }

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

.upgrade-nudge {
  margin-top: 12px;
  font-size: 13px;
  color: var(--fg-muted);
  text-align: center;
}
.upgrade-nudge a { color: var(--accent); }

/* History panel */
.dash-history-panel {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.history-list { display: flex; flex-direction: column; gap: 16px; }

.history-item {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius);
  padding: 16px;
}

.history-review {
  font-size: 13px;
  color: var(--fg-muted);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 10px;
}

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

.tone-chip {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(61, 214, 140, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

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

.history-reply {
  font-size: 13px;
  color: var(--fg);
  line-height: 1.5;
  border-left: 2px solid rgba(61, 214, 140, 0.3);
  padding-left: 10px;
}

/* ===== RESULT PAGE ===== */
.result-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.result-header {
  text-align: center;
  margin-bottom: 40px;
}

.result-header h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  color: #fff;
  margin: 12px 0 8px;
}

.result-sub {
  font-size: 15px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.usage-note {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 8px;
}
.usage-note a { color: var(--accent); }

.original-review {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 32px;
}

.review-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  display: block;
  margin-bottom: 8px;
}

.review-quote {
  font-size: 15px;
  color: var(--fg);
  font-style: italic;
  line-height: 1.65;
}

.result-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.result-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.05);
  padding: 28px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, border-color 0.15s;
}

.result-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.12); }
.result-card.copied { border-color: var(--accent); }

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.card-icon { font-size: 20px; }

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  flex: 1;
}

.card-copy-hint {
  font-size: 11px;
  color: var(--fg-muted);
  opacity: 0.6;
}

.result-card.copied .card-copy-hint { display: none; }

.card-body {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.7;
}

.card-copied-msg {
  display: none;
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.result-card.copied .card-copied-msg { display: block; }

.result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== UPGRADE PAGE ===== */
.upgrade-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 40px 24px;
}

.upgrade-box {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.upgrade-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.upgrade-box h1 {
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 12px;
}

.upgrade-sub {
  font-size: 1.05rem;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 36px;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid rgba(61, 214, 140, 0.2);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 20px;
}

.pricing-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 12px;
}

.pricing-amount {
  margin-bottom: 24px;
}

.price-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: #fff;
}

.price-period {
  font-size: 1.1rem;
  color: var(--fg-muted);
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pricing-features li {
  font-size: 15px;
  color: var(--fg);
}

.pricing-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--fg-muted);
}

.upgrade-back {
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: none;
}
.upgrade-back:hover { color: var(--fg); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .result-cards {
    grid-template-columns: 1fr;
  }

  .tone-picker {
    grid-template-columns: repeat(2, 1fr);
  }

  .auth-box {
    padding: 36px 24px;
  }

  .dash-input-panel {
    padding: 24px 20px;
  }
}

/* Landing page CTA button (add to landing nav) */
.hero-cta {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}
