/**
 * Property Snapshot Popup Styles
 * Hover/Long-Press Quick Preview
 */

/* ========== POPUP CONTAINER ========== */

#property-snapshot-popup {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  max-width: 320px;
  width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

#property-snapshot-popup.show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* Desktop: positioned popup */
@media (min-width: 769px) {
  #property-snapshot-popup {
    position: fixed;
  }
}

/* Mobile: bottom sheet */
#property-snapshot-popup.mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 100%;
  width: 100%;
  border-radius: 16px 16px 0 0;
  max-height: 85vh;
  transform: translateY(100%);
}

#property-snapshot-popup.mobile.show {
  transform: translateY(0);
}

/* ========== CLOSE BUTTON ========== */

.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s ease;
}

.popup-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========== CONTENT ========== */

.popup-content {
  padding: 16px;
}

.popup-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* ========== HEADER ========== */

.popup-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.popup-image {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

.popup-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popup-title-section {
  flex: 1;
  min-width: 0;
}

.popup-title {
  font-family: 'Instrument Serif', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.popup-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-top: 2px;
}

/* ========== DIVIDER ========== */

.popup-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ========== SECTIONS ========== */

.popup-section {
  margin: 12px 0;
}

.popup-ai-score {
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  text-align: center;
  padding: 8px 12px;
  background: rgba(245, 166, 35, 0.1);
  border-radius: 6px;
}

/* ========== METRICS ========== */

.popup-metrics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popup-metric {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  padding: 4px 0;
}

.popup-metric strong {
  color: var(--accent);
}

/* ========== ACTIONS ========== */

.popup-action-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 8px 0;
}

.popup-btn-icon {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Satoshi', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.popup-btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.popup-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.popup-btn {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Satoshi', sans-serif;
}

.popup-btn-primary {
  background: var(--color-orange-primary);
  color: var(--color-text-inverse);
}

.popup-btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.3);
}

.popup-btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.popup-btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

/* ========== INFO ICON ========== */

.property-snapshot-info-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 92, 99, 0.8);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
}

/* Override teal-primary if needed */
@supports (--color-check: true) {
  .property-snapshot-info-icon {
    background: rgba(var(--color-teal-primary, 13 92 99), 0.8);
  }
}

.property-snapshot-info-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: scale(1.1);
}

/* Ensure property header can contain the info icon */
.property-header {
  position: relative;
}

/* ========== SCROLLBAR ========== */

#property-snapshot-popup::-webkit-scrollbar {
  width: 6px;
}

#property-snapshot-popup::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

#property-snapshot-popup::-webkit-scrollbar-thumb {
  background: rgba(245, 166, 35, 0.3);
  border-radius: 3px;
}

#property-snapshot-popup::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 166, 35, 0.5);
}

/* ========== MOBILE SWIPE INDICATOR ========== */

#property-snapshot-popup.mobile::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--text-dim);
  border-radius: 2px;
  opacity: 0.5;
}

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

@media (max-width: 768px) {
  .popup-header {
    flex-direction: row;
  }

  .popup-image {
    width: 70px;
    height: 70px;
  }

  .popup-title {
    font-size: 15px;
  }

  .popup-subtitle {
    font-size: 12px;
  }

  .popup-metric {
    font-size: 12px;
  }

  .popup-ai-score {
    font-size: 13px;
  }

  .property-snapshot-info-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
}

/* ========== ACCESSIBILITY ========== */

/* Focus styles for keyboard navigation */
.popup-btn:focus,
.popup-btn-icon:focus,
.popup-close:focus,
.property-snapshot-info-icon:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  #property-snapshot-popup,
  .popup-btn,
  .popup-btn-icon,
  .property-snapshot-info-icon {
    transition: none;
  }
}

/* ========== PRINT STYLES ========== */

@media print {
  /* Hide everything except print content */
  body > *:not(#snapshot-print-container) {
    display: none !important;
  }

  #snapshot-print-container {
    display: block !important;
  }

  .snapshot-print-only {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: white;
    color: black;
    padding: 20px;
  }

  .print-snapshot {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Satoshi', sans-serif;
  }

  .print-header {
    border-bottom: 2px solid #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
  }

  .print-header h1 {
    margin: 0;
    font-size: 24px;
    color: #000;
  }

  .print-location {
    margin: 5px 0 0 0;
    font-size: 14px;
    color: #666;
  }

  .print-section {
    margin: 20px 0;
  }

  .print-section h2 {
    font-size: 18px;
    color: #000;
    margin: 0 0 10px 0;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
  }

  .print-table td {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
  }

  .print-table td:first-child {
    width: 40%;
  }

  .print-footer {
    margin-top: 40px;
    padding-top: 10px;
    border-top: 1px solid #ccc;
    font-size: 12px;
    color: #666;
    text-align: center;
  }
}

/* Hide print container when not printing */
.snapshot-print-only {
  display: none;
}

/* ========== ANIMATIONS ========== */

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

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