/* ─── APP STYLES ─────────────────────────────────────── */
/* Extends the landing page design system */

/* App Nav (replaces landing nav when in-app) */
.app-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 2rem;
  background: rgba(6, 11, 20, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  font-weight: 500;
}

.nav-link:hover {
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.05);
}

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

.nav-icon {
  font-size: 0.9rem;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-email {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Page Layout */
.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 84px 1.5rem 3rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Buttons */
.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  background: var(--accent);
  color: #060b14;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-accent:hover {
  background: #0ea572;
  transform: translateY(-1px);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-ghost:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  background: var(--accent-glow);
  color: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-sm:hover {
  background: rgba(16, 185, 129, 0.25);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  text-align: center;
}

.stat-card.highlight {
  border-color: rgba(16, 185, 129, 0.2);
  background: linear-gradient(135deg, var(--bg-card), rgba(16, 185, 129, 0.05));
}

.stat-card-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
}

.stat-card.highlight .stat-card-value {
  color: var(--accent);
}

.stat-card-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* Steps List */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.step-item.done {
  border-color: rgba(16, 185, 129, 0.15);
  background: rgba(16, 185, 129, 0.03);
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-glow);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.step-item div:nth-child(2) {
  flex: 1;
}

.step-item strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.step-item p {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0;
}

.step-check {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
}

/* Deals List */
.deals-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.deal-card {
  display: grid;
  grid-template-columns: 60px 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.deal-card:hover {
  border-color: rgba(16, 185, 129, 0.15);
  transform: translateY(-1px);
}

.deal-score {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  font-family: 'Space Grotesk', monospace;
}

.deal-address {
  font-weight: 600;
  font-size: 0.95rem;
}

.deal-location {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.deal-metrics {
  text-align: right;
}

.deal-price {
  font-weight: 700;
  font-size: 1rem;
}

.deal-cap {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.deal-details-row {
  display: flex;
  gap: 0.5rem;
}

.deal-details-row span {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Criteria Grid */
.criteria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.criteria-card {
  position: relative;
}

.criteria-card.active-criteria {
  border-color: rgba(16, 185, 129, 0.2);
}

.badge-active {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
  font-weight: 600;
  margin-top: 0.25rem;
}

.criteria-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.criteria-tag {
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg-surface);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.criteria-weights {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.weight-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.weight-bar span:first-child {
  width: 60px;
  text-align: right;
}

.weight-bar span:last-child {
  width: 32px;
}

.weight-fill {
  flex: 1;
  height: 4px;
  background: var(--bg-deep);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.weight-fill::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: inherit;
  background: var(--accent);
  border-radius: 2px;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead {
  background: var(--bg-surface);
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.data-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.03);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
  font-weight: 500;
}

.status-badge.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.status-badge.pending {
  color: var(--amber);
  background: rgba(245, 158, 11, 0.15);
}

.status-badge.sold {
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.1);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

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

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group select {
  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 d='M2 4l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(6, 11, 20, 0.8);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
}

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

/* Clickable Table Rows */
.data-table tbody tr.clickable-row {
  cursor: pointer;
  transition: all 0.15s;
}

.data-table tbody tr.clickable-row:hover {
  background: rgba(16, 185, 129, 0.04);
  border-color: rgba(16, 185, 129, 0.1);
}

.data-table tbody tr.clickable-row:hover td:first-child span {
  color: var(--accent);
}

/* Listing Detail Page */
.listing-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.listing-detail-score {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.listing-detail-score-num {
  font-family: 'Space Grotesk', monospace;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.listing-detail-score-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
  margin-top: 0.15rem;
}

.listing-detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.listing-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  text-align: center;
}

.listing-metric-card.primary {
  border-color: rgba(16, 185, 129, 0.2);
  background: linear-gradient(135deg, var(--bg-card), rgba(16, 185, 129, 0.04));
}

.listing-metric-value {
  font-family: 'Space Grotesk', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.listing-metric-card.primary .listing-metric-value {
  color: var(--accent);
}

.listing-metric-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.listing-detail-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.listing-detail-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-weight: 600;
}

.listing-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.listing-detail-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-right: 1.5rem;
}

.listing-detail-item:nth-last-child(-n+3) {
  border-bottom: none;
}

.listing-detail-item-label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.listing-detail-item-value {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Cap Rate Breakdown */
.listing-cap-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.cap-row.highlight-row {
  background: rgba(16, 185, 129, 0.05);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-top: 0.25rem;
}

/* Score Breakdown */
.listing-score-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.score-dim-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

.score-dim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.score-dim-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.score-dim-value {
  font-family: 'Space Grotesk', monospace;
  font-size: 1.15rem;
  font-weight: 700;
}

.score-dim-bar-track {
  height: 6px;
  background: var(--bg-deep);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.score-dim-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.score-dim-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.score-dim-weight {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.score-dim-reason {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.score-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  font-weight: 600;
}

.score-total-value {
  font-family: 'Space Grotesk', monospace;
  font-size: 1.5rem;
  font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
  .app-nav {
    padding: 0 1rem;
    gap: 0.5rem;
  }
  .nav-links {
    display: none;
  }
  .page-container {
    padding: 76px 1rem 2rem;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .deal-card {
    grid-template-columns: 50px 1fr;
    gap: 0.75rem;
  }
  .deal-metrics, .deal-details-row {
    display: none;
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .criteria-grid {
    grid-template-columns: 1fr;
  }
  .listing-detail-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .listing-detail-grid {
    grid-template-columns: 1fr;
  }
  .listing-detail-item {
    padding-right: 0;
  }
  .listing-detail-item:nth-last-child(-n+3) {
    border-bottom: 1px solid var(--border);
  }
  .listing-detail-item:last-child {
    border-bottom: none;
  }
  .listing-score-grid {
    grid-template-columns: 1fr;
  }
  .listing-detail-header {
    flex-direction: column;
  }
}
