/**
 * Estimation Graphic Visualization CSS - Switched Axes Version
 *
 * Horizontal-axes timeline visualization for property estimates.
 * - Horizontal axis: Time (left = recent, right = old)
 * - Vertical axis: Price (top = high, bottom = low)
 * - Proportional horizontal spacing based on days since sale
 *
 * @package BananaProperty\MlsEstimator
 */

/* Main Container */
.mlsesw-graphic-visualization {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Timeline Container */
.mlsesw-timeline-container {
  position: relative;
  min-height: 500px;
  height: 400px;
  margin: 2rem 0;
  margin-left: 70px;
  margin-right: 20px;
  padding: 20px;
  background: linear-gradient(to right, #f8f9fa 0%, #fff 100%);
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  overflow: visible;
}

/* X-axis (Time/Days Ago) - horizontal */
.mlsesw-x-axis {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -40px;
  height: 35px;
}

.mlsesw-x-axis .mlsesw-axis-label {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-weight: bold;
  font-size: 0.875rem;
  color: #555;
}

.mlsesw-x-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: #777;
}

.mlsesw-x-tick::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 5px;
  background: #999;
}

/* Y-axis (Price) - vertical */
.mlsesw-y-axis {
  position: absolute;
  left: -60px;
  top: 0;
  bottom: 0;
  width: 50px;
}

.mlsesw-y-axis .mlsesw-axis-label {
  position: absolute;
  top: 50%;
  left: -10px;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: center;
  font-weight: bold;
  font-size: 0.875rem;
  color: #555;
  white-space: nowrap;
}

.mlsesw-y-tick {
  position: absolute;
  right: 0;
  width: 100%;
  text-align: right;
  font-size: 0.75rem;
  color: #777;
  transform: translateY(-50%);
}

.mlsesw-y-tick::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 5px;
  height: 1px;
  background: #999;
}

/* Estimate Reference Line (Horizontal) */
.mlsesw-estimate-line-horizontal {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px dashed #e53e3e;
  z-index: 1;
}

/* Estimate Marker (Circle, Red) */
.mlsesw-estimate-marker {
  position: absolute;
  width: 24px;
  height: 24px;
  right: 20px;
  top: var(--vertical-pos);
  transform: translate(50%, -50%);
  z-index: 5;
}

.mlsesw-estimate-marker .mlsesw-price-marker {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e53e3e;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 3;
}

/* Estimate Info Bubble (positioned in top right corner of timeline container) */
.mlsesw-timeline-container .mlsesw-estimate-info {
  position: absolute;
  bottom: 60px;
  right: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #e53e3e;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  z-index: 4;
  pointer-events: none;
}

.mlsesw-estimate-row {
  display: grid;
  grid-template-columns: max-content auto;
  gap: 6px;
  align-items: center;
}

.mlsesw-estimate-label {
  font-size: 0.625rem;
  color: #666;
  text-align: right;
  white-space: nowrap;
}

.mlsesw-estimate-price {
  font-weight: bold;
  font-size: 0.75rem;
  color: #333;
  text-align: left;
}

.mlsesw-estimate-value {
  font-weight: bold;
  font-size: 0.75rem;
  color: #333;
  text-align: left;
}

.mlsesw-estimate-stars {
  display: flex;
  gap: 1px;
  text-align: left;
}

.mlsesw-star {
  font-size: 1.2rem;
  line-height: 1;
}

.mlsesw-star-full {
  color: #FFD700;
}

.mlsesw-star-half {
  color: #FFD700;
  opacity: 0.6;
}

.mlsesw-star-empty {
  color: #FFD700;
  opacity: 0.3;
}

/* Comparable Item */
.mlsesw-comparable-item {
  position: absolute;
  width: 24px;
  height: 24px;
  left: var(--horizontal-pos);
  top: var(--vertical-pos);
  transform: translate(-50%, -50%);
  z-index: 3;
}

/* Bring hovered item to front */
.mlsesw-comparable-item:hover {
  z-index: 10;
}

/* Price Marker Dot (Bigger) */
.mlsesw-price-marker {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 3;
  transition: all 0.2s ease;
}

.mlsesw-comparable-item:hover .mlsesw-price-marker {
  width: 18px;
  height: 18px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

/* Recency Colors for Marker */
.mlsesw-comparable-item.mlsesw-recency-very-recent .mlsesw-price-marker {
  background: #ed8936;
}

.mlsesw-comparable-item.mlsesw-recency-recent .mlsesw-price-marker {
  background: #48bb78;
}

.mlsesw-comparable-item.mlsesw-recency-moderate .mlsesw-price-marker {
  background: #4299e1;
}

.mlsesw-comparable-item.mlsesw-recency-old .mlsesw-price-marker {
  background: #a0aec0;
}

/* Info Label (Always Visible - positioned to left in switched mode) */
.mlsesw-comparable-info {
  position: absolute;
  right: 25px;
  left: auto;
  top: 40%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgba(255, 255, 255, 0.95);
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid #ddd;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  z-index: 4;
  pointer-events: none;
  text-align: right;
}

.mlsesw-price-label {
  font-size: 0.75rem;
  color: #333;
  font-weight: bold;
  text-align: right;
}

.mlsesw-details-label {
  font-size: 0.65rem;
  color: #666;
  line-height: 1.2;
  text-align: right;
}

.mlsesw-days-label {
  font-size: 0.5625rem;
  color: #666;
}

/* Legend */
.mlsesw-graphic-legend {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e0e0e0;
}

.mlsesw-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #555;
}

.mlsesw-legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mlsesw-legend-color.mlsesw-recency-very-recent {
  background: #ed8936;
}

.mlsesw-legend-color.mlsesw-recency-recent {
  background: #48bb78;
}

.mlsesw-legend-color.mlsesw-recency-moderate {
  background: #4299e1;
}

.mlsesw-legend-color.mlsesw-recency-old {
  background: #a0aec0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .mlsesw-graphic-visualization {
    padding: 1rem;
  }

  .mlsesw-timeline-container {
    height: 400px;
    min-height: 400px;
    margin-left: 50px;
  }

  .mlsesw-y-axis {
    left: -40px;
    width: 30px;
  }

  .mlsesw-graphic-legend {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .mlsesw-comparable-info {
    right: 25px;
    font-size: 0.75rem;
  }

  .mlsesw-price-label {
    font-size: 0.625rem;
  }

  .mlsesw-days-label {
    font-size: 0.5rem;
  }
}
