/* ══════════════════════════════════
   Apartment Floor Selector — Frontend
   ══════════════════════════════════ */

/* Container */
.afs-container { max-width: 1400px; margin: 0 auto; }

/* ── Building image + SVG overlay ── */
.afs-building-wrapper { position: relative; width: 100%; overflow: hidden; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
.afs-building-wrapper img { display: block; width: 100%; height: auto; }
.afs-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* Building name labels */
.afs-building-name { pointer-events: none; text-anchor: middle; font-size: 30px; font-weight: 700; fill: white; paint-order: stroke; stroke: rgba(0,0,0,0.7); stroke-width: 5px; }

/* ── Floor zones — planuojamas = dark, statomas = transparent ── */
.afs-zone { fill: rgba(0,0,0,0.30); stroke: rgba(255,255,255,0.15); stroke-width: 1; cursor: pointer; transition: fill 0.3s, stroke 0.3s; }
.afs-zone:hover { fill: rgba(0,0,0,0.45); stroke: rgba(255,255,255,0.6); stroke-width: 2; }
.afs-zone.active { fill: rgba(33,150,243,0.35); stroke: rgba(33,150,243,0.9); stroke-width: 3; }
.afs-zone:hover.active { fill: rgba(33,150,243,0.45); }

/* Statomas = no dark overlay, transparent until hover */
.afs-zone.statomas { fill: transparent; stroke: transparent; }
.afs-zone.statomas:hover { fill: rgba(76,175,80,0.25); stroke: rgba(76,175,80,0.7); stroke-width: 2; }
.afs-zone.statomas.active { fill: rgba(33,150,243,0.3); stroke: rgba(33,150,243,0.9); stroke-width: 3; }

/* Planuojamas = dark overlay */
.afs-zone.planned { fill: rgba(0,0,0,0.35); }
.afs-zone.planned:hover { fill: rgba(0,0,0,0.50); stroke: rgba(33,150,243,0.8); stroke-width: 2; }
.afs-zone.planned.active { fill: rgba(33,150,243,0.40); stroke: rgba(33,150,243,0.9); stroke-width: 3; }

/* Floor labels — always visible on planned (dark), hover-only on statomas */
.afs-floor-text { font-size: 18px; font-weight: 700; fill: white; pointer-events: none; opacity: 1; text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: rgba(0,0,0,0.5); stroke-width: 3px; }
.afs-floor-text.statomas-label { opacity: 0; transition: opacity 0.3s; }
.afs-zone.statomas:hover + .afs-floor-text.statomas-label,
.afs-zone.statomas.active + .afs-floor-text.statomas-label { opacity: 1; }

/* ── Tooltip ── */
.afs-tooltip { position: absolute; background: rgba(44,62,80,0.95); color: white; padding: 10px 16px; border-radius: 8px; font-size: 14px; pointer-events: none; opacity: 0; transition: opacity 0.2s; white-space: nowrap; z-index: 10; }
.afs-tooltip.visible { opacity: 1; }
.afs-tooltip-title { font-weight: 700; margin-bottom: 4px; }
.afs-tooltip-badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-left: 6px; vertical-align: middle; color: white; }
.afs-tooltip-stats { display: flex; gap: 12px; font-size: 12px; }
.afs-tooltip-stat { display: flex; align-items: center; gap: 4px; }
.afs-tooltip-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ── Legend ── */
.afs-legend { display: flex; justify-content: center; gap: 20px; margin: 16px 0; flex-wrap: wrap; }
.afs-legend-item { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #555; }
.afs-legend-dot { width: 12px; height: 12px; border-radius: 50%; }

/* ── Info bar ── */
.afs-info-bar { background: #2c3e50; color: white; padding: 14px 24px; border-radius: 10px; margin: 16px 0; display: none; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; animation: afsSlide 0.3s ease; }
.afs-info-bar.visible { display: flex; }
.afs-info-bar-title { font-size: 18px; font-weight: 600; }
.afs-info-bar-tag { display: inline-block; background: rgba(255,255,255,0.2); font-size: 12px; padding: 3px 10px; border-radius: 12px; margin-left: 10px; font-weight: 600; }
.afs-info-bar-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.afs-info-bar-stat { display: flex; align-items: center; gap: 6px; font-size: 14px; }

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

/* ── Apartment table ── */
.afs-table-wrapper { display: none; animation: afsSlide 0.4s ease; }
.afs-table-wrapper.visible { display: block; }
.afs-table { width: 100%; border-collapse: collapse; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }
.afs-table thead { background: #2c3e50; color: white; }
.afs-table th { padding: 14px 16px; text-align: left; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.afs-table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid #eee; }
.afs-table tbody tr { background: white; transition: background 0.2s; cursor: pointer; }
.afs-table tbody tr:hover { background: #f0f7ff; }
.afs-table tbody tr.sold { opacity: 0.5; }
.afs-table tbody tr.reserved { background: #fffde7; }
.afs-table tbody tr.bookable { background: #e3f2fd; }

/* Status badges */
.afs-status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.afs-status.free { background: #e8f5e9; color: #2e7d32; }
.afs-status.reserved { background: #fff8e1; color: #f57f17; }
.afs-status.sold { background: #ffebee; color: #c62828; }
.afs-status.bookable { background: #e3f2fd; color: #1565C0; }
.afs-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.afs-status.free .afs-status-dot { background: #4CAF50; }
.afs-status.reserved .afs-status-dot { background: #FFC107; }
.afs-status.sold .afs-status-dot { background: #F44336; }
.afs-status.bookable .afs-status-dot { background: #2196F3; }

.afs-price { font-weight: 700; color: #2c3e50; }
.afs-price-tbd { color: #7f8c8d; font-weight: 500; font-style: italic; }

/* ── CTA block ── */
.afs-cta { display: none; border-radius: 10px; padding: 16px 24px; margin-top: 12px; text-align: center; animation: afsSlide 0.4s ease; }
.afs-cta.visible { display: block; }
.afs-cta.planned { background: linear-gradient(135deg, #e3f2fd, #bbdefb); border: 2px solid #90caf9; }
.afs-cta.planned p { color: #1565C0; }
.afs-cta p { font-size: 15px; margin-bottom: 10px; }
.afs-cta-btn { display: inline-block; background: #1976D2; color: white; border: none; padding: 12px 28px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background 0.2s; }
.afs-cta-btn:hover { background: #1565C0; }

/* Hint */
.afs-hint { text-align: center; padding: 30px; color: #95a5a6; font-size: 16px; }
.afs-hint-icon { font-size: 32px; margin-bottom: 8px; }

/* ══════════════════════════════════
   MODAL — 3D / 2D / Vieta aukšte
   ══════════════════════════════════ */
.afs-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 999999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.afs-modal-overlay.visible { display: flex; }

.afs-modal {
  background: white;
  border-radius: 16px;
  max-width: 950px;
  width: 95%;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: afsSlide 0.3s ease;
}

.afs-modal-close {
  position: absolute;
  left: 16px;
  top: 16px;
  background: #f0f0f0;
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.afs-modal-close:hover { background: #ddd; }

.afs-modal-header { padding: 28px 28px 14px; text-align: center; }
.afs-modal-title { font-size: 26px; font-weight: 700; color: #2c3e50; margin: 0 0 10px; }
.afs-modal-meta { display: flex; gap: 20px; justify-content: center; font-size: 16px; color: #666; flex-wrap: wrap; }

.afs-modal-tabs { display: flex; border-bottom: 2px solid #eee; padding: 0 28px; gap: 0; }
.afs-mtab {
  background: none; border: none;
  padding: 14px 24px;
  font-size: 16px; font-weight: 600;
  color: #999; cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.afs-mtab:hover { color: #555; }
.afs-mtab.active { color: #2196F3; border-bottom-color: #2196F3; }

.afs-modal-body { min-height: 350px; }
.afs-mpane { display: none; padding: 28px; text-align: center; }
.afs-mpane.active { display: block; }
.afs-mpane img { max-width: 100%; height: auto; border-radius: 8px; }
.afs-mpane img[src=""], .afs-mpane img:not([src]) { display: none; }
.afs-mno { color: #bbb; font-size: 18px; padding: 80px 0; margin: 0; }

.afs-modal-footer { padding: 20px 28px; border-top: 1px solid #eee; text-align: center; display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap; }
.afs-modal-footer .afs-status { font-size: 17px; padding: 8px 20px; }
.afs-modal-footer .afs-price { font-size: 24px; }
.afs-modal-footer .afs-price-tbd { font-size: 18px; color: #7f8c8d; font-style: italic; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .afs-table th, .afs-table td { padding: 8px 10px; font-size: 12px; }
  .afs-building-name { font-size: 13px; }
  .afs-floor-text { font-size: 11px; }
  .afs-modal-title { font-size: 18px; }
  .afs-mtab { padding: 10px 12px; font-size: 12px; }
}

@media (max-width: 480px) {
  .afs-table-wrapper { overflow-x: auto; }
  .afs-table { min-width: 600px; }
  .afs-modal { border-radius: 12px; margin: 10px; }
}
