/* Modern Variables */
:root {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --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;
  margin: 0;
  padding: 0;
}

/* Top Navigation (matching flip-deals) */
.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;
  gap: 2rem;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  transition: opacity 0.2s;
}

.nav-logo:hover {
  opacity: 0.8;
}

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

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

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

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

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
  color: white;
  padding: 1.5rem 1rem;
  margin-bottom: 1.5rem;
}

.hero-content {
  max-width: 1400px;
  margin: 0 auto;
  text-align: center;
}

.hero-content h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.25rem;
  opacity: 0.95;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.hero-stat-icon {
  font-size: 2rem;
}

.hero-stat-label {
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Quick Action Cards */
.quick-actions-section {
  max-width: 1400px;
  margin: 3rem auto;
  padding: 0 1rem;
}

.quick-actions-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.quick-action-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.quick-action-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.quick-action-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.quick-action-card h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.quick-action-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.quick-action-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s;
}

.quick-action-btn:hover {
  background-color: #1e40af;
  transform: translateX(4px);
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

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

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

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Main Container */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Dashboard Layout */
.dashboard-container {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.search-pane {
  flex: 0 0 400px;
  min-width: 350px;
}

.results-pane {
  flex: 1;
  min-width: 0; /* Allow flex item to shrink */
}

/* Modern card styling for sections */
.nav-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.nav-section h2 {
  color: var(--text-primary);
  font-size: 1.25rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.search-section {
  background: var(--card-bg);
}

.search-section h2 {
  color: var(--primary-color);
}

/* Accordion Styles */
.accordion-container {
  margin: 15px 0;
}

.accordion-item {
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-bottom: 5px;
}

.accordion-header {
  width: 100%;
  padding: 12px 15px;
  background-color: #f8f9fa;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  font-size: 14px;
  transition: background-color 0.2s;
}

.accordion-header:hover {
  background-color: #e9ecef;
}

.accordion-header.active {
  background-color: #4caf50;
  color: white;
  border-radius: 5px 5px 0 0;
}

.accordion-header.active:hover {
  background-color: #45a049;
}

.accordion-header i {
  transition: transform 0.2s;
  font-size: 12px;
}

.accordion-header.active i {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 15px;
  border-top: 1px solid #ddd;
  background-color: #fff;
  border-radius: 0 0 5px 5px;
}

.accordion-content.active {
  display: block;
}

/* Basic Search Section - Always Visible */
.basic-search {
  margin-bottom: 15px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background-color: #f8f9fa;
}

.basic-search h4 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 16px;
}

/* Search Button Styling */
.search-btn {
  width: 100%;
  margin-top: 15px;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
}

/* Results Header */
.results-header {
  margin-bottom: 15px;
}

.results-header h2 {
  margin-bottom: 5px;
}

.results-header h3 {
  color: #666;
  font-weight: normal;
  font-size: 14px;
  margin: 0;
}

/* Search Results Container */
.search-results-section {
  margin-bottom: 20px;
}

.search-results-container {
  max-height: 500px;
  overflow: auto;
  border: 1px solid #ddd;
  border-radius: 5px;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .dashboard-container {
    flex-direction: column;
  }

  .search-pane {
    flex: none;
    min-width: auto;
  }

  .results-pane {
    flex: none;
  }

  .search-results-container {
    max-height: 400px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .dashboard-container {
    gap: 15px;
  }

  .accordion-header {
    padding: 10px 12px;
    font-size: 13px;
  }

  .accordion-content {
    padding: 10px;
  }

  .basic-search {
    padding: 10px;
  }

  .search-results-container {
    max-height: 300px;
  }

  #searchResultsTable {
    font-size: 12px;
  }

  #searchResultsTable th,
  #searchResultsTable td {
    padding: 6px 4px;
  }
}

.nav-section {
  margin-bottom: 30px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

h2 {
  color: #333;
  margin-top: 0;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  margin: 10px 0;
}

a {
  color: #0066cc;
  text-decoration: none;
  padding: 5px 0;
  display: inline-block;
}

a:hover {
  text-decoration: underline;
}

.description {
  color: #666;
  font-size: 0.9em;
  margin-left: 20px;
}

/* Login Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.modal.show {
  display: flex;
}

.modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 500px;
  border-radius: 5px;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

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

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.form-group input {
  width: 100%;
  padding: 8px;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.error-message {
  color: red;
  margin-top: 10px;
  font-size: 0.9em;
}

.action-button {
  background-color: #4caf50;
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}

.action-button:hover {
  background-color: #45a049;
}

.login-section {
  text-align: right;
  margin-bottom: 20px;
}

/* New Property Search Styles */
.search-container {
  margin-top: 15px;
}

.search-tabs {
  display: flex;
  border-bottom: 1px solid #ddd;
  margin-bottom: 15px;
}

.search-tab-btn {
  background-color: #f1f1f1;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 10px 15px;
  margin-right: 5px;
  border-radius: 5px 5px 0 0;
  transition: 0.3s;
}

.search-tab-btn:hover {
  background-color: #ddd;
}

.search-tab-btn.active {
  background-color: #4caf50;
  color: white;
}

.search-tab-content {
  display: none;
  padding: 15px;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 5px 5px;
  position: relative;
}

.search-tab-content.active {
  display: block;
}

.search-form {
  margin-bottom: 0;
}

#searchResultsCount {
  margin-bottom: 10px;
  font-weight: bold;
}

#searchResultsTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

#searchResultsTable th {
  background-color: #f2f2f2;
  padding: 8px;
  text-align: left;
  border-bottom: 2px solid #ddd;
  font-weight: bold;
}

