/* ===========================
   FINDROOM — MAP PAGE CSS
   =========================== */

.map-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ========================
   MAP TOPBAR
   ======================== */

.map-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(to bottom, rgba(13,13,13,0.95) 0%, rgba(13,13,13,0) 100%);
  pointer-events: none;
}

.map-topbar > * { pointer-events: all; }

.back-btn {
  width: 42px;
  height: 42px;
  background: var(--orange);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-orange);
  transition: var(--transition);
  flex-shrink: 0;
}

.back-btn:hover {
  background: var(--orange-light);
  transform: translateX(-2px);
}

.map-title-group {
  flex: 1;
  min-width: 0;
}

.map-area-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.map-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.map-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.map-radius-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--orange-dim);
  border: 1px solid rgba(232, 81, 10, 0.3);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--orange);
}

/* ========================
   MAP CANVAS
   ======================== */

#map {
  flex: 1;
  width: 100%;
  height: 100vh;
}

.map-container {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ========================
   ROOM CARD (BOTTOM SHEET)
   ======================== */

.room-card-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
}

.room-card-sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin: -8px auto 20px;
}

.room-card-inner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  max-width: 600px;
  margin: 0 auto;
}

.room-card-photo {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.room-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-card-info {
  flex: 1;
  min-width: 0;
}

.room-card-rent {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--orange);
  letter-spacing: -0.03em;
  line-height: 1;
}

.room-card-rent span {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.room-card-city {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 6px 0;
}

.room-card-owner {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.room-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.room-card-actions .btn {
  flex: 1;
}

.room-card-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
}

.room-card-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ========================
   ALLOW LOCATION OVERLAY
   ======================== */

.location-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13,13,13,0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
  text-align: center;
}

.location-overlay-icon {
  width: 80px;
  height: 80px;
  background: var(--orange-dim);
  border: 2px solid rgba(232, 81, 10, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 24px;
  animation: locationPulse 2s ease-in-out infinite;
}

@keyframes locationPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 81, 10, 0.3); }
  50% { box-shadow: 0 0 0 16px rgba(232, 81, 10, 0); }
}

.location-overlay h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}

.location-overlay p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  max-width: 320px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.location-overlay .alt-link {
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: underline;
  display: inline-block;
}

.location-overlay .alt-link:hover {
  color: var(--text-muted);
}

/* ========================
   CUSTOM MAP PINS
   ======================== */

.map-pin-label {
  background: var(--orange);
  color: white;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(232, 81, 10, 0.4);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.map-pin-label::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--orange);
}

.map-pin-label:hover {
  background: var(--orange-light);
  transform: scale(1.05) translateY(-2px);
}

/* InfoWindow override */
.gm-style .gm-style-iw-c {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 0 !important;
  box-shadow: var(--shadow-lg) !important;
}

.gm-style .gm-style-iw-d {
  overflow: hidden !important;
}

.gm-style .gm-style-iw-tc::after {
  background: var(--bg-card) !important;
}

.gm-style-iw button.gm-ui-hover-effect {
  display: none !important;
}

/* ========================
   NO ROOMS STATE
   ======================== */

.map-empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  text-align: center;
  z-index: 10;
  box-shadow: var(--shadow-lg);
}

.map-empty-state h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 8px;
}

.map-empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

@media (max-width: 480px) {
  .room-card-inner {
    flex-direction: column;
  }

  .room-card-photo {
    width: 100%;
    height: 160px;
  }

  .room-card-actions {
    flex-direction: column;
  }
}
