/* css/forbidden_area_and_patrol_area_pane.css */
.area-list-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    z-index: 100;
    max-height: 150px;
}

.area-list-panel .tab-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.area-list-panel .tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.area-list-panel .tab {
    padding: 8px 15px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: var(--text-color);
    flex: 1;
    text-align: center;
    transition: all 0.3s;
}

.area-list-panel .tab.active {
    background: var(--primary-color);
    color: var(--background-darker);
    font-weight: bold;
}

.area-list-panel .tab-content {
    flex: 1;
    overflow: hidden;
    padding: 10px;
}

.area-list-panel .tab-pane {
    height: 100%;
    display: none;
}

.area-list-panel .tab-pane.active {
    display: block;
}

/* 横向列表容器样式 */
.area-list-container {
    display: flex;
    overflow-x: auto;
    /* 改为 visible 确保弹窗不会被裁剪 */
    overflow-y: visible;
    padding: 5px 0;
    gap: 10px;
    height: calc(100% - 30px);
}

.area-list-container::-webkit-scrollbar {
    height: 6px;
}

.area-list-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.area-list-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.area-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* 横向列表项样式 */
.area-item-horizontal {
    flex: 0 0 auto;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.3s;
    border-left: 3px solid var(--primary-color);
    min-width: 120px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* 确保相对定位，作为弹窗的定位上下文 */
    position: relative;
    /* 触发硬件加速，提高性能 */
    transform: translateZ(0);
}

.area-item-horizontal:hover {
    background: rgba(0, 255, 255, 0.2);
}

.area-item-horizontal.selected {
    background: rgba(0, 255, 255, 0.3);
    border-left: 3px solid #f00;
}

/* 调整弹窗样式以固定位置和大小，并保持不动 */
.area-popup {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 10px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    /* 固定宽度和高度 */
    width: 250px;
    height: 100px;
    position: fixed;
    /* 改为 fixed 定位，相对于视口定位 */
    z-index: 1001;
    /* 固定显示在按钮的左上角偏移位置 */
    top: -250px;
    left: -50px;
    box-sizing: border-box;
    /* 允许内容换行 */
    white-space: normal;
    /* 内容溢出时显示滚动条 */
    overflow-y: auto;
    /* 防止内容变化影响布局 */
    contain: layout style;
}

/* 缩小弹窗滚动条 */
.area-popup::-webkit-scrollbar {
    width: 4px;
}

.area-popup::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.area-popup::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

.area-popup::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.area-popup::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--border-color) transparent transparent transparent;
}

.area-popup button {
    display: inline-block;
    /* 使用百分比宽度确保按钮适应弹窗 */
    width: calc(50% - 5px);
    margin: 3px 2.5px;
    padding: 6px 5px;
    background: var(--button-bg);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    /* 允许按钮文字换行 */
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
    box-sizing: border-box;
    /* 确保按钮不会过小 */
    min-height: 24px;
}

.area-popup button:first-child {
    margin-left: 0;
}

.area-popup button:last-child {
    margin-right: 0;
}

.area-popup button:hover {
    background: var(--button-hover);
}