/* ========================================
   Global Styles & Reset
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Afacad', sans-serif;
  overflow: hidden;
  position: relative;
  height: 100vh;
  width: 100%;
}

/* ========================================
   Loading Overlay
   ======================================== */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity 0.3s ease;
}

#loadingOverlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #FFCC00;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#loadingOverlay p {
  font-size: 16px;
  color: #333;
  font-weight: 500;
}

/* ========================================
   Map Container
   ======================================== */
#map {
  height: 100vh;
  width: 100%;
  position: relative;
}

/* Hide Google Maps default controls */
.gm-style-mtc,
.gm-bundled-control-on-bottom {
  display: none !important;
}

/* ========================================
   Mobile Filter Toggle Button
   ======================================== */
#filterToggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 999;
  background: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

#filterToggle:hover {
  background: #f8f8f8;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#filterToggle:active {
  transform: scale(0.98);
}

/* ========================================
   Control Panel
   ======================================== */
#controls {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 998;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 320px;
  width: 100%;
  max-height: calc(100vh - 30px);
  overflow-y: auto;
  transition: all 0.3s ease;
}

.controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.controls-header img {
  max-width: 140px;
  height: auto;
}

.close-btn {
  display: none;
  background: #f5f5f5;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: #e0e0e0;
  color: #333;
}

/* ========================================
   Personalized Guide Button & Modal
   ======================================== */
.personalized-guide-btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #FFCC00 0%, #FFA500 100%);
  border: none;
  border-radius: 8px;
  font-family: 'Afacad', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #000;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 20px;
  box-shadow: 0 3px 10px rgba(255, 204, 0, 0.3);
  letter-spacing: 0.5px;
}

.personalized-guide-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 204, 0, 0.5);
}

.personalized-guide-btn:active {
  transform: translateY(0);
}

.guide-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.guide-modal-content {
  background: white;
  border-radius: 16px;
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

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

.guide-modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px 25px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.guide-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.close-modal-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: white;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.guide-modal-body {
  padding: 25px;
  max-height: calc(90vh - 80px);
  overflow-y: auto;
}

.guide-question {
  margin-bottom: 20px;
}

.guide-question label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
}

.guide-question input,
.guide-question select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Afacad', sans-serif;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

.guide-question input:focus,
.guide-question select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.guide-question input::placeholder {
  color: #999;
  font-size: 13px;
}

.generate-guide-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 10px;
  font-family: 'Afacad', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.generate-guide-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.generate-guide-btn:active {
  transform: translateY(0);
}

.generate-guide-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.guide-results {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 2px solid #f0f0f0;
}

.guide-results h4 {
  color: #667eea;
  margin: 0 0 15px 0;
  font-size: 18px;
}

.guide-results-intro {
  background: #f8f9ff;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #667eea;
}

.guide-results-intro p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #555;
}

.guide-recommendation {
  background: #f8f9fa;
  padding: 15px;
  margin-bottom: 12px;
  border-radius: 8px;
  border-left: 4px solid #FFCC00;
  cursor: pointer;
  transition: all 0.2s ease;
}

.guide-recommendation:hover {
  transform: translateX(5px);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
  background: #fff;
}

.guide-recommendation .location-name {
  font-weight: 600;
  color: #333;
  font-size: 15px;
  margin-bottom: 6px;
}

.guide-recommendation .location-details {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.guide-recommendation .location-reason {
  font-size: 13px;
  color: #667eea;
  font-style: italic;
}

.guide-loading {
  text-align: center;
  padding: 30px;
  color: #667eea;
  font-size: 16px;
}

.guide-loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

/* ========================================
   Search Box
   ======================================== */
.search-container {
  position: relative;
  margin-bottom: 20px;
}

#searchBox {
  width: 100%;
  padding: 10px 35px 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Afacad', sans-serif;
  font-size: 14px;
  transition: all 0.2s ease;
}

#searchBox:focus {
  outline: none;
  border-color: #FFCC00;
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.1);
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: #f5f5f5;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  transition: all 0.2s ease;
}

