/* 通话记录弹窗样式 */
#call-history-modal.modal {
    display: none;
    position: fixed;
    z-index: 2000 !important; /* 提高层级，覆盖联系人视图 (1030) */
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden; /* 隐藏 modal 自身的滚动条 */
    background-color: rgba(0, 0, 0, 0.4);
    padding: 0 !important;
}

/* 移动端默认样式 (max-width: 767px) */
@media (max-width: 767.98px) {
    #call-history-modal.modal {
        /* 移动端：底部留出空间给菜单栏 */
        padding-bottom: 70px !important; 
        /* 适配 iPhone X 底部安全区 */
        padding-bottom: calc(70px + env(safe-area-inset-bottom)) !important;
    }

    #call-history-modal .modal-content {
        background-color: #fefefe;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        width: 100vw !important; /* 强制视口宽度 */
        height: 100% !important;
        border-radius: 0 !important; /* 强制直角 */
        display: flex;
        flex-direction: column;
        box-shadow: none !important;
        max-width: none !important; /* 覆盖可能的 max-width */
    }
}

/* 大屏幕适配：居中显示 */
@media (min-width: 768px) {
    #call-history-modal.modal {
        padding-bottom: 0 !important;
        /* 移除 display: flex !important 以防止自动显示 */
        /* 使用伪元素辅助垂直居中 (如果需要) 或者简单的 margin */
        text-align: center;
    }
    
    /* 辅助垂直居中 */
    #call-history-modal.modal::before {
        content: "";
        display: inline-block;
        height: 100%;
        vertical-align: middle;
        margin-right: -4px;
    }

    #call-history-modal .modal-content {
        width: 400px !important;
        height: 80% !important;
        /* 使用 inline-block 和 vertical-align 实现居中 */
        display: inline-flex !important; 
        vertical-align: middle;
        margin: 0 auto !important;
        border-radius: 8px !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.5) !important;
        flex-direction: column;
        background-color: #fefefe;
        text-align: left; /* 重置文本对齐 */
    }
}

#call-history-modal .modal-header {
    padding: 0 15px; /* 调整 padding */
    border-bottom: 1px solid #eee;
    background-color: #fff;
    border-radius: inherit;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* 两端对齐 */
    flex-shrink: 0;
}

#call-history-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    flex: 1; /* 占据剩余空间 */
    text-align: center; /* 文字居中 */
    /* 为了绝对居中，可能需要左侧也有一个占位符，或者使用 absolute */
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none; /* 防止遮挡点击 */
}

/* 统一关闭按钮样式 */
#call-history-modal .close-modal {
    /* 移除 absolute 定位，使用 flex 布局 */
    position: relative; 
    margin-left: auto; /* 推到最右边 */
    height: 50px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2001;
    color: #333;
}

#call-history-modal .close-modal svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    stroke: currentColor; /* 增加可见性 */
    stroke-width: 0.5px;
}

#call-history-modal .close-modal:hover {
    color: #000;
    background-color: rgba(0,0,0,0.05);
}

#modal-history-list {
    list-style: none;
    padding: 10px 0; /* 给列表一点上下间距 */
    margin: 0;
    flex-grow: 1;
    overflow-y: auto; /* 允许列表内容滚动 */
    background-color: #f5f5f5; /* 浅灰背景，突出卡片 */
    /* 确保圆角 */
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

/* 列表项样式由 js/callHistory.js 中的卡片样式接管，这里只需确保容器无干扰 */
#modal-history-list li {
    /* 移除旧样式干扰 */
    border-bottom: none;
    display: block; 
    padding: 0;
}

#modal-history-list li:hover {
    background-color: transparent;
}
