/**
 * 阿拉伯语RTL布局地图样式
 */

/* 地图容器相关样式 */
#map-container {
    position: relative;
    width: 100%;
    height: 400px;
    margin-bottom: 20px;
    direction: ltr !important;
}

#map {
    width: 100%;
    height: 100%;
    direction: ltr !important;
}

/* 确保Leaflet控件正确显示 */
.leaflet-container {
    font-family: 'Cairo', 'Arial', sans-serif;
    direction: ltr !important;
}

.leaflet-control-zoom {
    right: 10px !important;
    left: auto !important;
    border: none !important;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2) !important;
}

.leaflet-control-zoom a {
    background-color: white !important;
    color: #333 !important;
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    border: none !important;
}

.leaflet-control-zoom a:hover {
    background-color: #f4f4f4 !important;
}

.leaflet-control-zoom a:first-child {
    border-top-left-radius: 4px !important;
    border-top-right-radius: 4px !important;
}

.leaflet-control-zoom a:last-child {
    border-bottom-left-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
}

.leaflet-control-attribution {
    text-align: left !important;
    direction: ltr !important;
}

/* 标记和弹出窗口样式 */
.map-marker {
    border-radius: 50%;
    width: 10px;
    height: 10px;
}

.sea-port {
    background-color: #1E88E5;
}

.container-terminal {
    background-color: #E91E63;
}

.leaflet-popup-content {
    direction: ltr !important;
    text-align: left !important;
    min-width: 150px;
}

.popup-content {
    padding: 5px;
}

.popup-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 5px;
}

.popup-body {
    font-size: 0.9em;
}

.popup-link {
    display: inline-block;
    margin-top: 5px;
    color: #1E88E5;
    text-decoration: none;
    direction: rtl !important;
    text-align: right !important;
}

.popup-link:hover {
    text-decoration: underline;
}

/* 调整select2和图例样式 */
.select2-container .select2-selection--single {
    height: 38px !important;
    padding: 5px 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
}

/* 图例样式 */
.legend {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    /* margin-top: 10px; */
    direction: rtl;
    height: 38px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 36px;
    line-height: 12px;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* 重置RTL中的特定元素为LTR */
.leaflet-popup-content .un-locode {
    direction: ltr !important;
    display: inline-block;
}

/* 弹窗样式增强 */
.leaflet-popup {
    direction: ltr;
}

.leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    width: 350px !important;
    min-width: 350px;
    padding: 20px;
    direction: rtl;
    text-align: right;
}

.popup-content {
    direction: rtl;
    text-align: right;
}

/* 修改弹窗关闭按钮位置，从右侧移到左侧 */
.leaflet-container a.leaflet-popup-close-button {
    padding: 8px 0 0 10px;
    width: 30px;
    height: 30px;
    font-size: 24px;
    color: #333;
    right: auto;
    left: 0;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: #777;
}

/* 自定义弹窗样式，与英文版保持一致 */
.custom-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 14px rgba(0,0,0,0.2);
}

.custom-popup .leaflet-popup-content {
    margin: 0;
    width: 300px !important;
    padding: 20px;
}

.custom-popup .leaflet-popup-tip {
    background-color: white;
}

/* 覆盖默认的地图控件样式 */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2) !important;
}

.leaflet-control-zoom a {
    background-color: white !important;
    color: #333 !important;
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    border: none !important;
}

.leaflet-control-zoom a:hover {
    background-color: #f4f4f4 !important;
}

.leaflet-control-zoom a:first-child {
    border-top-left-radius: 4px !important;
    border-top-right-radius: 4px !important;
}

.leaflet-control-zoom a:last-child {
    border-bottom-left-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
}

/* 移动端响应式样式 */
@media screen and (max-width: 768px) {
    .legend {
        width: 100%;
        justify-content: space-between;
        gap: 5px;
    }
    
    .legend-item {
        width: 48%;
        justify-content: center;
    }
} 