/* ==================== 基础地图样式 ==================== */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: pan-x pan-y;
}

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

/* 弹出框基础样式 - 电脑端默认尺寸 */
.ol-popup {
    position: absolute;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ccc;
    bottom: 12px;
    left: -50px;
    min-width: 250px;
    max-width: 350px;
    font-size: 14px;
}

.ol-popup:after,
.ol-popup:before {
    top: 100%;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}

.ol-popup:after {
    border-top-color: white;
    border-width: 10px;
    left: 48px;
    margin-left: -10px;
}

.ol-popup:before {
    border-top-color: #ccc;
    border-width: 11px;
    left: 48px;
    margin-left: -11px;
}

.popup-content img {
    max-width: 100%;
    max-height: 200px;
    display: block;
    margin-top: 8px;
    border-radius: 4px;
}

/* 电脑端带照片的弹出框 - 增大一倍 */
@media (min-width: 601px) {
    .ol-popup:has(.popup-content img) {
        min-width: 500px;
        max-width: 700px;
        padding: 20px;
        font-size: 16px;
    }

    .ol-popup:has(.popup-content img):after,
    .ol-popup:has(.popup-content img):before {
        left: 50%;
        transform: translateX(-50%);
    }

    .ol-popup:has(.popup-content img):after {
        margin-left: 0;
    }

    .ol-popup:has(.popup-content img):before {
        margin-left: 0;
    }

    .popup-content img {
        max-height: 400px;
    }
}

@media (max-width: 600px) {
    .ol-popup {
        min-width: 200px;
        max-width: 85vw;
        left: -20px;
        padding: 12px;
        font-size: 16px;
    }

    .ol-popup:after {
        left: 30px;
    }

    .ol-popup:before {
        left: 30px;
    }

    .popup-content img {
        max-height: 150px;
    }
}

/* 悬浮提示样式（仅非触摸设备可见） */
.ol-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.no-touch .ol-tooltip {
    display: block;
}

.touch .ol-tooltip {
    display: none !important;
}

.ol-selectable {
    cursor: pointer;
}

/* ==================== 按钮工具栏样式 ==================== */
.toolbar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 圆形按钮基础样式 */
.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ccc;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.action-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 激活状态（用于测量等） */
.action-btn.active {
    background-color: #096dd9;
    border-color: #0050b3;
    color: white;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.3);
    transform: scale(0.98);
}

/* 图层管理面板 */
#layerControl {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    min-width: 150px;
    max-height: 300px;
    overflow-y: auto;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 13px;
}

#layerControl>div:first-child {
    font-weight: bold;
    margin-bottom: 8px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

#layerControl label {
    margin-left: 5px;
    cursor: pointer;
}

#layerControl input[type="checkbox"] {
    cursor: pointer;
}

/* 手机端适配：按钮稍大，间距稍大 */
@media (max-width: 600px) {
    .action-btn {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .toolbar {
        gap: 12px;
    }
}

/* 测量结果显示框位置 */
#measureResult {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    min-width: 180px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: none;
}

/* 绘制菜单分隔线 */
.draw-menu-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

/* 鼠标悬停提示 */
.action-btn[data-title], .dropdown-btn[data-title] {
    position: relative;
    cursor: pointer;
}
.action-btn[data-title]:hover::after, .dropdown-btn[data-title]:hover::after {
    content: attr(data-title);
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-right: 10px;
}

/* 潮汐面板位置 */
#tidePanel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    min-width: 260px;
    display: none;
}

/* 潮汐图表容器 */
#tideChartContainer {
    height: 150px;
    width: 100%;
    margin-top: 10px;
}

/* 手机端适配 */
@media (max-width: 600px) {
    #layerControl {
        bottom: 80px;
        right: 10px;
        top: auto;
        left: auto;
        transform: none;
        min-width: 150px;
        max-height: 50vh;
    }

    #layerControl label {
        font-size: 12px;
    }

    /* 增大点击区域 */
    #layerControl input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin-right: 4px;
    }
}
/* 风场按钮特殊样式 */
#toggleWindBtn.active {
    background-color: #ff3366;
    border-color: #cc0033;
    color: white;
    box-shadow: 0 0 0 2px rgba(255, 51, 102, 0.3);
}

/* 洋流按钮特殊样式 */
#toggleCurrentBtn.active {
    background-color: #3366ff;
    border-color: #0033cc;
    color: white;
    box-shadow: 0 0 0 2px rgba(51, 102, 255, 0.3);
}