#searchResultsTable tbody tr {
  border-bottom: 1px solid #ddd;
}

#searchResultsTable tbody tr:hover {
  background-color: #f5f5f5;
}

.sortable-header {
  cursor: pointer;
}

.sortable-header:hover {
  background-color: #e9e9e9;
}

.sort-asc::after {
  content: " ↑";
  font-weight: bold;
}

.sort-desc::after {
  content: " ↓";
  font-weight: bold;
}

/* Checkbox column - narrow width */
#searchResultsTable th:nth-child(1), /* Checkbox */
#searchResultsTable td:nth-child(1) {
  width: 40px;
  min-width: 40px;
  text-align: center;
  padding: 8px 4px;
  cursor: pointer;
}

/* Address column */
#searchResultsTable th:nth-child(2), /* Address */
#searchResultsTable td:nth-child(2) {
  width: 25%;
  min-width: 150px;
}

#searchResultsTable th:nth-child(6), /* Beds */
#searchResultsTable td:nth-child(6),
#searchResultsTable th:nth-child(7), /* Baths */
#searchResultsTable td:nth-child(7) {
  width: 8%;
  text-align: center;
}

#searchResultsTable th:nth-child(8), /* Sqft */
#searchResultsTable td:nth-child(8) {
  width: 10%;
  text-align: right;
  padding-right: 20px;
}

.no-results {
  text-align: center;
  padding: 20px;
  color: #666;
  font-style: italic;
}

.search-help {
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 15px;
  margin-top: 15px;
}

.search-help ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

#suggestionsList {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: white;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 5px 5px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#suggestionsList p {
  margin: 0;
  padding: 8px 12px;
  font-size: 0.9em;
  color: #666;
  background-color: #f8f9fa;
  border-bottom: 1px solid #eee;
}

#suggestionsList li {
  margin: 0;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 0.9em;
}

#suggestionsList li:last-child {
  border-bottom: none;
}

#suggestionsList li:hover {
  background-color: #f0f0f0;
}

#partial-address {
  position: relative;
}

.api-selection-container {
  margin-bottom: 15px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background-color: #f8f9fa;
}

.api-selection {
  display: flex;
  gap: 20px;
}

.api-radio {
  margin-right: 5px;
}

.api-selection label {
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.api-selection input[type="radio"]:checked + label {
  background-color: #4caf50;
  color: white;
  font-weight: bold;
}

.workflow-selection {
  margin-bottom: 15px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.workflow-options {
  display: flex;
  gap: 15px;
}

.workflow-radio {
  margin-right: 5px;
}

.workflow-selection label {
  cursor: pointer;
}

.api-search-container {
  transition: opacity 0.3s ease;
}

.api-search-container.hidden {
  display: none;
}

.form-section {
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid #eee;
  border-radius: 5px;
  background-color: #fafafa;
}

.form-section h4 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd;
}

.range-group {
  margin-bottom: 15px;
}

.range-inputs {
  display: flex;
  gap: 10px;
}

.range-inputs input {
  flex: 1;
}

.coordinate-group {
  margin-bottom: 15px;
}

.coordinate-inputs {
  display: flex;
  gap: 10px;
}

.coordinate-inputs input {
  flex: 1;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  margin-right: 8px;
  width: auto;
}

select[multiple] {
  height: 120px;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px;
}

#prPropertyType {
  height: 120px;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px;
  font-size: 14px;
  width: 100%;
}

#prPropertyType option {
  padding: 5px 8px;
  margin: 1px 0;
  border-radius: 3px;
}

#prPropertyType option:hover {
  background-color: #e8f5e8;
}

#prPropertyType option:checked {
  background-color: #4caf50;
  color: white;
  font-weight: 500;
}

.quota-display {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background-color: #f9f9f9;
}

.quota-display h3 {
  margin-top: 0;
  color: #333;
}

