/* ============================================
   StaySTRA Analyzer - version 0.3.2 Block Styles
   Simplified to use shared utility classes
   ============================================ */

/* --- Overlay Styles for Performance Optimization --- */
.staystra-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-color: rgba(0, 0, 0, 0.85) !important;
  z-index: 9999 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
}

.staystra-overlay--visible {
  display: flex !important;
}

.staystra-overlay__content {
  text-align: center !important;
  color: white !important;
}

.staystra-overlay__spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: staystra-spin 1s linear infinite;
}

.staystra-overlay__title {
  font-size: 2rem !important;
  font-weight: bold !important;
  margin-bottom: 10px !important;
}

.staystra-overlay__subtitle {
  font-size: 1.1rem !important;
  color: rgba(255, 255, 255, 0.9) !important;
  margin-bottom: 10px !important;
}

.staystra-overlay__timer {
  font-size: 0.9rem !important;
  color: rgba(255, 255, 255, 0.7) !important;
}

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

/* --- Global Container --- */
.staystra-analyzer-container {
  overflow: visible;
}

/* --- Analyzer Form Specific Styles --- */
.staystra-analyzer-form {
  max-width: 700px;
  margin: 0 auto;
  display: block;
}

/* Ensure form has proper spacing when no results */
.staystra-analyzer-form:not(.has-results) {
  margin-bottom: 3rem;
}

/* Minor adjustments to shared card for analyzer needs */
.staystra-analyzer-form.staystra-card {
  /* Let shared styles handle most styling */
  background-color: var(--staystra-color-bg-light);
  padding: 2rem 4rem 3rem 4rem; /* Reduced top padding from 3rem to 2rem */
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

/* Ensure proper margin for form groups */
.staystra-analyzer-form .staystra-form__group {
  margin-bottom: 0; /* Grid handles spacing */
}

/* Adjust grid spacing for the 3-column layout */
.staystra-analyzer-form .staystra-grid--3-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: calc(2rem + var(--staystra-space-2)); /* Added 0.5rem (8px) */
  width: 100%;
}

/* Ensure all form inputs in the grid fill their containers */
.staystra-analyzer-form .staystra-grid--3-col .staystra-form__input {
  width: 100%;
}

/* --- Google Places Autocomplete Styles --- */
/* Style the PlaceAutocompleteElement container */
gmp-place-autocomplete {
  width: 100%;
  display: block;
  margin: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  height: 50px; /* Match input height */
}

/* Ensure both analyzer forms have consistent autocomplete styling */
.staystra-analyzer-form gmp-place-autocomplete,
.staystra-quick-analyzer gmp-place-autocomplete {
  background-color: white;
  border: 1px solid #d1d5db;
  border-radius: var(--staystra-radius-md);
}

/* Ensure the autocomplete dropdown appears above other elements */
.pac-container {
  z-index: 10000 !important;
}

/* Address input specific margin and width */
.staystra-analyzer-form .staystra-mb-5 {
  margin-bottom: 1.25rem !important; /* Reduced from 2rem */
  width: 100%;
}

/* Ensure address input container spans full width */
.staystra-analyzer-form .staystra-form__group:first-of-type {
  width: 100%;
}

/* Form input adjustments for analyzer */
.staystra-analyzer-form .staystra-form__input {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  height: 50px;
  border: 1px solid #d1d5db;
  background-color: white;
  box-sizing: border-box;
  border-radius: var(--staystra-radius-md);
}

.staystra-analyzer-form .staystra-form__input:focus {
  outline: none;
  border-color: var(--staystra-color-primary);
  box-shadow: 0 0 0 3px rgba(0, 115, 230, 0.1);
}

/* Large input for address field */
.staystra-analyzer-form .staystra-form__input--large {
  height: 50px;
  font-size: 1rem;
  width: 100%;
}

/* Button adjustments */
.staystra-analyzer-form .staystra-button--primary {
  padding: 0.75rem 2rem;
  font-size: 1.125rem;
  font-weight: 500;
  height: 50px;
  min-width: 140px;
}

/* Form label adjustments - smaller font */
.staystra-analyzer-form .staystra-form__label {
  font-size: var(--staystra-text-sm);  /* 0.85rem = 13.6px */
  color: #374151;
  margin-bottom: 0.375rem;
  text-transform: none;  /* Changed from uppercase */
  letter-spacing: 0;     /* Removed letter spacing */
  font-weight: 500;      /* Medium weight */
  display: block;
}

/* Title styling using CSS variables */
.staystra-analyzer-form .staystra-title--h2 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--staystra-color-dark);
  margin: 0 0 2rem 0;
  text-align: center;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .staystra-analyzer-form .staystra-flex--between {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .staystra-analyzer-form .staystra-button--primary {
    width: 100%;
  }
}

/* --- Quick Analyzer Specific Styles --- */
.staystra-quick-analyzer {
  max-width: 600px;
  margin: 0 auto;
}

