/* 模态框背景遮罩 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* 模态框内容区域 */
.modal-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 400px; /* 限制最大宽度 */
    max-height: 80vh; /* 限制最大高度，适应不同屏幕 */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 确保内容超出时隐藏 */
}

/* 模态框头部 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    position: relative; /* 用于定位返回箭头和关闭按钮 */
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
    flex-grow: 1; /* 标题占据剩余空间 */
    text-align: center; /* 标题居中 */
}

.back-arrow {
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.close-button {
    display: none !important; /* 强制隐藏关闭按钮 */
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
}

/* 搜索框 */
.search-box {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    background-color: #f9f9f9; /* 搜索框背景色 */
    position: sticky; /* 固定在顶部 */
    top: 0;
    z-index: 10; /* 确保在滚动内容之上 */
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box; /* 包含内边距和边框在宽度内 */
}

/* 国家列表容器 */
.country-list-container {
    flex-grow: 1; /* 占据剩余空间 */
    overflow-y: auto; /* 允许垂直滚动 */
    padding: 0 15px 15px; /* 底部留白 */
}

/* 国家列表部分标题 */
.country-section h3 {
    font-size: 16px;
    color: #555;
    margin-top: 20px;
    margin-bottom: 10px;
    padding-left: 5px;
}

/* 国家列表 */
.country-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.country-list li {
    display: flex;
    align-items: center;
    padding: 12px 5px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.country-list li:last-child {
    border-bottom: none; /* 最后一个列表项没有下边框 */
}

.country-list li:hover {
    background-color: #f0f0f0; /* 悬停效果 */
}

/* 国旗 */
.country-flag {
    width: 24px;
    height: 16px;
    margin-right: 10px;
    border: 1px solid #ddd; /* 国旗边框 */
    flex-shrink: 0; /* 防止国旗缩小 */
}

/* 国家信息 */
.country-info {
    flex-grow: 1; /* 国家信息占据大部分空间 */
    display: flex;
    flex-direction: column;
}

.country-name {
    font-size: 16px;
    color: #333;
    font-weight: bold;
}

.country-english-name {
    font-size: 13px;
    color: #888;
}

.country-code {
    font-size: 14px;
    color: #666;
    margin-left: auto; /* 推到最右边 */
    font-weight: bold;
}

.dial-code {
    font-size: 14px;
    color: #007bff; /* 拨号代码颜色 */
    margin-left: 10px; /* 与国家代码的间距 */
    font-weight: bold;
}
