/**
 * Map Page Styles for Travelgram
 * 
 * This file contains styles for the interactive travel map page including:
 * - Page header with gradient background
 * - Interactive map container and controls
 * - Info panel for destination details
 * - Quick statistics display
 * - Responsive design for mobile devices
 * - Dark mode support
 * 
 * @author Admir Bjelic
 * @version 1.0
 */

/* Main Content Background */
.main-content {
  background: var(--bg);
}

/* Page Header - Stories Style */
.page-header {
  text-align: center;
  margin-bottom: 4rem;
  padding-bottom: 2rem;
}

.page-header h1 {
  font-size: 3.5rem;
  font-weight: 300;
  margin-bottom: 1rem;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.page-header p {
  font-size: 1.3rem;
  color: #666;
  font-weight: 300;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Responsive Page Header */
@media (width <= 768px) {
  .page-header h1 {
    font-size: 2.5rem;
  }

  .page-header p {
    font-size: 1.1rem;
  }
}

@media (width <= 480px) {
  .page-header {
    margin-bottom: 2rem;
  }

  .page-header h1 {
    font-size: 2rem;
  }
}

/* Dark Mode Page Header */
[data-theme="dark"] .page-header h1 {
  color: var(--primary-dark);
}

[data-theme="dark"] .page-header p {
  color: #a0a0a0;
}

/* Compact Page Header */
.map-header {
  position: relative;
  background: linear-gradient(
    135deg,
    rgb(99 102 241 / 95%) 0%,
    rgb(139 92 246 / 90%) 25%,
    rgb(168 85 247 / 95%) 50%,
    rgb(196 79 248 / 90%) 75%,
    rgb(236 72 153 / 95%) 100%
  );
  backdrop-filter: blur(10px);
  color: white;
  padding: 2.5rem 0 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  overflow: hidden;
}

.map-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgb(255 255 255 / 10%) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgb(255 255 255 / 8%) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgb(255 255 255 / 5%) 0%, transparent 50%);
  pointer-events: none;
}

.map-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 30%), transparent);
}

.map-header h1 {
  position: relative;
  color: white;
  font-size: 2.2rem;
  margin: 0 0 0.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgb(0 0 0 / 10%);
  animation: fade-in-up 0.8s ease-out;
}

.header-subtitle {
  position: relative;
  font-size: 1rem;
  opacity: 0.95;
  max-width: 600px;
  margin: 0;
  line-height: 1.5;
  font-weight: 400;
  text-shadow: 0 1px 2px rgb(0 0 0 / 10%);
  animation: fade-in-up 0.8s ease-out 0.2s both;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Map Section */
.map-section {
  padding: 0;
}

/* Fullscreen Button */
.fullscreen-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: white;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
  transition: all 0.2s ease;
  font-size: 18px;
}

.fullscreen-btn:hover {
  background: #f8f9fa;
  transform: scale(1.05);
}

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

.fullscreen-icon {
  font-size: 18px;
  color: #333;
}

/* Dark mode for fullscreen button */
[data-theme="dark"] .fullscreen-btn {
  background: var(--card-bg-dark);
  box-shadow: var(--shadow-dark);
}

[data-theme="dark"] .fullscreen-btn:hover {
  background: #404040;
}

[data-theme="dark"] .fullscreen-icon {
  color: var(--text-dark);
}

/* Fullscreen mode styles */
.travel-map:fullscreen {
  height: 100vh;
  width: 100vw;
  border-radius: 0;
}

/* stylelint-disable-next-line selector-no-vendor-prefix */
.travel-map:-webkit-full-screen {
  height: 100vh;
  width: 100vw;
  border-radius: 0;
}

/* stylelint-disable-next-line selector-no-vendor-prefix */
.travel-map:-moz-full-screen {
  height: 100vh;
  width: 100vw;
  border-radius: 0;
}

/* stylelint-disable-next-line selector-no-vendor-prefix */
.travel-map:-ms-fullscreen {
  height: 100vh;
  width: 100vw;
  border-radius: 0;
}

/* Fullscreen info panel - fixed to viewport and properly centered */
.travel-map:fullscreen .map-info-panel {
  position: fixed !important;
  width: min(400px, 30vw);
  height: auto;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%) translateX(100%) !important;
  bottom: auto !important;
  z-index: 10000;
  transition:
    transform 0.2s ease,
    opacity 0.15s ease !important;
}