/* Quick analyzer form container */
.staystra-analyzer__form-container {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Quick analyzer form - ensure proper flex layout */
.staystra-quick-analyzer .staystra-analyzer__form-container {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Quick analyzer input inherits from shared styles, just needs flex behavior */
.staystra-quick-analyzer .staystra-form__input {
  flex: 1; /* Take up remaining space */
  min-width: 200px; /* Allow it to shrink but not too much */
}

/* Quick analyzer uses the same large input style as main form */
.staystra-quick-analyzer .staystra-form__input--large {
  height: 50px;
  font-size: 1rem;
}

/* Ensure quick analyzer input has proper background and text color */
.staystra-quick-analyzer input.staystra-form__input,
.staystra-quick-analyzer input#quickInputAddress,
#quickInputAddress.staystra-form__input {
  background-color: white !important;
  color: #333 !important;
  padding: 0.75rem 1rem !important;
  border: 1px solid #d1d5db !important;
}

/* Force text color in quick analyzer autocomplete */
.staystra-quick-analyzer gmp-place-autocomplete input,
gmp-place-autocomplete input#quickInputAddress {
  color: #333 !important;
  -webkit-text-fill-color: #333 !important;
}

/* Additional specificity for quick analyzer input text color */
.wp-block-staystra-quick-analyzer-input input,
.wp-block-staystra-quick-analyzer-input input[type="text"],
.wp-block-staystra-quick-analyzer-input .staystra-form__input {
  color: #333 !important;
  -webkit-text-fill-color: #333 !important;
}

/* Quick analyzer button - match main form styling */
.staystra-quick-analyzer .staystra-button--primary {
  padding: 0.75rem 2rem;
  font-size: 1.125rem;
  font-weight: 500;
  height: 50px;
  min-width: 140px;
}

/* --- Analyzer Results Specific Styles --- */
.staystra-analyzer-results {
  width: 100%;
}

/* Ensure results don't appear until analysis is complete */
#analyzerResult:not(.staystra-hidden) {
  display: block;
}

/* Column-based layout */
.staystra-columns-wrapper {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.staystra-column-main {
  flex: 2 1 0;
  min-width: 350px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.staystra-column-sidebar {
  flex: 1 1 0;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Ensure sections in columns have consistent styling */
.staystra-column-main .staystra-section,
.staystra-column-sidebar .staystra-section {
  margin-bottom: 0; /* Gap handled by column flex gap */
}


/* --- Remove number input arrows globally --- */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none; 
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield; 
    appearance: textfield;
}

/* Result Section Headings */
#analyzerResult h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--staystra-color-dark);
  margin-top: 0;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--staystra-color-border-light);
}

/* Exception for Property Details header which has its own border */
.staystra-property-header h2 {
  border-bottom: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* --- RESULT SECTION Specific Styles --- */

/* General section styling for results */
.staystra-section,
#analyzerResult .staystra-stats,
#analyzerResult .staystra-comps {
  background-color: var(--staystra-color-bg-light);
  border: 1px solid var(--staystra-color-border);
  border-radius: var(--staystra-radius-lg);
  padding: var(--staystra-space-6) var(--staystra-space-8);
  box-shadow: var(--staystra-shadow-md);
  margin-bottom: 1.5rem;
  display: block;
  clear: both;
}

/* Compact section modifier for tight spacing */
.staystra-section--compact {
  padding: var(--staystra-space-4) var(--staystra-space-6);
}

/* Ensure equal padding for both top boxes */
.staystra-analyzer-results__property-details .staystra-section--compact,
.staystra-analyzer-results__revenue-forecast.staystra-section--compact {
  padding: var(--staystra-space-4) var(--staystra-space-6);
}

/* Make Property Details and Revenue Forecast equal height */
.staystra-columns-wrapper {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.staystra-column-main {
  flex: 2;
}

.staystra-column-sidebar {
  flex: 1;
}

/* Make the first section in each column the same height */
.staystra-column-main > .staystra-section:first-child,
.staystra-column-sidebar > .staystra-section:first-child {
  min-height: 290px;
  display: flex;
  flex-direction: column;
}

/* Ensure content fills available space in Revenue Forecast */
.staystra-column-sidebar .staystra-section .data-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Remove all internal margins for compact sections */
.staystra-section--compact .staystra-property-header {
  margin-bottom: var(--staystra-space-3);
}

.staystra-section--compact .property-details-grid {
  margin-bottom: 0;
}

.staystra-section--compact .property-card-link {
  margin-top: var(--staystra-space-3);
  margin-bottom: 0;
}

.staystra-section--compact h2 {
  margin-bottom: var(--staystra-space-3);
  padding-bottom: var(--staystra-space-2);
}

.staystra-section--compact .revenue-metrics-row {
  margin-bottom: var(--staystra-space-3);
}

.staystra-section--compact .data-block {
  margin-bottom: 0;
}

/* Data Block styling within Results */
#analyzerResult .data-block {
  padding: 0;
}

#analyzerResult .data-block .stat-label {
   font-size: var(--staystra-text-sm);
   color: var(--staystra-color-gray);
   font-weight: 500;
   margin-top: 0.5rem;
   margin-bottom: 0.1rem;
   display: block;
}