.quota-info {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.quota-section {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: white;
}

.quota-section h4 {
  margin: 0 0 10px 0;
  color: #4caf50;
}

.quota-section p {
  margin: 5px 0;
  font-size: 0.9em;
}

.quota-cost {
  font-style: italic;
  color: #666;
}

.quota-section span {
  font-weight: bold;
  color: #333;
}

@media (max-width: 768px) {
  .api-selection {
    flex-direction: column;
    gap: 10px;
  }

  .workflow-options {
    flex-direction: column;
    gap: 10px;
  }

  .range-inputs,
  .coordinate-inputs {
    flex-direction: column;
  }

  .quota-info {
    gap: 10px;
  }
}

.hidden {
  display: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* List Selection and Creation Section */
.list-selection-container {
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.list-selection-container h3 {
  margin-top: 0;
  color: #333;
  font-size: 1.2em;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: flex-end;
}

.list-actions .form-group {
  flex: 1;
  min-width: 200px; /* Adjust as needed */
  margin-bottom: 0;
}

.list-actions label {
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
}

.list-actions select,
.list-actions input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1em;
}

.create-list-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.create-list-group button {
  align-self: flex-end; /* Align button to the bottom */
  padding: 10px 15px;
  font-size: 0.9em;
}

.list-actions .action-button {
  padding: 10px 15px;
  font-size: 1em;
  min-width: 150px;
}

/* Alert Message Styles */
.alert {
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 4px;
  font-size: 0.9em;
  text-align: center;
}

.alert.success {
  background-color: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

.alert.error {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

/* NEW: List Options Toggle and Expanded Section Styles (MODIFIED) */
.list-selection-container .list-actions {
  display: flex;
  flex-direction: row; /* Changed to row for horizontal layout */
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
  justify-content: flex-start; /* Align items to the start */
  align-items: flex-end; /* Align items to the bottom to vertically align inputs/select with buttons */
  gap: 15px; /* Adjust gap for horizontal spacing */
  margin-top: 5px; /* Reduced space above the list actions */
}

.list-actions .form-group {
  margin-bottom: 0; /* Remove default form-group margin */
  flex-grow: 1; /* Allow form groups to grow */
  min-width: 180px; /* Minimum width to prevent excessive squeezing */
  display: flex; /* Enable flexbox for form group */
  flex-direction: column; /* Stack label and input/select vertically */
  justify-content: flex-end; /* Push content to the bottom for vertical alignment */
}

.list-actions label {
  margin-bottom: 5px; /* Adjust margin for labels */
}

.list-actions .form-group.create-list-group {
  flex-grow: 1; /* Allow to grow like other form groups */
}

.list-actions .action-button {
  /* Removed width: 100% to allow buttons to sit side-by-side */
  flex-shrink: 0; /* Prevent buttons from shrinking too much */
  padding: 10px 15px; /* Consistent padding */
  font-size: 1em; /* Consistent font size */
}

/* Address Suggestions Styles */
.suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.suggestion-item:hover {
  background-color: #f5f5f5;
}

.suggestion-item:not(:last-child) {
  border-bottom: 1px solid #eee;
}

/* Address Input Container */
.form-group {
  position: relative;
}

/* Address Suggestions Container */
#address-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 2px;
}

/* Ensure input field has proper z-index */
#partialAddress {
  position: relative;
  z-index: 1001;
}

/* Confidence Score Colors for Fix and Flip Results */
.confidence-high {
  color: #28a745; /* Bootstrap success green */
  font-weight: bold;
}

.confidence-medium {
  color: #ffc107; /* Bootstrap warning yellow */
  font-weight: bold;
}

.confidence-low {
  color: #dc3545; /* Bootstrap danger red */
  font-weight: bold;
}

/* Fix and Flip Results Table Styling */
#fixAndFlipResultsTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

#fixAndFlipResultsTable th,
#fixAndFlipResultsTable td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

#fixAndFlipResultsTable th {
  background-color: #f8f9fa;
  font-weight: bold;
}

/* Add spacing between Est. Profit and ROI columns */
#fixAndFlipResultsTable th:nth-child(8), /* Est. Profit header */
#fixAndFlipResultsTable td:nth-child(8) { /* Est. Profit data */
  padding-right: 20px;
}

#fixAndFlipResultsTable th:nth-child(9), /* ROI header */
#fixAndFlipResultsTable td:nth-child(9) { /* ROI data */
  padding-left: 15px;
}

/* Make ROI column clickable for sorting */
.sortable-roi-header {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.sortable-roi-header:hover {
  background-color: #e9ecef;
}

.sortable-roi-header::after {
  content: " ↕";
  opacity: 0.5;
  font-size: 0.8em;
}