/* Mobile fullscreen - much wider panel */
@media (width <= 768px) {
  .travel-map:fullscreen .map-info-panel {
    width: min(600px, 95vw) !important;
    right: 0.5rem;
    left: 0.5rem;
    margin: 0 auto;
  }
}

@media (width <= 480px) {
  .travel-map:fullscreen .map-info-panel {
    width: min(500px, 65vw) !important;
    right: 0.5rem;
    left: 0.5rem;
    margin: 0 auto;
  }
}

.travel-map:fullscreen .map-info-panel.show {
  transform: translateY(-50%) translateX(0) !important;
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
.travel-map:-webkit-full-screen .map-info-panel {
  position: fixed !important;
  width: min(400px, 30vw);
  height: auto;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%) translateX(100%) !important;
  bottom: auto !important;
  z-index: 10000;
  transition:
    transform 0.2s ease,
    opacity 0.15s ease !important;
}

/* iOS Safari Fullscreen Styles */
.travel-map.ios-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: calc(var(--vh, 1vh) * 100) !important;
  min-height: 100vh !important;
  min-height: calc(var(--vh, 1vh) * 100) !important;
  max-height: 100vh !important;
  max-height: calc(var(--vh, 1vh) * 100) !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
}

/* Additional iPhone 15 Pro Max fullscreen fix */
@media only screen and (device-width = 430px) and (device-height = 932px) {
  .travel-map.ios-fullscreen {
    /* Force override any conflicting styles */
    height: 932px !important;
    min-height: 932px !important;
    max-height: 932px !important;
  }
}

/* Even more aggressive iPhone 15 Pro Max fullscreen fix */
@media only screen and (device-width = 430px) and (device-height = 932px) {
  body.ios-map-fullscreen .travel-map.ios-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 932px !important;
    min-height: 932px !important;
    max-height: 932px !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* Hide navbar and other elements when iOS fullscreen is active */
body.ios-map-fullscreen .navbar {
  display: none !important;
}

body.ios-map-fullscreen .main-content > .container:first-child {
  display: none !important;
}

body.ios-map-fullscreen .map-stats {
  display: none !important;
}

body.ios-map-fullscreen .footer {
  display: none !important;
}

/* iOS fullscreen info panel */
.travel-map.ios-fullscreen .map-info-panel {
  position: fixed !important;
  width: min(400px, 30vw);
  height: auto;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%) translateX(100%) !important;
  bottom: auto !important;
  z-index: 10000;
  transition:
    transform 0.2s ease,
    opacity 0.15s ease !important;
}

.travel-map.ios-fullscreen .map-info-panel.show {
  transform: translateY(-50%) translateX(0) !important;
}

/* Mobile iOS fullscreen */
@media (width <= 768px) {
  .travel-map.ios-fullscreen .map-info-panel {
    width: min(600px, 95vw) !important;
    right: 0.5rem;
    left: 0.5rem;
    margin: 0 auto;
  }
}

@media (width <= 480px) {
  .travel-map.ios-fullscreen .map-info-panel {
    width: min(500px, 65vw) !important;
    right: 0.5rem;
    left: 0.5rem;
    margin: 0 auto;
  }
}

/* iPhone 15 Pro Max and iPhone 14 Pro Max specific fixes */
@media only screen and (device-width = 430px) and (device-height = 932px) {
  .travel-map {
    height: calc(var(--vh, 1vh) * 90) !important; /* Use more of the available height */
    min-height: calc(var(--vh, 1vh) * 90) !important;
    max-height: calc(var(--vh, 1vh) * 90) !important;
  }

  .page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
  }

  .page-header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
  }

  .page-header p {
    font-size: 0.9rem;
  }

  .map-container {
    margin-bottom: 1rem;
  }
}