#analyzerResult .data-block .stat-value {
  font-size: var(--staystra-text-lg);
  font-weight: 600;
  color: var(--staystra-color-dark);
  margin-bottom: 0.5rem;
  line-height: 1.3;
  display: block;
}

/* Property card specific styles */
.staystra-property-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--staystra-color-border-light);
  padding-bottom: 0.5rem;
}

.staystra-property-header__title {
  font-size: var(--staystra-text-2xl);
  font-weight: 600;
  color: var(--staystra-color-dark);
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

.staystra-property-header__address {
  font-size: var(--staystra-text-base);
  font-weight: 600;
  color: var(--staystra-color-gray-dark);
  margin: 0;
  padding: 0;
  text-align: right;
  line-height: 1.2;
  max-width: 60%;
}

.property-card-content {
  display: flex;
  gap: 1.5rem;
  flex: 1;
  align-items: stretch;
}

.property-card-image {
  flex-shrink: 0;
  width: 300px;
  height: 240px;
  overflow: hidden;
  border-radius: var(--staystra-radius-md);
  background-color: var(--staystra-color-bg-section);
  position: relative;
}

.property-card-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.property-card-image-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--staystra-color-gray-light);
}

.property-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.property-card-link {
  margin-top: auto;
}

.property-card-price {
  font-size: var(--staystra-text-2xl);
  font-weight: 600;
  color: var(--staystra-color-dark);
  margin-bottom: 0.5rem;
}

.staystra-analyzer__price-indicator {
  font-size: var(--staystra-text-xs);
  color: var(--staystra-color-gray);
  font-weight: normal;
  margin-left: var(--staystra-space-2);
}

.property-card-specs {
  font-size: var(--staystra-text-base);
  color: var(--staystra-color-gray);
  margin-bottom: 1rem;
}

.property-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.property-detail-item {
  display: flex;
  flex-direction: column;
}

.property-detail-label {
  font-size: var(--staystra-text-xs);
  color: var(--staystra-color-gray);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.property-detail-value {
  font-size: var(--staystra-text-base);
  color: var(--staystra-color-dark);
  font-weight: 500;
}

.property-card-link a {
  color: var(--staystra-color-primary);
  text-decoration: none;
  font-size: var(--staystra-text-sm);
}

.property-card-link a:hover {
  text-decoration: underline;
}

/* Revenue metrics styling */
.revenue-metrics-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0;
}

.revenue-metric {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.revenue-tiers {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.revenue-tier-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--staystra-color-border-light);
}

.revenue-tier-item:last-child {
  border-bottom: none;
  padding-bottom: 0.375rem; /* Reduced padding */
}

.tier-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tier-name {
  font-size: var(--staystra-text-base);
  color: var(--staystra-color-dark);
  font-weight: 500;
}

.tier-grm {
  font-size: var(--staystra-text-xs);
  color: var(--staystra-color-gray);
}

.tier-value {
  font-size: var(--staystra-text-2xl);
  font-weight: 600;
  color: var(--staystra-color-primary);
}

/* Comparable properties table */
.comps-table {
  width: 100%;
  margin-top: 1rem;
}

.comps-table th,
.comps-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--staystra-color-border-light);
}

.comps-table th {
  font-weight: 600;
  color: var(--staystra-color-gray-dark);
  font-size: var(--staystra-text-sm);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

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

/* Footer styling */
.staystra-analyzer-footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
  border-top: 1px solid var(--staystra-color-border-light);
}

.staystra-analyzer__version {
  font-size: var(--staystra-text-xs);
  color: var(--staystra-color-gray-light);
}

/* Expense mode content */
.staystra-expense-mode__content {
  margin-top: var(--staystra-space-4);
}

.staystra-expense-mode__content--hidden {
  display: none;
}

/* SEO content (hidden) */
.staystra-analyzer__seo-content {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: -1;
}

/* Loading and error states */
.staystra-loading {
  text-align: center;
  padding: 3rem;
  color: var(--staystra-color-gray);
}

.staystra-error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--staystra-radius-md);
  padding: 1rem;
  color: var(--staystra-color-error);
  margin: 1rem 0;
}

/* --- Investment Analysis Section --- */
.staystra-purchase-section {
  margin-bottom: var(--staystra-space-4); /* Reduced from space-8 */
}

.staystra-purchase-section h3 {
  font-size: var(--staystra-text-xl);
  font-weight: 600;
  color: var(--staystra-color-dark);
  margin-bottom: var(--staystra-space-2); /* Reduced from space-4 */
}

.staystra-purchase-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--staystra-space-4); /* Reduced from space-8 */
}

.staystra-purchase-column {
  display: flex;
  flex-direction: column;
  gap: var(--staystra-space-1); /* Reduced from space-2 */
}

.staystra-input-row,
.staystra-display-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0; /* Removed vertical padding */
  width: 100%;
  min-height: 36px; /* Reduced from 42px */
}

.staystra-input-row label,
.staystra-display-row label {
  font-size: var(--staystra-text-sm);
  color: var(--staystra-color-gray-dark);
  font-weight: 500;
}

