/* ─────────────────────────────────────────────────────────────
   CourtCompass App Styles
   Extends theme.css for app pages (calculator, questionnaire, etc.)
   ───────────────────────────────────────────────────────────── */

/* NAV */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 15, 26, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.app-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-nav-brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--fg);
  text-decoration: none;
}

.app-nav-links {
  display: flex;
  gap: 32px;
}

.app-nav-link {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

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

/* MAIN */
.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px 120px;
  min-height: 80vh;
}

/* PAGE HEADER */
.page-header {
  margin-bottom: 56px;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  margin-top: 16px;
}

.page-lede {
  color: var(--fg-muted);
  font-size: 1.1rem;
  max-width: 580px;
  line-height: 1.65;
}

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.card--interactive {
  cursor: default;
  transition: border-color 0.15s;
}

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

.card--coming-soon {
  opacity: 0.55;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 24px;
}

/* BUTTONS */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
  text-align: center;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
}

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

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

.btn-full {
  display: block;
  width: 100%;
  text-align: center;
}

/* FORMS */
.form-group {
  margin-bottom: 28px;
}

.form-label {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--fg);
}

.form-hint {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--fg-muted);
  margin-top: 3px;
}

.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--fg);
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.form-textarea--lg {
  min-height: 140px;
}

select.form-input {
  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='%238b95a8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* prefix input */
.input-prefix-wrap {
  position: relative;
}

.input-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.input-prefixed {
  padding-left: 28px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Radio groups */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.radio-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.radio-item input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.radio-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.radio-desc {
  font-size: 0.82rem;
  color: var(--fg-muted);
}

.required {
  color: #f87171;
}

/* CALCULATOR LAYOUT */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

/* CALC RESULTS */
.result-amount-block {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}

.result-amount {
  font-family: var(--font-display);
  font-size: 3.5rem;
  color: var(--accent-warm);
  line-height: 1;
}

.result-label {
  color: var(--fg-muted);
  font-size: 1rem;
}

.result-annual {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.result-breakdown {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-bottom: 24px;
}

.breakdown-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-bottom: 16px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}

.breakdown-row--total {
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 4px;
}

.deduction {
  color: #f87171;
}

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

.result-disclaimer {
  font-size: 0.8rem;
  color: var(--fg-muted);
  line-height: 1.5;
  margin-bottom: 20px;
  padding: 12px;
  background: rgba(30, 41, 59, 0.4);
  border-radius: 6px;
}

.error-msg {
  color: #f87171;
  font-size: 0.95rem;
}

/* INFO BOX */
.info-box {
  margin-top: 48px;
  padding: 28px 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
}

.info-box--warning {
  border-left-color: var(--accent-warm);
}

.info-box h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.info-box p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.65;
  margin-bottom: 8px;
}

.info-box p:last-child {
  margin-bottom: 0;
}

.guideline-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.guideline-list li {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-align: center;
  background: var(--bg-card);
  padding: 8px;
  border-radius: 6px;
}

/* DOCUMENTS PAGE */
.doc-types {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.doc-type-card {
  display: flex;
  gap: 20px;
}

.doc-type-icon {
  font-size: 2rem;
  flex-shrink: 0;
  margin-top: 4px;
}

.doc-type-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.doc-type-desc {
  font-size: 0.88rem;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.doc-type-meta {
  list-style: none;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doc-type-meta li {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.doc-type-meta li::before {
  content: '✓ ';
  color: var(--accent);
  font-weight: 600;
}

.coming-soon-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-warm);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* WIZARD */
.wizard-progress {
  margin-bottom: 48px;
}

.wizard-progress-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.wizard-step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  color: var(--fg-muted);
  transition: all 0.2s;
}

.wizard-step--active .wizard-step-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.wizard-step--done .wizard-step-dot {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.wizard-step-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

.wizard-step--active .wizard-step-label {
  color: var(--fg);
}

.wizard-connector {
  flex: 1;
  max-width: 80px;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 24px;
  transition: background 0.2s;
}

.wizard-connector--done {
  background: var(--accent);
}

.wizard-body {
  max-width: 720px;
  margin: 0 auto;
}

.wizard-form {
  display: flex;
  flex-direction: column;
}

.wizard-step-content {
  flex: 1;
}

.wizard-step-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 400;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.wizard-step-desc {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin-bottom: 36px;
  line-height: 1.6;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.review-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* REVIEW PAGE */
.review-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}

.review-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.review-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.review-section-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.link-edit {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

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

.review-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.review-key {
  font-size: 0.82rem;
  color: var(--fg-muted);
  min-width: 180px;
  flex-shrink: 0;
  padding-top: 2px;
}

.review-val {
  font-size: 0.92rem;
  color: var(--fg);
  flex: 1;
}

.review-val--block {
  white-space: pre-wrap;
  word-break: break-word;
}

.review-cta .card {
  position: sticky;
  top: 88px;
}

.review-disclaimer {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 16px;
  line-height: 1.5;
}

/* DOCUMENT VIEW */
.doc-view-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  align-items: start;
}

.doc-actions-sidebar .card {
  position: sticky;
  top: 88px;
}

.doc-action-notes {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.doc-action-notes h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.action-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-list li {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.45;
}

.doc-ready-badge {
  display: inline-block;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #34d399;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 0;
}

.doc-preview-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.doc-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.doc-preview-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}

.doc-preview-hint {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.doc-preview-content {
  background: var(--bg-card);
  max-height: 700px;
  overflow-y: auto;
  padding: 32px;
}

.doc-text {
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ALERTS */
.alert {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.alert--error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #f87171;
}

/* UTILITY */
.link {
  color: var(--accent);
  text-decoration: none;
}

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

.text-muted {
  color: var(--fg-muted);
}

code {
  background: rgba(30, 41, 59, 0.7);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent-warm);
}

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

  .doc-types {
    grid-template-columns: 1fr;
  }

  .review-layout {
    grid-template-columns: 1fr;
  }

  .doc-view-layout {
    grid-template-columns: 1fr;
  }

  .doc-actions-sidebar .card {
    position: static;
  }

  .review-cta .card {
    position: static;
  }

  .guideline-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .wizard-progress-inner {
    overflow-x: auto;
    padding-bottom: 8px;
  }
}

@media (max-width: 640px) {
  .app-nav-links {
    display: none;
  }

  .app-main {
    padding: 40px 20px 80px;
  }

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

  .wizard-connector {
    max-width: 32px;
  }

  .wizard-step-label {
    display: none;
  }

  .review-item {
    flex-direction: column;
    gap: 4px;
  }

  .review-key {
    min-width: unset;
  }
}
