/* Flip Deals Dashboard Styles */

:root {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Top Navigation (Consistent across pages) */
.top-nav {
  background: #fff;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: bold;
  text-decoration: none;
  color: var(--primary-color);
}

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

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--primary-color);
  background: var(--bg-color);
}

.nav-link.active {
  color: var(--primary-color);
  background: var(--bg-color);
  font-weight: 600;
}

@media (max-width: 768px) {
  .nav-links {
    gap: 0.5rem;
  }
  
  .nav-link {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
  }
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: 12px;
}

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

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background: #475569;
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-warning {
  background: var(--warning-color);
  color: white;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

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

.btn .icon {
  font-size: 16px;
}

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

.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  border-radius: 12px;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Filters Section */
.filters-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}

.filter-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Loading & Error */
.loading-indicator {
  text-align: center;
  padding: 40px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error-message {
  background: #fee2e2;
  color: #991b1b;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  border-left: 4px solid var(--danger-color);
}

/* Deals Section */
.deals-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.deals-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.deals-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.pagination-info {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Table */
.table-container {
  overflow-x: auto;
  margin-bottom: 20px;
}

.deals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.deals-table thead {
  background: var(--bg-color);
}

.deals-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

/* Sortable column headers */
.deals-table th.sortable {
  user-select: none;
  transition: background-color 0.2s;
}

.deals-table th.sortable:hover {
  background-color: var(--border-color);
}

.deals-table th .sort-indicator {
  font-size: 0.8em;
  color: var(--primary-color);
  margin-left: 4px;
}

.deals-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.deals-table tbody tr {
  transition: background-color 0.2s;
}

.deals-table tbody tr:hover {
  background: var(--bg-color);
}

/* Add spacing between Est. Profit and ROI columns for better readability */
.deals-table th:nth-child(10), /* Est. Profit header */
.deals-table td:nth-child(10) { /* Est. Profit data */
  padding-right: 25px;
}

.deals-table th:nth-child(11), /* ROI header */
.deals-table td:nth-child(11) { /* ROI data */
  padding-left: 15px;
}

.property-address {
  font-weight: 500;
  color: var(--primary-color);
  cursor: pointer;
}

.property-address:hover {
  text-decoration: underline;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-new {
  background: #dcfce7;
  color: #166534;
}

.badge-reduced {
  background: #fef3c7;
  color: #92400e;
}

.badge-good {
  background: #dbeafe;
  color: #1e40af;
}

.badge-interested {
  background: #e0e7ff;
  color: #3730a3;
}

.badge-contacted {
  background: #fce7f3;
  color: #831843;
}

.badge-contract {
  background: #dcfce7;
  color: #166534;
}

.badge-ignored {
  background: #f3f4f6;
  color: #6b7280;
}

/* Auction badge */
.auction-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
  animation: pulse-auction 2s ease-in-out infinite;
}

@keyframes pulse-auction {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.auction-badge:hover {
  background: linear-gradient(135deg, #ee5a6f 0%, #ff6b6b 100%);
  cursor: help;
}

/* Confidence badges */
.confidence-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.confidence-high {
  background: #dcfce7;
  color: #166534;
}

.confidence-medium {
  background: #fef3c7;
  color: #92400e;
}

.confidence-low {
  background: #fee2e2;
  color: #991b1b;
}

.price {
  font-weight: 600;
}

.profit-positive {
  color: var(--success-color);
  font-weight: 600;
}

.roi-high {
  color: var(--success-color);
  font-weight: 700;
}

.roi-medium {
  color: var(--warning-color);
  font-weight: 600;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

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

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

#pageInfo {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-large {
  max-width: 800px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--bg-color);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid var(--border-color);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
}

textarea.form-control {
  resize: vertical;
}

/* Property Details */
.property-details {
  display: grid;
  gap: 20px;
}

.detail-section {
  padding: 16px;
  background: var(--bg-color);
  border-radius: 8px;
}

.detail-section h4 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

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

.detail-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-value {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 600;
}

.price-history-table {
  width: 100%;
  font-size: 13px;
}

.price-history-table th,
.price-history-table td {
  padding: 8px;
  text-align: left;
}

.price-history-table th {
  background: var(--bg-color);
  font-weight: 600;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-section {
    grid-template-columns: 1fr;
  }

  .filters-row {
    flex-direction: column;
  }

  .filter-group {
    width: 100%;
  }

  .deals-table {
    font-size: 12px;
  }

  .deals-table th,
  .deals-table td {
    padding: 8px 4px;
  }

  .action-buttons {
    flex-direction: column;
  }
}

/* AI Analysis Features */
.deals-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.selected-count {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Checkbox styling */
input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
}

input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Grade Badge */
.grade-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  min-width: 40px;
}

.grade-a-plus,
.grade-a {
  background: #10b981;
  color: white;
}

.grade-a-minus {
  background: #3b82f6;
  color: white;
}

.grade-b-plus {
  background: #06b6d4; /* Cyan - between A- blue and B purple */
  color: white;
}

.grade-b,
.grade-b-minus {
  background: #8b5cf6;
  color: white;
}

.grade-c-plus,
.grade-c {
  background: #f59e0b;
  color: white;
}

.grade-c-minus {
  background: #f97316;
  color: white;
}

.grade-d-plus {
  background: #fb923c; /* Lighter orange - between C- and D */
  color: white;
}

.grade-d {
  background: #f97316;
  color: white;
}

.grade-d-minus {
  background: #f87171; /* Red-orange - between D and F */
  color: white;
}

.grade-f {
  background: #ef4444;
  color: white;
}

.grade-pending {
  background: var(--border-color);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Analysis Progress */
.analysis-progress {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 300px;
  max-width: 400px;
}

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

.progress-header h3 {
  font-size: 16px;
  color: var(--text-primary);
}

.progress-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-close:hover {
  color: var(--text-primary);
}

.progress-bar-container {
  background: var(--bg-color);
  border-radius: 8px;
  height: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.progress-bar {
  background: var(--primary-color);
  height: 100%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.progress-details {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.progress-detail-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.progress-success {
  color: var(--success-color);
  font-weight: 500;
}

.progress-error {
  color: var(--danger-color);
  font-weight: 500;
}

/* =================================================================
   VIEW MODE CONTROLS
   ================================================================= */

.view-mode-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}

.view-toggle-buttons {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-color);
  padding: 0.25rem;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.btn-view {
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-view:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
}

.btn-view.active {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.view-mode-hint {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* =================================================================
   WHOLESALE VIEW SPECIFIC STYLES
   ================================================================= */

/* Seller Motivation Badges */
.motivation-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.motivation-extreme {
  background: #fee2e2;
  color: #991b1b;
}

.motivation-high {
  background: #fed7aa;
  color: #9a3412;
}

.motivation-moderate {
  background: #fef3c7;
  color: #92400e;
}

.motivation-low {
  background: #dbeafe;
  color: #1e40af;
}

.motivation-very-low {
  background: #e0e7ff;
  color: #3730a3;
}

/* Viability Progress Bars */
.viability-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}

.viability-bar {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.viability-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.viability-excellent {
  background: linear-gradient(90deg, #10b981, #059669);
}

.viability-good {
  background: linear-gradient(90deg, #84cc16, #65a30d);
}

.viability-marginal {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.viability-difficult {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.viability-score {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 35px;
}

/* Viability Score as Percentage Number (replaces progress bar) */
.viability-score-number {
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  min-width: 50px;
  text-align: center;
}

.viability-score-excellent {
  color: #059669;
  background: #d1fae5;
}

.viability-score-good {
  color: #65a30d;
  background: #ecfccb;
}

.viability-score-marginal {
  color: #d97706;
  background: #fef3c7;
}

.viability-score-difficult {
  color: #dc2626;
  background: #fee2e2;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-undecided {
  background: #e2e8f0;
  color: #475569;
}

.status-interested {
  background: #d1fae5;
  color: #065f46;
}

.status-skip {
  background: #fee2e2;
  color: #991b1b;
}

/* Status Buttons */
.btn-status {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  color: var(--text-secondary);
}

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

.btn-status.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-interested.active {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.btn-skip.active {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}

/* Combined Status & Actions Column */
.status-actions-combined {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
  min-width: 150px;
}

.status-actions-combined .status-badge {
  margin-bottom: 0.25rem;
}

.status-actions-combined .status-buttons-inline {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.status-actions-combined .action-buttons {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Wholesale Target Offer Highlight */
.wholesale-target {
  font-weight: 700;
  color: var(--primary-color);
}

/* Wholesale Fee Badge */
.fee-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
}

/* Buyer ROI Indicator */
.buyer-roi {
  font-weight: 600;
}

.buyer-roi-excellent {
  color: #059669;
}

.buyer-roi-good {
  color: #65a30d;
}

.buyer-roi-marginal {
  color: #d97706;
}

.buyer-roi-poor {
  color: #dc2626;
}

/* =================================================================
   COMPACT TABLE VIEW
   ================================================================= */

.deal-row {
  cursor: pointer;
  transition: background-color 0.2s;
}

.deal-row:hover {
  background-color: var(--bg-color);
}

.address-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.address-text {
  font-weight: 600;
  color: var(--text-primary);
}

.zip-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* =================================================================
   DAYS ON MARKET STYLING
   ================================================================= */

.dom-value {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  display: inline-block;
}

.dom-hot {
  background: #d4edda;
  color: #155724;
}

.dom-warm {
  background: #fff3cd;
  color: #856404;
}

.dom-cold {
  background: #f8d7da;
  color: #721c24;
}

/* =================================================================
   MOTIVATION INDICATORS
   ================================================================= */

.motivation-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.875rem;
}

.motivation-hot {
  background: #d4edda;
  color: #155724;
}

.motivation-warm {
  background: #fff3cd;
  color: #856404;
}

.motivation-cold {
  background: #e2e3e5;
  color: #383d41;
}

.motivation-icon {
  font-size: 1.125rem;
  line-height: 1;
}

/* =================================================================
   PRICE CHANGE DISPLAY
   ================================================================= */

.price-change {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  padding: 0.125rem 0.5rem;
  background: #d4edda;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #155724;
  font-weight: 600;
}

.change-icon {
  font-size: 0.875rem;
}

/* =================================================================
   ENHANCED ROI STYLING
   ================================================================= */

.roi-value {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: bold;
  font-size: 1rem;
  display: inline-block;
}

.roi-high {
  background: #d4edda;
  color: #155724;
}

.roi-medium {
  background: #d1ecf1;
  color: #0c5460;
}

/* =================================================================
   RESPONSIVE DESIGN
   ================================================================= */

@media (max-width: 768px) {
  .view-mode-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .view-mode-hint {
    display: none;
  }
  
  /* Hide less important columns on mobile */
  .col-grade {
    display: none;
  }
  
  .motivation-label {
    display: none;
  }
}

/* =================================================================
   QUICK VIEW MODAL SYSTEM
   ================================================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001; /* Higher than map modal (10000) to display deal on top */
  padding: 1rem;
  overflow-y: auto;
}

.modal-container {
  background: var(--card-bg);
  border-radius: 8px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-color);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-section {
  margin-bottom: 2rem;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
}

/* Executive Summary (Modal) */
.executive-summary {
  padding: 1rem;
  background: #f8f9fa;
  border-left: 4px solid var(--primary-color);
  border-radius: 4px;
  line-height: 1.6;
}

.executive-summary p {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
}

/* Metrics Grid (Modal) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

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

.metric-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-primary);
}

/* Details Grid (Modal) */
.details-grid {
  display: grid;
  gap: 0.75rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--bg-color);
  border-radius: 4px;
}

.detail-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.detail-value {
  color: var(--text-primary);
}

/* Financial Table (Modal) */
.financial-table {
  display: grid;
  gap: 0.5rem;
}

.financial-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--bg-color);
  border-radius: 4px;
}

.financial-row.highlight {
  background: #e7f3ff;
  border: 2px solid var(--primary-color);
  font-weight: bold;
}

.financial-row.price-reduction {
  background: #d4edda;
  color: #155724;
}

.financial-label {
  color: var(--text-secondary);
}

.financial-value {
  color: var(--text-primary);
  font-weight: 600;
}

/* Motivation Section (Modal) */
.motivation-section {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 8px;
  padding: 1.5rem;
}

.motivation-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.motivation-list li {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background: var(--card-bg);
  border-radius: 4px;
  font-size: 0.9375rem;
}

.motivation-note {
  background: var(--card-bg);
  padding: 1rem;
  border-left: 4px solid #ffc107;
  border-radius: 4px;
  margin: 0;
  font-size: 0.875rem;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-color);
  gap: 1rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  z-index: 10000;
  animation: toastSlideIn 0.3s ease;
}

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

/* ============================================
   MOBILE CARD LAYOUT
   ============================================ */

.mobile-cards-container {
  display: none; /* Hidden by default, shown on mobile */
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: #f8fafc;
}

.no-deals-mobile {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
  font-size: 16px;
}

.deal-card-mobile {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.deal-card-mobile:active {
  transform: scale(0.98);
}

/* Card Header */
.card-header-mobile {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.card-checkbox-mobile {
  flex-shrink: 0;
  padding-top: 2px;
}

.card-checkbox-mobile input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.card-title-mobile {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.card-motivation {
  flex-shrink: 0;
}

.card-motivation .motivation-indicator {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
}

/* Card Body */
.card-body-mobile {
  padding: 16px;
}

.card-metrics-mobile {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
}

.metric-icon {
  font-size: 24px;
  line-height: 1;
}

.metric-content {
  flex: 1;
  min-width: 0;
}

.metric-label-mobile {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.metric-value-mobile {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card Badges and Alerts */
.card-price-change {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
}

.card-badge {
  display: inline-block;
  padding: 6px 12px;
  background: #dbeafe;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 12px;
}

/* Card Actions */
.card-actions-mobile {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-view {
  background: #667eea;
  color: white;
}

.btn-view:active {
  background: #5568d3;
}

.btn-watchlist {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.btn-watchlist:active {
  background: #e2e8f0;
}

/* Swipe Hint */
.card-swipe-hint {
  padding: 8px 16px;
  background: #f1f5f9;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  border-top: 1px solid #e2e8f0;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .mobile-cards-container {
    display: flex !important;
  }
  
  .table-container {
    display: none !important;
  }
  
  .view-mode-controls {
    display: none; /* Hide view toggle on mobile */
  }
  
  /* Adjust modal for mobile */
  .modal-container {
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
    margin: 20px;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .financial-table {
    font-size: 13px;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  .modal-actions button {
    width: 100%;
  }
}

.toast-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.toast-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Mobile Responsive for Modal */
@media (max-width: 768px) {
  .modal-container {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .modal-footer {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
  
  .modal-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
}

/* Auth UI */
.nav-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

#logoutBtn {
  white-space: nowrap;
}

/* Login Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 2rem;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: slideDown 0.3s ease;
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  font-size: 1.5rem;
}

.close-modal {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  margin-top: -10px;
}

.close-modal:hover,
.close-modal:focus {
  color: #000;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-message {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin: 0.5rem 0;
  min-height: 1.25rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* AI Valuation Warning Styles (Phase 1) */
.valuation-warning-icon {
  display: inline-block;
  font-size: 18px;
  margin-right: 6px;
  cursor: help;
  animation: warningPulse 2s ease-in-out infinite;
}

.valuation-warning-badge {
  display: inline-block;
  font-size: 14px;
  margin-left: 4px;
  color: #ef4444;
}

@keyframes warningPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.valuation-warning-section {
  border-radius: 8px;
  animation: slideDown 0.3s ease-out;
}

/* Enhanced address cell to accommodate warning icon */
.address-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.col-address .valuation-warning-icon {
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
}

/* Detailed view address warning positioning */
td .valuation-warning-icon {
  margin-right: 4px;
  vertical-align: middle;
}
/* ================================================================
   DEALS MAP MODAL STYLES
   ================================================================ */

.map-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.map-modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.map-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.map-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.map-close-button {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.map-close-button:hover {
  background: var(--bg-color);
  color: var(--text-primary);
}

.map-modal-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  padding: 1rem;
}

.map-controls {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
}

.map-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.map-stat-badge {
  background: var(--bg-color);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.map-stat-badge strong {
  color: var(--text-primary);
  font-weight: 600;
}

.map-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
}

.deals-map-container {
  width: 100%;
  height: 500px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.map-loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.map-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Deal Markers on Map */
.deal-marker {
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s;
  min-width: 60px;
  text-align: center;
}

.deal-marker:hover {
  transform: scale(1.1);
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* ROI-based coloring (kept for backward compatibility) */
.deal-marker.roi-excellent {
  background: #10b981;
  color: white;
  border-color: #059669;
}

.deal-marker.roi-good {
  background: #3b82f6;
  color: white;
  border-color: #2563eb;
}

.deal-marker.roi-fair {
  background: #f59e0b;
  color: white;
  border-color: #d97706;
}

.deal-marker.roi-poor {
  background: #ef4444;
  color: white;
  border-color: #dc2626;
}

/* ZIP Code Tier-based coloring (matches market-selection.html colors) */
.deal-marker.tier-a {
  background: #28a745;
  color: white;
  border-color: #1e7e34;
}

.deal-marker.tier-b {
  background: #17a2b8;
  color: white;
  border-color: #117a8b;
}

.deal-marker.tier-c {
  background: #ffc107;
  color: #000;
  border-color: #e0a800;
}

.deal-marker.tier-d {
  background: #dc3545;
  color: white;
  border-color: #c82333;
}

.deal-marker.tier-unknown {
  background: #6c757d;
  color: white;
  border-color: #5a6268;
}

/* Deal Info Window */
.deal-info-window {
  max-width: 300px;
  padding: 0;
}

.deal-info-window .info-header {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.deal-info-window .info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.875rem;
}

.deal-info-window .info-label {
  color: var(--text-secondary);
}

.deal-info-window .info-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .map-modal-content {
    width: 95%;
    max-height: 85vh;
  }
  
  .deals-map-container {
    height: 400px;
  }
  
  .map-stats {
    font-size: 0.75rem;
  }
  
  .map-legend {
    font-size: 0.75rem;
  }
  
  .deal-marker {
    font-size: 12px;
    padding: 6px 10px;
    min-width: 50px;
  }
}

/* =================================================================
   ZIP CODE SCORE COLUMN STYLES
   ================================================================= */

.col-zip-score {
  text-align: center;
  white-space: nowrap;
  padding: 8px 12px;
}

.zip-score-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.zip-score-value {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.zip-score-excellent {
  color: #10b981;
  background-color: #d1fae5;
}

.zip-score-good {
  color: #059669;
  background-color: #a7f3d0;
}

.zip-score-moderate {
  color: #f59e0b;
  background-color: #fef3c7;
}

.zip-score-low {
  color: #f97316;
  background-color: #fed7aa;
}

.zip-score-very-low {
  color: #ef4444;
  background-color: #fee2e2;
}

.zip-score-missing {
  color: #94a3b8;
  font-style: italic;
}

.zip-tier-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tier-a {
  background-color: #10b981;
  color: white;
}

.tier-b {
  background-color: #3b82f6;
  color: white;
}

.tier-c {
  background-color: #f59e0b;
  color: white;
}

.tier-d {
  background-color: #ef4444;
  color: white;
}

/* Mobile: Hide ZIP score on very small screens */
@media (max-width: 640px) {
  .col-zip-score {
    display: none;
  }
}