.staystra-currency-input {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.staystra-currency-symbol {
  position: absolute;
  left: var(--staystra-space-3);
  color: var(--staystra-color-gray);
  font-size: var(--staystra-text-base);
}

.staystra-financial-input {
  padding: var(--staystra-space-2) var(--staystra-space-3);
  border: 1px solid var(--staystra-color-border);
  border-radius: var(--staystra-radius-sm);
  font-size: var(--staystra-text-base);
  width: 150px;
  text-align: right;
  background-color: white;
  transition: border-color 0.2s ease;
}

.staystra-financial-input.staystra-currency-field {
  padding-left: var(--staystra-space-8);
}

.staystra-financial-input:focus {
  outline: none;
  border-color: var(--staystra-color-primary);
  box-shadow: 0 0 0 3px rgba(0, 115, 230, 0.1);
}

/* Readonly financial inputs */
.staystra-financial-input[readonly],
.staystra-financial-input:read-only {
  background-color: #f5f7fa;
  color: #4a5568;
  cursor: not-allowed;
  border-color: #e2e8f0;
}

.staystra-financial-input[readonly]:focus,
.staystra-financial-input:read-only:focus {
  border-color: #e2e8f0;
  box-shadow: none;
}

.staystra-percent-input {
  width: 60px;
  padding-left: var(--staystra-space-3);
  text-align: center;
}

.staystra-percent-symbol {
  margin-left: var(--staystra-space-1);
  color: var(--staystra-color-gray);
}

.staystra-down-payment-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.staystra-down-payment-display .staystra-percent-input {
  margin-left: 0;
}

.staystra-calculated-amount,
.staystra-calculated-value {
  font-weight: 600;
  color: var(--staystra-color-dark);
  font-size: var(--staystra-text-base);
}

.staystra-piti-summary {
  margin-top: var(--staystra-space-2); /* Reduced from space-4 */
  margin-bottom: var(--staystra-space-3); /* Reduced from space-6 */
  padding: var(--staystra-space-3) var(--staystra-space-6); /* Reduced vertical padding */
  background-color: #e8f4fd; /* Light blue background */
  border-radius: var(--staystra-radius-md);
  border: 1px solid #b8e0f5;
}

.staystra-piti-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.staystra-piti-item span:first-child {
  font-size: var(--staystra-text-xl);
  font-weight: 600;
  color: #004080; /* Darker blue for label */
}

.staystra-piti-value {
  font-size: var(--staystra-text-xl);
  font-weight: 600;
  color: #0056b3; /* Darker blue to contrast with light blue background */
  text-align: right;
  display: inline-block;
  min-width: 150px;
}

/* Single PITI value (Monthly PITI) needs right padding */
.staystra-piti-item > .staystra-piti-value {
  padding-right: var(--staystra-space-6);
}

.staystra-piti-values {
  display: inline-block;
  text-align: right;
  padding-right: var(--staystra-space-6);
}

.staystra-piti-values .staystra-piti-value {
  display: inline-block;
  width: 150px;
  text-align: right;
}

/* Summary Tables - All blue boxes now use table structure for alignment */
.staystra-summary-table {
  width: 100%;
  margin-top: var(--staystra-space-4);
  margin-bottom: var(--staystra-space-6);
  background-color: #e8f4fd; /* Light blue background */
  border-radius: var(--staystra-radius-md);
  border: 1px solid #b8e0f5;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.staystra-summary-table td {
  padding: var(--staystra-space-4) var(--staystra-space-6);
  vertical-align: middle;
}

/* First column - label */
.staystra-summary-table td:first-child {
  width: 50%;
  font-size: var(--staystra-text-xl);
  font-weight: 600;
  color: #004080; /* Darker blue for label */
}

/* Annual column */
.staystra-summary-table td:nth-child(2) {
  width: 25%;
  text-align: right;
  font-size: var(--staystra-text-xl);
  font-weight: 600;
  color: #0056b3; /* Lighter blue for values */
  padding-right: var(--staystra-space-4);
}

/* Monthly column */
.staystra-summary-table td:nth-child(3) {
  width: 25%;
  text-align: right;
  font-size: var(--staystra-text-xl);
  font-weight: 600;
  color: #0056b3; /* Lighter blue for values */
  padding-right: var(--staystra-space-6);
}

/* Monthly PITI (single value) */
.staystra-summary-table.staystra-piti-single td:nth-child(2) {
  width: 50%;
  text-align: right;
  padding-right: var(--staystra-space-6);
}

/* Keep old styles for backward compatibility during transition */
.staystra-noi-summary {
  margin-top: var(--staystra-space-4);
  margin-bottom: var(--staystra-space-6);
  padding: var(--staystra-space-4) 0;
  background-color: #e8f4fd; /* Light blue background */
  border-radius: var(--staystra-radius-md);
  border: 1px solid #b8e0f5;
}

.staystra-noi-container {
  display: table;
  width: 100%;
}

.staystra-noi-label {
  display: table-cell;
  width: auto;
  padding: 0 var(--staystra-space-6);
  font-size: var(--staystra-text-xl);
  font-weight: 600;
  color: #004080; /* Darker blue for label */
  vertical-align: middle;
}

.staystra-noi-values {
  display: table-cell;
  width: auto;
  text-align: right;
  padding-right: var(--staystra-space-6);
}

.staystra-noi-annual,
.staystra-noi-monthly {
  display: inline-block;
  width: 150px;
  text-align: right;
}

.staystra-noi-value {
  font-size: var(--staystra-text-xl);
  font-weight: 600;
  color: #0056b3; /* Darker blue to contrast with light blue background */
}

/* Proforma Table */
.staystra-proforma-section {
  margin-bottom: var(--staystra-space-4); /* Reduced from space-8 */
}

.staystra-proforma-section h3 {
  font-size: var(--staystra-text-xl);
  font-weight: 600;
  color: var(--staystra-color-dark);
  margin-bottom: var(--staystra-space-4);
}

/* Table section header styling */
.staystra-table-section-header {
  font-size: var(--staystra-text-xl) !important;
  font-weight: 600 !important;
  color: var(--staystra-color-dark) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  text-align: left !important;
}

.staystra-proforma-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--staystra-radius-md);
  overflow: hidden;
  table-layout: fixed; /* Force consistent column widths */
}