.clear-search-btn:hover {
  background: #e0e0e0;
  color: #333;
}

/* ========================================
   Filter Groups
   ======================================== */
.filter-group {
  margin-bottom: 16px;
}

.filter-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Afacad', sans-serif;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-group select:focus {
  outline: none;
  border-color: #FFCC00;
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.1);
}

.filter-group select:hover {
  border-color: #ccc;
}

/* ========================================
   Stats Display
   ======================================== */
.stats-display {
  background: #f8f8f8;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
  border: 1px solid #e0e0e0;
}

.stats-display span {
  font-weight: 600;
  color: #333;
}

/* ========================================
   Reset Button
   ======================================== */
.reset-btn {
  width: 100%;
  padding: 10px;
  background: #f5f5f5;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Afacad', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.reset-btn:hover {
  background: #FFCC00;
  border-color: #FFCC00;
  color: #000;
}

.reset-btn:active {
  transform: scale(0.98);
}

/* ========================================
   Error Display
   ======================================== */
.error-display {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 12px;
}

/* ========================================
   Custom Zoom Controls
   ======================================== */
#customZoomControls {
  position: fixed;
  right: 15px;
  bottom: 100px;
  z-index: 997;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zoom-btn {
  width: 44px;
  height: 44px;
  background: white;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 24px;
  font-weight: 300;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-btn:hover {
  background: #f8f8f8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.zoom-btn:active {
  transform: scale(0.95);
}

.zoom-reset {
  background: #FFCC00;
  margin-top: 8px;
}

.zoom-reset:hover {
  background: #ffdd33;
}

/* ========================================
   Legend
   ======================================== */
.legend {
  position: fixed;
  bottom: 20px;
  left: 15px;
  background: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 996;
  font-size: 13px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.user-location-dot {
  width: 14px;
  height: 14px;
  background: #4285F4;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

/* ========================================
   Custom Info Window Styles
   ======================================== */
.custom-info-window {
  font-family: 'Afacad', sans-serif;
  max-width: 300px;
  padding: 4px;
}

.custom-info-window h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  margin: 0 0 10px;
  color: #222;
}

.custom-info-window img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 12px;
}

.custom-info-window p {
  margin: 8px 0;
  font-size: 14px;
  color: #555;
  line-height: 1.5;
}

.custom-info-window .address {
  font-size: 13px;
  color: #666;
}

.custom-info-window .rating {
  font-size: 14px;
  color: #333;
  font-weight: 600;
}

.custom-info-window .watch-btn {
  display: inline-block;
  background: #FFCC00;
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  color: #000;
  font-weight: 600;
  font-size: 14px;
  margin-top: 10px;
  transition: all 0.2s ease;
}

.custom-info-window .watch-btn:hover {
  background: #ffdd33;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 204, 0, 0.4);
}

/* ========================================
   Mobile Responsive Styles
   ======================================== */
@media (max-width: 767px) {
  #filterToggle {
    display: flex;
  }

  #controls.mobile-hidden {
    transform: translateX(-110%);
    pointer-events: none;
  }

  #controls {
    left: 0;
    top: 0;
    bottom: 0;
    max-width: 85%;
    border-radius: 0 12px 12px 0;
    max-height: 100vh;
  }

  .close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #customZoomControls {
    right: 10px;
    bottom: 80px;
  }

  .zoom-btn {
    width: 40px;
    height: 40px;
  }

  .legend {
    left: 10px;
    bottom: 15px;
    font-size: 12px;
    padding: 10px 12px;
  }
}

@media (min-width: 768px) {
  #controls {
    display: block !important;
    transform: translateX(0) !important;
    pointer-events: all !important;
  }

  #filterToggle {
    display: none !important;
  }
}

/* ========================================
   Scrollbar Styling
   ======================================== */
#controls::-webkit-scrollbar {
  width: 8px;
}

#controls::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

#controls::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

#controls::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
  #controls,
  #filterToggle,
  #customZoomControls,
  .legend {
    display: none !important;
  }

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