/* 
 * 移动端布局修复
 * 解决水平滚动和右侧空白问题
 */

/* 确保所有容器不会超出视口宽度 */
html, body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
  max-width: 100%;
}

/* 修复潜在的内容溢出问题 - 排除Leaflet组件 */
*:not(.leaflet-popup):not(.leaflet-popup-content-wrapper):not(.leaflet-popup-content):not(.leaflet-container) {
  /* max-width: 100%; */
  box-sizing: border-box;
}

/* 确保容器不会超出屏幕 */
.top-container,
.country-list-container,
.port-detail-container,
.port-info-section,
.site-footer,
.policy-section {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* 确保Leaflet地图容器不会导致页面溢出 */
#map-container {
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

/* 确保图像不会导致页面溢出 */
img {
  max-width: 100%;
  height: auto;
}

/* 修复可能的表格溢出问题 */
table {
  max-width: 100%;
  width: 100%;
  table-layout: fixed;
}

/* 恢复Leaflet弹窗样式 */
.leaflet-popup-content-wrapper {
  padding: 1px;
  text-align: left;
  border-radius: 12px;
}

.leaflet-popup-content {
  margin: 13px 24px 13px 20px;
  line-height: 1.5;
  font-size: 13px;
}

.leaflet-popup-close-button {
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 5px 0 0;
  border: none;
  text-align: center;
  width: 18px;
  height: 14px;
  font-size: 16px;
  line-height: 14px;
  color: #c3c3c3;
  text-decoration: none;
  font-weight: bold;
  background: transparent;
}

/* 针对超小屏幕的额外修复 */
@media (max-width: 480px) {
  .port-popup .info-grid {
    grid-template-columns: 1fr;
  }

  .legend-item {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
				width: 48%;
  }
  
  /* 确保选择器不会溢出 */
  .select2-container {
    min-width: auto !important;
    max-width: 90vw !important;
  }
} 