/* Revenue table (3 columns) - default layout */
.staystra-proforma-table:not(.staystra-expenses-table) th:first-child,
.staystra-proforma-table:not(.staystra-expenses-table) td:first-child {
  width: 50%; /* First column takes half the width */
}

.staystra-proforma-table:not(.staystra-expenses-table) th:nth-child(2),
.staystra-proforma-table:not(.staystra-expenses-table) td:nth-child(2),
.staystra-proforma-table:not(.staystra-expenses-table) th:nth-child(3),
.staystra-proforma-table:not(.staystra-expenses-table) td:nth-child(3) {
  width: 25%; /* Annual and Monthly columns each take 25% */
}

/* Operating Expenses table - all rows have 4 columns */
.staystra-expenses-table th:first-child {
  width: 50% !important; /* Spans first two columns */
}

.staystra-expenses-table th:nth-child(2),
.staystra-expenses-table th:nth-child(3) {
  width: 25% !important;
  text-align: right; /* Align Annual and Monthly headers to the right like the values */
}

/* All rows in expenses table use 4 columns */
.staystra-expenses-table td:first-child,
.staystra-expenses-table td:nth-child(2) {
  width: 25% !important;
}

.staystra-expenses-table td:nth-child(3),
.staystra-expenses-table td:nth-child(4) {
  width: 25% !important;
  text-align: right;
}

/* Currency inputs in the table should align right */
.staystra-expenses-table td:nth-child(3) .staystra-currency-input,
.staystra-expenses-table td:nth-child(4) .staystra-currency-input {
  margin-left: auto;
}

/* Style the percentage cell */
.staystra-percent-cell {
  text-align: center !important;
  white-space: nowrap;
}

.staystra-percent-cell .staystra-percent-input {
  width: 60px;
  text-align: center;
  padding-left: var(--staystra-space-3);
}

/* Make property management percentage field match loan term/interest rate width */
#propertyMgmtPercent {
  width: 60px;
  padding-left: var(--staystra-space-3);
  text-align: center;
}

.staystra-percent-cell .staystra-percent-symbol {
  margin-left: var(--staystra-space-1);
  color: var(--staystra-color-gray);
}

.staystra-proforma-table th {
  padding: var(--staystra-space-1) var(--staystra-space-4); /* Reduced vertical padding */
  text-align: left;
  font-weight: 600;
  font-size: var(--staystra-text-sm);
  color: var(--staystra-color-gray-dark);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.staystra-proforma-table th:last-child,
.staystra-proforma-table td:last-child {
  text-align: right;
}

/* Only apply right alignment to 2nd column for Revenue table (3 columns) */
.staystra-proforma-table:not(.staystra-expenses-table) th:nth-child(2),
.staystra-proforma-table:not(.staystra-expenses-table) td:nth-child(2) {
  text-align: right;
}

.staystra-proforma-table td {
  padding: var(--staystra-space-1) var(--staystra-space-4); /* Reduced vertical padding */
  border-bottom: none; /* Removed border lines */
  font-size: var(--staystra-text-base);
  color: var(--staystra-color-dark);
}

/* Currency inputs are already aligned by the rules above */

.staystra-proforma-table td .staystra-currency-input {
  display: inline-flex;
  position: relative;
  align-items: center;
  width: 150px;
  margin-left: auto;
}

.staystra-proforma-table td .staystra-financial-input {
  width: 100%;
  padding-left: var(--staystra-space-8);
  text-align: right;
}

/* Ensure dollar sign is properly positioned in table cells */
.staystra-proforma-table td .staystra-currency-symbol {
  position: absolute;
  left: var(--staystra-space-3);
  color: var(--staystra-color-gray);
  font-size: var(--staystra-text-base);
  pointer-events: none;
}

.staystra-proforma-table tr:last-child td {
  border-bottom: none;
}

/* No longer needed - total rows are now separate divs using .staystra-piti-summary class */

/* Financial Controls */
.staystra-financial-controls {
  display: flex;
  gap: var(--staystra-space-4);
  justify-content: flex-end;
  margin-top: var(--staystra-space-8);
  padding-top: var(--staystra-space-6);
  border-top: 1px solid var(--staystra-color-border-light);
}

/* --- Comparable Properties Section --- */
.staystra-comps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--staystra-space-6);
  margin-top: var(--staystra-space-4);
}

