/* 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;
}

/* 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,
.grade-d {
  background: #f97316;
  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;
}

#viewModeToggle {
  padding: 0.5rem 1rem;
  background: var(--primary-color);
  color: white;
  border: 2px solid var(--primary-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

#viewModeToggle:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.view-mode-hint {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* =================================================================
   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: 9999;
  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;
}

/* 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;
  }
}