/**
 * NtrmSysCore 统一弹窗样式组件
 *
 * 使用说明：
 * 1. 引入此文件: <link rel="stylesheet" href="/css/components/ntrm-modal.css">
 * 2. 使用 .ntrm-modal 类名，避免与 Bootstrap .modal 冲突
 * 3. 通过 .show 类控制显示/隐藏
 *
 * 版本: 1.0.0
 * 创建日期: 2026-01-18
 */

/* ========== 弹窗遮罩层 ========== */
.ntrm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1050;
    overflow: auto;
}

.ntrm-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== 弹窗内容容器 ========== */
.ntrm-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: ntrm-modal-fadeIn 0.2s ease-out;
}

/* 大尺寸弹窗 */
.ntrm-modal-content.ntrm-modal-lg {
    max-width: 800px;
}

/* 超大尺寸弹窗 */
.ntrm-modal-content.ntrm-modal-xl {
    max-width: 1100px;
}

/* ========== 弹窗头部 ========== */
.ntrm-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 12px 12px 0 0;
}

.ntrm-modal-header h3,
.ntrm-modal-header .ntrm-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* ========== 关闭按钮 ========== */
.ntrm-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.ntrm-modal-close:hover {
    color: #000;
}

/* ========== 弹窗主体 ========== */
.ntrm-modal-body {
    padding: 20px;
    background: #fff;
}

/* ========== 弹窗底部 ========== */
.ntrm-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #fff;
    border-radius: 0 0 12px 12px;
}

/* ========== 表单组件（弹窗内使用） ========== */
.ntrm-modal .ntrm-form-group {
    margin-bottom: 16px;
}

.ntrm-modal .ntrm-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
    font-weight: 500;
}

.ntrm-modal .ntrm-form-group input,
.ntrm-modal .ntrm-form-group textarea,
.ntrm-modal .ntrm-form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ntrm-modal .ntrm-form-group input:focus,
.ntrm-modal .ntrm-form-group textarea:focus,
.ntrm-modal .ntrm-form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* ========== 动画效果 ========== */
@keyframes ntrm-modal-fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========== 响应式适配 ========== */
@media (max-width: 768px) {
    .ntrm-modal-content,
    .modal-card {
        width: 95%;
        max-width: none;
        margin: 10px;
    }

    .ntrm-modal-content.ntrm-modal-lg,
    .ntrm-modal-content.ntrm-modal-xl,
    .modal-card.modal-lg,
    .modal-card.modal-xl {
        max-width: none;
    }

    .ntrm-modal-header,
    .ntrm-modal-body,
    .ntrm-modal-footer,
    .modal-header,
    .modal-body,
    .modal-actions {
        padding: 15px;
    }
}

/* ========== 无前缀类名别名（兼容 customer-sales-mappings.html 等） ========== */
/* 这些别名与 ntrm-* 前缀类名完全等效，保持向后兼容 */

.modal-card {
    background: #fff;
    border-radius: 12px;
    width: min(880px, calc(100vw - 32px));
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: ntrm-modal-fadeIn 0.2s ease-out;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 12px 12px 0 0;
}

.modal-header h3,
.modal-header .modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
    background: #fff;
}

.modal-actions {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #fff;
    border-radius: 0 0 12px 12px;
}