.staystra-comp-card {
  background-color: var(--staystra-color-bg-section);
  border: 1px solid var(--staystra-color-border);
  border-radius: var(--staystra-radius-md);
  padding: var(--staystra-space-6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.staystra-comp-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--staystra-shadow-lg);
}

.staystra-comp-card h4 {
  font-size: var(--staystra-text-base);
  font-weight: 600;
  color: var(--staystra-color-dark);
  margin-bottom: var(--staystra-space-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staystra-comp-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--staystra-space-2);
  font-size: var(--staystra-text-sm);
}

.staystra-comp-details span {
  padding: var(--staystra-space-1) 0;
  color: var(--staystra-color-gray-dark);
}

.staystra-comp-details span:nth-child(odd) {
  border-right: 1px solid var(--staystra-color-border-light);
  padding-right: var(--staystra-space-2);
}

.staystra-comp-details span:nth-child(even) {
  padding-left: var(--staystra-space-2);
}

/* Make revenue stand out */
.staystra-comp-details span:last-child {
  grid-column: 1 / -1;
  font-weight: 600;
  color: var(--staystra-color-primary);
  border-right: none;
  padding: var(--staystra-space-2) 0 0 0;
  border-top: 1px solid var(--staystra-color-border-light);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .staystra-columns-wrapper {
    flex-direction: column;
  }
  
  .staystra-column-main,
  .staystra-column-sidebar {
    min-width: 100%;
    width: 100%;
  }
  
  .property-card-content {
    flex-direction: column;
  }
  
  .property-card-image {
    width: 100%;
  }
  
  .property-details-grid {
    grid-template-columns: 1fr;
  }
  
  .revenue-metrics-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .staystra-purchase-columns {
    grid-template-columns: 1fr;
  }
  
  .staystra-comps-grid {
    grid-template-columns: 1fr;
  }
  
  .staystra-comps-list {
    grid-template-columns: 1fr;
  }
  
  .staystra-financial-controls {
    flex-direction: column;
  }
  
  .staystra-financial-controls button {
    width: 100%;
  }
}

/* ========================================
   Comparable Properties Map Section
   ======================================== */

/* Map Container */
.staystra-map-container {
  width: 100%;
  height: 450px;
  border-radius: var(--staystra-radius-lg);
  overflow: hidden;
  box-shadow: var(--staystra-shadow-md);
  margin-bottom: var(--staystra-space-6);
}

@media (max-width: 768px) {
  .staystra-map-container {
    height: 350px;
  }
}

/* Leaflet Popup Customization */
.staystra-popup-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.staystra-popup-link:hover .staystra-popup-content {
  background-color: #f9fafb;
}

.staystra-popup-link:hover .staystra-popup-price {
  text-decoration: underline;
}

.staystra-popup-content {
  padding: 0;
  min-width: 150px;
  max-width: 180px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

/* Remove Leaflet's default popup padding */
.leaflet-popup-content {
  margin: 0 !important;
  padding: 0 !important;
}

.leaflet-popup-content-wrapper {
  padding: 0 !important;
}

.staystra-popup-image {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: var(--staystra-radius-md) var(--staystra-radius-md) 0 0;
}

.staystra-popup-details {
  padding: var(--staystra-space-2);
}

.staystra-popup-title {
  font-size: var(--staystra-text-base);
  font-weight: 600;
  color: var(--staystra-color-dark);
  margin-bottom: var(--staystra-space-2);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.staystra-popup-stats {
  display: flex;
  gap: var(--staystra-space-3);
  margin-bottom: var(--staystra-space-2);
  font-size: var(--staystra-text-sm);
  color: var(--staystra-color-gray);
}

.staystra-popup-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--staystra-space-2);
  margin-bottom: var(--staystra-space-2);
  font-size: var(--staystra-text-xs);
}

.staystra-popup-metric {
  display: flex;
  align-items: center;
  gap: var(--staystra-space-1);
}

.staystra-popup-price {
  font-size: var(--staystra-text-base);
  font-weight: 600;
  color: var(--staystra-color-primary);
  margin-bottom: var(--staystra-space-2);
}

.staystra-popup-distance {
  font-size: var(--staystra-text-sm);
  color: var(--staystra-color-gray);
  margin-bottom: var(--staystra-space-3);
}

/* Button styles removed - popup is now fully clickable */

