/* ========================
   GLOBAL STYLES
======================== */
* {
  box-sizing: border-box;
  font-family: 'Segoe UI', sans-serif;
}

body {
  margin: 0;
  background: #f4f6f5;
}

/* ========================
   TOPBAR
======================== */
.topbar {
  height: 70px;
  padding: 0 20px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ddd;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  height: 42px;
}

.brand h3 {
  margin: 0;
  color: #1e6f5c;
}

.brand span {
  font-size: 0.8rem;
  color: #666;
}

.home-btn {
  text-decoration: none;
  background: #e7f3ef;
  color: #1e6f5c;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
}

/* ========================
   LAYOUT
======================== */
.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: calc(100vh - 70px);
  position: relative;
}

.sidebar {
  background: #ffffff;
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid #ddd;
  height: 100%;
}

.sidebar input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #ccc;
  margin-bottom: 20px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.filters button {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid #ccc;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.filters button.active {
  background: #1e6f5c;
  color: #ffffff;
  border-color: #1e6f5c;
}

.count {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 15px;
}

.place-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
}

.place-card:hover {
  background: #f1f5f3;
}

.place-card img {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
}

.place-card h5 {
  margin: 0;
  font-size: 0.95rem;
}

.place-card span {
  font-size: 0.75rem;
  color: #777;
}

/* ========================
   MAP
======================== */
#map {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

/* MAP LEGEND */
.map-legend {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #ffffff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.15);
  font-size: 0.8rem;
  z-index: 2100;
}

.map-legend h5 {
  margin: 0 0 8px;
  font-size: 0.85rem;
}

.map-legend div {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

/* DOTS & MARKERS */
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.homestay { background-color: #1e6f5c; }
.dot.temple { background-color: #e67e22; }
.dot.restaurant { background-color: #e74c3c; }
.dot.store { background-color: #3498db; }
.dot.natural-places { background-color: #27ae60; }
.dot.hotels { background-color: #9b59b6; }
.dot.others { background-color: #7f8c8d; }

.marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #ffffff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.marker.homestay { background: #2ecc71; }
.marker.temple { background: #3498db; }
.marker.restaurant { background: #e67e22; }
.marker.store { background: #9b59b6; }

/* ADD LOCATION BUTTON */
.add-location-btn {
  position: absolute;
  bottom: 90px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1e6f5c;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 24px;
  z-index: 2100;
}

/* OVERLAY */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

/* FORM INSIDE OVERLAY */
.form {
  background: #fff;
  padding: 16px;
  width: 320px;
  border-radius: 12px;
}

.form input,
.form textarea,
.form select {
  width: 100%;
  margin-bottom: 8px;
  padding: 6px;
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ========================
   POPUP CARD STYLING
======================== */
.leaflet-popup-content-wrapper {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 12px !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: 300px !important;
}

.leaflet-popup-tip-container {
  display: none;
}

.leaflet-popup-close-button {
  padding: 8px !important;
  color: white !important;
  text-shadow: 0 0 5px rgba(0,0,0,0.5);
  font-size: 20px !important;
  z-index: 2001;
}

/* POPUP IMAGE */
.popup-image-lg img {
  width: 100%;
  height: 230px;
  object-fit: cover;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  transition: transform 0.3s ease;
}

.popup-image-lg img:hover {
  transform: scale(1.05);
}

/* POPUP BODY */
.popup-body-lg {
  padding: 18px 20px;
}

.popup-body-lg h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  color: #1e3d34;
}

.popup-desc-lg {
  font-size: 14px;
  color: #555;
  line-height: 1.65;
  margin-bottom: 14px;
}

.popup-info-lg {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #666;
  margin-bottom: 16px;
}

.popup-amenities-lg {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.popup-amenities-lg span {
  background: #eef6f3;
  color: #1e6f5c;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

/* DELETE BUTTON */
.delete-btn-lg {
  background: linear-gradient(135deg, #ff5f5f, #e53935);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.delete-btn-lg:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(229,57,53,0.35);
}

/* ========================
   HOMESTAY CARD POPUP
======================== */
.homestay-card-popup .card-header {
  position: relative;
  height: 150px;
}
.homestay-card-popup .card-header img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.homestay-card-popup .badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(46,125,50,0.9);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.homestay-card-popup .card-title {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: white;
}
.homestay-card-popup .card-title h3 {
  margin: 0;
  font-size: 14px;
}
.homestay-card-popup .card-content {
  padding: 15px;
}
.homestay-card-popup .location-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.homestay-card-popup .info-tag {
  background: #f1f3f4;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: #5f6368;
}
.homestay-card-popup .action-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.homestay-card-popup .btn-outline {
  flex: 1;
  background: white;
  border: 1px solid #dadce0;
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.homestay-card-popup .btn-star {
  width: 45px;
  background: white;
  border: 1px solid #dadce0;
  border-radius: 8px;
  cursor: pointer;
  color: #5f6368;
}
.homestay-card-popup .btn-primary {
  width: 100%;
  background: #D86A3B;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}
.homestay-card-popup .coordinates {
  text-align: center;
  font-size: 10px;
  color: #999;
}

/* ========================
   RESPONSIVE MEDIA QUERIES
======================== */

/* Tablets & mobile */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    margin-bottom: 15px;
  }

  .sidebar input {
    padding: 10px;
  }

  .filters {
    flex-direction: column;
    gap: 6px;
  }

  .filters button {
    flex: 1 1 100%;
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .count {
    font-size: 0.8rem;
  }

  .place-card {
    flex-direction: row;
    gap: 10px;
    padding: 8px;
  }

  .place-card img {
    width: 50px;
    height: 50px;
  }

  .place-card h5 {
    font-size: 0.85rem;
  }

  .place-card span {
    font-size: 0.7rem;
  }

  #map {
    height: 400px;
  }

  .map-legend {
    top: auto;
    bottom: 20px;
    right: 10px;
    font-size: 0.7rem;
    padding: 10px 12px;
  }

  .add-location-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
    bottom: 70px;
    right: 15px;
  }

  .overlay .form {
    width: 90%;
    max-width: 320px;
    padding: 12px;
  }

  .form input,
  .form textarea,
  .form select {
    font-size: 0.85rem;
  }

  .leaflet-popup-content {
    width: 90% !important;
    max-width: 280px !important;
  }

  .popup-image-lg img {
    height: 180px;
  }

  .popup-body-lg h2 {
    font-size: 18px;
  }

  .popup-desc-lg {
    font-size: 13px;
  }

  .popup-info-lg {
    font-size: 11px;
  }

  .popup-amenities-lg span {
    font-size: 10px;
    padding: 5px 10px;
  }

  .delete-btn-lg,
  .btn-primary,
  .btn-outline,
  .btn-star {
    font-size: 11px;
    padding: 6px 12px;
  }
}

/* Extra small mobile */
@media (max-width: 480px) {
  .topbar {
    flex-direction: column;
    height: auto;
    padding: 10px;
    gap: 8px;
  }

  .home-btn {
    width: 100%;
    text-align: center;
  }
}