/* Mobile WebKit fullscreen - much wider panel */
@media (width <= 768px) {
  /* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
  .travel-map:-webkit-full-screen .map-info-panel {
    width: min(600px, 95vw) !important;
    right: 0.5rem;
    left: 0.5rem;
    margin: 0 auto;
  }
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
@media (width <= 480px) {
  /* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
  .travel-map:-webkit-full-screen .map-info-panel {
    width: min(500px, 65vw) !important;
    right: 0.5rem;
    left: 0.5rem;
    margin: 0 auto;
  }
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
.travel-map:-webkit-full-screen .map-info-panel.show {
  transform: translateY(-50%) translateX(0) !important;
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
.travel-map:-moz-full-screen .map-info-panel {
  position: fixed !important;
  width: min(400px, 30vw);
  height: auto;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%) translateX(100%) !important;
  bottom: auto !important;
  z-index: 10000;
  transition:
    transform 0.2s ease,
    opacity 0.15s ease !important;
}

/* Mobile Mozilla fullscreen - much wider panel */
/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
@media (width <= 768px) {
  /* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
  .travel-map:-moz-full-screen .map-info-panel {
    width: min(600px, 95vw) !important;
    right: 0.5rem;
    left: 0.5rem;
    margin: 0 auto;
  }
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
@media (width <= 480px) {
  /* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
  .travel-map:-moz-full-screen .map-info-panel {
    width: min(500px, 65vw) !important;
    right: 0.5rem;
    left: 0.5rem;
    margin: 0 auto;
  }
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
.travel-map:-moz-full-screen .map-info-panel.show {
  transform: translateY(-50%) translateX(0) !important;
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
.travel-map:-ms-fullscreen .map-info-panel {
  position: fixed !important;
  width: min(400px, 30vw);
  height: auto;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%) translateX(100%) !important;
  bottom: auto !important;
  z-index: 10000;
  transition:
    transform 0.2s ease,
    opacity 0.15s ease !important;
}

/* Mobile MS fullscreen - much wider panel */
/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
@media (width <= 768px) {
  /* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
  .travel-map:-ms-fullscreen .map-info-panel {
    width: min(600px, 85vw) !important;
    right: 0.5rem;
    left: 0.5rem;
    margin: 0 auto;
  }
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
@media (width <= 480px) {
  /* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
  .travel-map:-ms-fullscreen .map-info-panel {
    width: min(500px, 65vw) !important;
    right: 0.5rem;
    left: 0.5rem;
    margin: 0 auto;
  }
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
.travel-map:-ms-fullscreen .map-info-panel.show {
  transform: translateY(-50%) translateX(0) !important;
}

/* Fullscreen image - allow more space */
.travel-map:fullscreen .info-image {
  max-height: 300px !important;
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
.travel-map:-webkit-full-screen .info-image {
  max-height: 300px !important;
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
.travel-map:-moz-full-screen .info-image {
  max-height: 300px !important;
}

/* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
.travel-map:-ms-fullscreen .info-image {
  max-height: 300px !important;
}

.map-container {
  position: relative;
  background: #f8f9fa;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgb(0 0 0 / 10%);
  margin-bottom: 2rem;
}

.travel-map {
  height: calc(var(--vh, 1vh) * 90); /* Use dynamic viewport height for iOS */
  height: 90vh; /* Fallback for browsers without --vh support */
  min-height: 700px;
  width: 100%;
  z-index: 1;
  position: relative;
}

/* Map Loading State */
.map-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(255 255 255 / 90%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

  100% {
    transform: rotate(360deg);
  }
}

/* Map Popup Styles */
.custom-popup .leaflet-popup-content-wrapper {
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 8px 32px rgb(0 0 0 / 15%);
}

.custom-popup .leaflet-popup-content {
  margin: 0;
  padding: 0;
}

.map-popup-content {
  display: flex;
  flex-direction: column;
  max-width: 300px;
}

.popup-image {
  height: 120px;
  overflow: hidden;
  width: 200px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.8rem;
}

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

.popup-details {
  padding: 1rem;
}

.popup-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

.popup-country {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
  margin-bottom: 0.8rem;
}

.popup-description {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.4;
  max-width: 180px;
}

.popup-btn {
  width: 100%;
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s ease;
}

/* Map Info Panel */
.map-info-panel {
  position: absolute;
  top: 50%;
  right: 1rem;
  width: 300px;
  height: auto;
  max-height: calc(100% - 2rem);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgb(0 0 0 / 15%);
  z-index: 1000;
  overflow: hidden;
  transform: translateY(-50%) translateX(100%);
  opacity: 0;
  transition:
    transform 0.2s ease,
    opacity 0.15s ease;
  display: flex;
  flex-direction: column;
}

/* Position the info panel within the map container */
.map-info-panel.show {
  transform: translateY(-50%) translateX(0);
}

.close-panel-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgb(0 0 0 / 50%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  z-index: 1001;
  transition: background 0.2s ease;
}

.close-panel-btn:hover {
  background: rgb(0 0 0 / 70%);
}

.info-content {
  display: flex;
  flex-direction: column;
}

.info-image {
  min-height: 160px !important;
  max-height: 250px !important;
  overflow: visible !important;
  width: 100% !important;
  border-radius: 12px 12px 0 0;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%);
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;

  /* Allow container to adapt to image size */
  height: auto !important;
  padding: 10px !important;
}

.info-image img {
  /* Allow natural sizing with reasonable constraints */
  width: auto !important;
  height: auto !important;
  max-width: calc(100% - 20px) !important;
  max-height: 200px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: optimize-contrast;
  -ms-interpolation-mode: nearest-neighbor;
  filter: contrast(1.1) saturate(1.1);
  transition:
    transform 0.3s ease,
    filter 0.3s ease;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 15%);

  /* Allow image to maintain natural aspect ratio */
  aspect-ratio: auto;
  flex-shrink: 0 !important;
}

.info-image:hover img {
  transform: scale(1.05);
  filter: contrast(1.2) saturate(1.2);
}

.info-details {
  padding: 1.5rem;
}

.info-details h3 {
  margin: 0 0 0.3rem;
  color: var(--primary);
  font-size: 1.3rem;
}

.info-country {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.info-description {
  color: #555;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* Light Mode Styles for Info Panel Button */
.info-details .btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.info-details .btn-primary:hover {
  background: #1e5bb8;
  color: white;
  border-color: #1e5bb8;
}

.info-actions {
  display: flex;
  gap: 0.5rem;
}

/* Custom Map Popup Styles */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 20px rgb(0 0 0 / 15%);
}

.custom-popup {
  text-align: center;
  padding: 0.5rem;
}

.popup-btn:hover {
  background: #1e5bb8;
}

/* Map Stats */
.map-stats {
  background: var(--bg);
  padding: 2rem 0 3rem;
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  text-align: center;
}

.stat-item {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 5%);
  border: 1px solid #e9ecef;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  color: #666;
  font-size: 1rem;
  font-weight: 500;
}

/* Map CTA */
.map-cta {
  background: white;
  padding: 4rem 0;
  text-align: center;
}

.cta-content h2 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 2rem;
}

.cta-content p {
  color: #666;
  font-size: 1.1rem;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Footer */
.footer {
  background: #2c3e50;
  color: white;
  padding: 3rem 0 1rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
  color: white;
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: #bdc3c7;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-section a:hover {
  color: white;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid #34495e;
  color: #bdc3c7;
}

/* Button Styles */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: #1e5bb8;
  border-color: #1e5bb8;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
}

/* Responsive Design */
@media (width <= 768px) {
  .map-header {
    padding: 2rem 0 1.5rem;
    min-height: 160px;
  }

  .map-header h1 {
    font-size: 1.8rem;
  }

  .header-subtitle {
    font-size: 0.95rem;
  }

  .travel-map {
    height: 50vh;
    min-height: 400px;
  }

  .map-info-panel {
    width: 200px;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%) translateX(100%);
    opacity: 0;
    position: absolute;
  }

  .info-details {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .stat-item {
    padding: 1.5rem;
  }

  .stat-number {
    font-size: 2rem;
  }

  .cta-content h2 {
    font-size: 1.6rem;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
}

@media (width <= 480px) {
  .map-header {
    padding: 1.5rem 0 1rem;
    min-height: 140px;
  }

  .map-header h1 {
    font-size: 1.6rem;
  }

  .header-subtitle {
    font-size: 0.9rem;
  }

  .travel-map {
    height: 40vh;
    min-height: 300px;
  }

  .map-info-panel {
    width: calc(100vw - 1rem);
    right: 0.5rem;
    left: 0.5rem;
    max-width: 280px;
    margin: 0 auto;
    top: 50%;
    transform: translateY(-50%) translateX(100%);
    opacity: 0;
    position: absolute;
  }

  /* Override max-width for fullscreen mode */
  .travel-map:fullscreen .map-info-panel {
    max-width: none !important;
  }

  /* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
  .travel-map:-webkit-full-screen .map-info-panel {
    max-width: none !important;
  }

  /* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
  .travel-map:-moz-full-screen .map-info-panel {
    max-width: none !important;
  }

  /* stylelint-disable-next-line selector-pseudo-class-no-unknown, selector-no-vendor-prefix */
  .travel-map:-ms-fullscreen .map-info-panel {
    max-width: none !important;
  }

  .info-image {
    min-height: 140px !important;
    max-height: 220px !important;
    width: 100% !important;
    position: relative !important;
    height: auto !important;
    padding: 8px !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .info-details {
    padding: 0.75rem;
    text-align: center !important;
  }

  .info-details h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
  }

  .info-country {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600 !important;
  }

  .info-description {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    display: none !important;
  }

  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    width: 100% !important;
  }

  /* Mobile specific image styles for 480px breakpoint */
  .info-image img {
    max-width: calc(100% - 16px) !important;
    max-height: 200px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
    min-width: 0 !important;
    min-height: 0 !important;
    flex-shrink: 0 !important;
  }

  /* Hide popup description on mobile for cleaner look */
  .popup-description,
  .leaflet-popup-content .popup-description,
  .custom-popup .popup-description {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  /* Optimize mobile popup styles */
  .popup-image {
    width: 220px !important;
    height: 140px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    margin-bottom: 1rem !important;
  }

  .popup-title {
    font-size: 1.2rem !important;
    margin-bottom: 0.5rem !important;
  }

  .popup-country {
    font-size: 1rem !important;
    margin-bottom: 1.5rem !important;
    font-weight: 600 !important;
  }

  .popup-btn {
    width: 100% !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem !important;
  }

  .map-stats {
    padding: 2rem 0;
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .map-cta {
    padding: 3rem 0;
  }
}

/* iPhone 14 Pro Max and similar devices */
@media (width <= 430px) {
  .map-info-panel {
    width: calc(100vw - 0.5rem);
    right: 0.25rem;
    left: 0.25rem;
    max-width: 200px;
    top: 50%;
    transform: translateY(-50%) translateX(100%);
    opacity: 0;
    position: absolute;
  }

  .info-image {
    min-height: 120px !important;
    max-height: 200px !important;
    width: 100% !important;
    position: relative !important;
    height: auto !important;
    padding: 8px !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .info-details {
    padding: 0.5rem;
    text-align: center !important;
  }

  .info-details h3 {
    font-size: 1rem;
    margin-bottom: 0.1rem;
  }

  .info-country {
    font-size: 0.75rem;
    margin-bottom: 0.3rem;
    font-weight: 600 !important;
  }

  .info-description {
    font-size: 0.8rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    display: none !important;
  }

  .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    width: 100% !important;
  }

  .close-panel-btn {
    width: 25px;
    height: 25px;
    font-size: 1rem;
    top: 0.25rem;
    right: 0.25rem;
  }

  /* iPhone 14 Pro Max specific image styles */
  .info-image img {
    max-width: calc(100% - 16px) !important;
    max-height: 180px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
    min-width: 0 !important;
    min-height: 0 !important;
    flex-shrink: 0 !important;
  }

  /* Hide popup description on iPhone for cleaner look */
  .popup-description,
  .leaflet-popup-content .popup-description,
  .custom-popup .popup-description {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  /* Optimize iPhone popup styles */
  .popup-image {
    width: 200px !important;
    height: 120px !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    margin-bottom: 0.8rem !important;
  }

  .popup-title {
    font-size: 1.1rem !important;
    margin-bottom: 0.4rem !important;
  }

  .popup-country {
    font-size: 0.9rem !important;
    margin-bottom: 1.25rem !important;
    font-weight: 600 !important;
  }

  .popup-btn {
    width: 100% !important;
    padding: 0.6rem 0.8rem !important;
    font-size: 0.85rem !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  .map-container,
  .map-legend,
  .stat-item {
    border: 2px solid #333;
  }

  .map-info-panel {
    border: 3px solid #333;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .map-info-panel,
  .btn,
  .loading-spinner {
    transition: none;
    animation: none;
  }

  .btn:hover {
    transform: none;
  }
}

/* Print styles */
@media print {
  .map-info-panel,
  .close-panel-btn,
  .map-cta,
  .footer {
    display: none;
  }

  .travel-map {
    height: 400px;
  }

  .map-stats {
    background: white;
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Dark Mode Styles for Map Page */
[data-theme="dark"] .map-header {
  background: linear-gradient(
    135deg,
    rgb(99 102 241 / 98%) 0%,
    rgb(139 92 246 / 95%) 25%,
    rgb(168 85 247 / 98%) 50%,
    rgb(196 79 248 / 95%) 75%,
    rgb(236 72 153 / 98%) 100%
  );
}

[data-theme="dark"] .map-header::before {
  background:
    radial-gradient(circle at 20% 80%, rgb(99 102 241 / 15%) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgb(139 92 246 / 12%) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgb(168 85 247 / 8%) 0%, transparent 50%);
}

[data-theme="dark"] .map-container {
  background: var(--card-bg-dark);
  box-shadow: var(--shadow-dark);
}

[data-theme="dark"] .map-loading {
  background: rgb(45 45 45 / 90%);
  color: var(--text-dark);
}

[data-theme="dark"] .loading-spinner {
  border: 4px solid #404040;
  border-top: 4px solid var(--primary-dark);
}

/* Dark Mode Popup Styles */
[data-theme="dark"] .custom-popup .leaflet-popup-content-wrapper {
  background: var(--card-bg-dark);
  box-shadow: var(--shadow-dark);
}

[data-theme="dark"] .popup-title {
  color: var(--primary-dark);
}

[data-theme="dark"] .popup-country {
  color: #a0a0a0;
}

[data-theme="dark"] .popup-description {
  color: var(--text-dark);
}

/* Override dark mode popup description on mobile */
@media (width <= 480px) {
  [data-theme="dark"] .popup-description,
  [data-theme="dark"] .leaflet-popup-content .popup-description,
  [data-theme="dark"] .custom-popup .popup-description {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
}

[data-theme="dark"] .map-info-panel {
  background: var(--card-bg-dark);
  box-shadow: var(--shadow-dark);
}

[data-theme="dark"] .info-image {
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 10%);
  background: linear-gradient(135deg, #2d2d2d 0%, #404040 100%);
}

[data-theme="dark"] .info-image img {
  filter: contrast(1.15) saturate(1.15) brightness(0.95);
  box-shadow: 0 4px 12px rgb(0 0 0 / 40%);
}

[data-theme="dark"] .info-image:hover img {
  filter: contrast(1.25) saturate(1.25) brightness(1.05);
}

[data-theme="dark"] .info-details h3 {
  color: var(--primary-dark);
}

[data-theme="dark"] .info-country {
  color: #a0a0a0;
}

[data-theme="dark"] .info-description {
  color: var(--text-dark);
}

[data-theme="dark"] .stat-item {
  background: var(--card-bg-dark);
  border: 1px solid var(--border-dark);
  box-shadow: var(--shadow-dark);
}

[data-theme="dark"] .stat-number {
  color: var(--primary-dark);
}

[data-theme="dark"] .stat-label {
  color: #a0a0a0;
}

[data-theme="dark"] .map-cta {
  background: var(--card-bg-dark);
}

[data-theme="dark"] .cta-content h2 {
  color: var(--primary-dark);
}

[data-theme="dark"] .cta-content p {
  color: #a0a0a0;
}

/* Override dark mode popup description on mobile - second instance */
@media (width <= 480px) {
  [data-theme="dark"] .popup-description,
  [data-theme="dark"] .leaflet-popup-content .popup-description,
  [data-theme="dark"] .custom-popup .popup-description {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
}

[data-theme="dark"] .popup-btn {
  background: var(--primary-dark);
}

[data-theme="dark"] .popup-btn:hover {
  background: #1a4a8a;
}

/* Dark Mode Styles for Info Panel Button */
[data-theme="dark"] .info-details .btn-primary {
  background: var(--primary-dark);
  color: white;
  border-color: var(--primary-dark);
}

[data-theme="dark"] .info-details .btn-primary:hover {
  background: #1a4a8a;
  color: white;
  border-color: #1a4a8a;
}