/* Comparables Table */
.staystra-comp-note {
  color: #6b7280;
  font-size: 0.875rem;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

.staystra-comps-table-wrapper {
  margin-top: var(--staystra-space-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.staystra-comps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: auto;
}

.staystra-comps-table thead {
  background-color: #f3f4f6;
  border-bottom: 2px solid var(--staystra-color-border);
}

.staystra-comps-table th {
  padding: var(--staystra-space-1) 6px;
  text-align: left;
  font-weight: 600;
  color: var(--staystra-color-dark);
  white-space: nowrap;
}

.staystra-comps-table th.staystra-sortable {
  cursor: pointer;
  user-select: none;
}

.staystra-comps-table th.staystra-sortable:hover {
  background-color: #e5e7eb;
}

.staystra-sort-indicator {
  font-size: 1em;
  color: var(--staystra-color-gray-dark);
  margin-left: 4px;
  font-weight: normal;
}

.staystra-comps-table th.sorted-asc .staystra-sort-indicator {
  color: var(--staystra-color-primary);
}

.staystra-comps-table th.sorted-asc .staystra-sort-indicator::after {
  content: '▲';
}

.staystra-comps-table th.sorted-desc .staystra-sort-indicator {
  color: var(--staystra-color-primary);
}

.staystra-comps-table th.sorted-desc .staystra-sort-indicator::after {
  content: '▼';
}

.staystra-comps-table tbody tr {
  border-bottom: 1px solid var(--staystra-color-border-light);
  transition: background-color 0.2s ease;
}

.staystra-comps-table tbody tr:hover {
  background-color: #f9fafb;
}

.staystra-comps-table tbody tr.active {
  background-color: #e0f2fe;
}

.staystra-comps-table td {
  padding: 4px 6px;
  vertical-align: middle;
}

/* Column-specific styling without fixed widths */

/* Checkbox column */
.staystra-comp-checkbox {
  text-align: center;
  white-space: nowrap;
  padding-left: 4px !important;
  padding-right: 4px !important;
}

.staystra-comp-checkbox input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

/* Number column */
.staystra-comps-table .staystra-comp-number {
  text-align: center;
  font-weight: 600;
  color: var(--staystra-color-primary);
  white-space: nowrap;
}

/* Title column - flexible width */
.staystra-comp-title {
  width: 100%;
  min-width: 150px;
}

.staystra-comp-title a,
.staystra-comp-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--staystra-color-primary);
  text-decoration: none;
}

.staystra-comp-title a:hover {
  text-decoration: underline;
}

/* Numeric columns */
.staystra-comp-beds,
.staystra-comp-baths,
.staystra-comp-guests {
  text-align: center;
  white-space: nowrap;
}

/* ADR column */
.staystra-comp-adr {
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
}

/* Distance column */
.staystra-comp-distance {
  text-align: center;
  white-space: nowrap;
}

/* Rating column */
.staystra-comp-rating {
  text-align: center;
  white-space: nowrap;
}

.staystra-comp-reviews {
  font-size: 0.85em;
  color: var(--staystra-color-gray);
  margin-left: 2px;
}


/* Custom Leaflet Marker */
.staystra-marker-icon {
  background-color: var(--staystra-color-primary);
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--staystra-text-sm);
  box-shadow: var(--staystra-shadow-md);
  border: 2px solid white;
}

.staystra-marker-icon.subject {
  background-color: #ff6384;
  width: 36px;
  height: 36px;
  font-size: var(--staystra-text-base);
}

/* Show More Button */
.staystra-show-more {
  text-align: center;
  margin-top: var(--staystra-space-6);
}

.staystra-show-more-button {
  display: inline-block;
  padding: var(--staystra-space-3) var(--staystra-space-6);
  background-color: white;
  color: var(--staystra-color-primary);
  border: 1px solid var(--staystra-color-primary);
  border-radius: var(--staystra-radius-md);
  font-size: var(--staystra-text-base);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.staystra-show-more-button:hover {
  background-color: var(--staystra-color-primary);
  color: white;
}

/* --- Google Places Autocomplete Styles --- */
.pac-container {
  font-family: var(--staystra-font-primary) !important;
  font-size: var(--staystra-text-base) !important;
  border: 1px solid var(--staystra-color-border) !important;
  border-radius: var(--staystra-radius-md) !important;
  box-shadow: var(--staystra-shadow-md) !important;
  margin-top: 2px;
  z-index: 9999 !important;
  background-color: white !important; /* Ensure white background */
}

.pac-item {
  padding: var(--staystra-space-3) var(--staystra-space-4) !important;
  border: none !important;
  border-bottom: 1px solid var(--staystra-color-bg-light) !important;
  cursor: pointer !important;
  line-height: 1.5 !important;
  background-color: white !important; /* Ensure white background */
  color: #333 !important; /* Ensure dark text color */
}

.pac-item:last-child {
  border-bottom: none !important;
}

.pac-item:hover,
.pac-item.pac-item-selected {
  background-color: var(--staystra-color-bg-light) !important;
  color: #333 !important; /* Maintain dark text on hover */
}

/* Ensure text elements within pac-item are also visible */
.pac-item span,
.pac-item-query {
  color: #333 !important;
}

/* Highlighted/matched text in suggestions */
.pac-matched {
  color: #000 !important;
  font-weight: 600 !important;
}

/* Ensure the autocomplete dropdown appears above other elements */
.staystra-analyzer-form {
  position: relative;
  z-index: 1;
}

/* --- Investment Overview Section --- */
/* No custom overrides needed - uses standard staystra-section styles */

.staystra-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.staystra-metric-card {
  background: white;
  border: 1px solid var(--staystra-color-border-light);
  border-radius: var(--staystra-radius-sm);
  padding: 0.875rem;
  transition: all 0.2s ease;
}

.staystra-metric-card:hover {
  box-shadow: var(--staystra-shadow-sm);
  border-color: var(--staystra-color-border);
}

.staystra-metric-label {
  font-size: 0.75rem;
  color: var(--staystra-color-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.staystra-metric-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--staystra-color-dark);
  line-height: 1.2;
  transition: color 0.3s ease;
}

.staystra-metric-value.positive {
  color: var(--staystra-color-success);
}

/* --- Tax Savings Section --- */
.staystra-tax-savings {
    /* Inherits standard spacing from .staystra-section */
}

.staystra-tax-note {
    margin-top: 15px;
    padding: 12px;
    background-color: #f8f9fa;
    border-left: 3px solid #28a745;
    font-size: 0.875rem;
    color: #6c757d;
}

.staystra-tax-note p {
    margin: 0;
}

.staystra-metric-value--highlight {
    color: #28a745;
    font-weight: 600;
}

.staystra-metric-value.negative {
  color: var(--staystra-color-error);
}

.staystra-metric-value.warning {
  color: #f59e0b;
}

.staystra-metric-subtext {
  font-size: 0.7rem;
  color: var(--staystra-color-gray-light);
  margin-top: 0.25rem;
}

@media (max-width: 1200px) {
  .staystra-metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* Authentication Modal */
.staystra-modal {
    display: none; /* Hidden by default, flex when shown */
    position: fixed; /* Stay in place */
    z-index: 9999; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.6); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

/* When modal is shown, use flex display */
.staystra-modal[style*="display: flex"],
.staystra-modal[style*="display:flex"] {
    display: flex !important;
}

.staystra-modal-content {
    background-color: #fff;
    margin: auto;
    padding: 2rem;
    border: none;
    border-radius: var(--staystra-radius-lg, 12px);
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease;
}

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

.staystra-modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 32px;
    font-weight: 300;
    color: var(--staystra-color-gray, #666);
    cursor: pointer;
    line-height: 20px;
    width: 32px;
    height: 32px;
    text-align: center;
    transition: color 0.2s ease;
}

.staystra-modal-close:hover,
.staystra-modal-close:focus {
    color: var(--staystra-color-dark, #333);
}

#staystra-auth-modal .staystra-modal-content {
    max-width: 440px;
    width: 90%;
    padding: 2.5rem;
    margin: 50px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#staystra-auth-modal h2 {
    color: var(--staystra-color-dark, #1a202c);
    margin: 0 0 0.75rem 0;
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
    width: 100%;
}

#staystra-auth-modal p {
    color: var(--staystra-color-gray, #4a5568);
    margin: 0 0 1.75rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
    width: 100%;
}

#staystra-auth-modal .staystra-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#staystra-auth-modal .staystra-form-group {
    margin-bottom: 1.25rem;
    width: 100%;
    max-width: 360px;
}

#staystra-auth-modal .staystra-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--staystra-color-border, #e2e8f0);
    border-radius: var(--staystra-radius-md, 6px);
    font-size: 1rem;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
    box-sizing: border-box;
}

.staystra-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--staystra-color-border, #e2e8f0);
    border-radius: var(--staystra-radius-md, 6px);
    font-size: 1rem;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.staystra-input::placeholder {
    color: var(--staystra-color-gray-light, #9ca3af);
}

#staystra-auth-modal .staystra-button {
    width: 100%;
    max-width: 360px;
    padding: 0.875rem 1.5rem;
    font-size: 1.0625rem;
    font-weight: 500;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
}

#staystra-auth-modal .staystra-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Generic form-group style */
.staystra-form-group {
    margin-bottom: 1.25rem;
}

/* Consent checkbox styles */
.staystra-consent-group {
    margin-bottom: 1rem;
    text-align: left;
}

.staystra-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #4b5563;
    position: relative;
}

.staystra-checkbox {
    margin-right: 0.5rem;
    margin-top: 0.125rem;
    min-width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.staystra-checkbox-label > span {
    flex: 1;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.staystra-required {
    color: #dc2626;
    margin-left: 0.125rem;
    font-weight: 500;
    display: inline;
    flex-shrink: 0;
}

#staystra-auth-modal .staystra-message {
    width: 100%;
    max-width: 360px;
}

.staystra-message {
    margin-top: 1.25rem;
    padding: 0.875rem 1rem;
    border-radius: var(--staystra-radius-md, 6px);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.staystra-message--success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.staystra-message--error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #f5c6cb;
}

.staystra-message--warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}