/* ============================================================
   全屋定制管理系统 - 公共样式文件 common.css
   基于Metal2风格，主色 #4f46e5（紫色主题）
   适用：所有业务页面，替代各页面重复的内联<style>
   ============================================================ */

/* ---------- 重置与基础 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

body {
    background-color: #f0f2f5;
    color: #334155;
    line-height: 1.6;
    font-size: 14px;
    padding-top: 72px;
}

a {
    text-decoration: none;
    color: #4f46e5;
}
a:hover {
    text-decoration: underline;
}

/* ---------- 顶部标题栏 ---------- */
.biaoti {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #fff;
    padding: 16px 0;
    text-align: center;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.biaotiwenzi {
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 1px;
}

/* 顶部标题栏下方留白 */
body.has-biaoti {
    padding-top: 60px;
}

/* ---------- 内容容器 ---------- */
.neirongjiedan {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    margin: 0 20px 20px;
}

.centen2 {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ---------- 页脚 ---------- */
.jiewei {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
    font-size: 13px;
}

/* ---------- 页面标题 ---------- */
.page-title {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #1e293b;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.page-header h2 {
    color: #4f46e5;
    font-size: 18px;
    font-weight: 600;
}

/* ---------- 分区标题 ---------- */
.section-title {
    font-size: 16px;
    font-weight: 500;
    margin: 22px 0 10px;
    color: #334155;
    border-left: 4px solid #4f46e5;
    padding-left: 10px;
}

.sub-title {
    font-size: 14px;
    font-weight: 500;
    margin: 16px 0 8px;
    color: #475569;
    padding-left: 6px;
}

/* ---------- 按钮 ---------- */
button, .btn {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    margin: 0 8px;
    display: inline-block;
}

button:hover, .btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.3);
}

button:disabled, .btn:disabled {
    background: #cbd5e1 !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%) !important;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}
.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}
.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}
.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
}

.btn-default {
    background: #64748b !important;
    color: #fff !important;
    border: none !important;
}
.btn-default:hover {
    background: #475569 !important;
    color: #fff !important;
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
}
.btn-info:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
}

/* 小按钮 - 表格操作列通用 */
.btn-sm {
    padding: 5px 12px !important;
    font-size: 12px !important;
    margin: 2px 3px !important;
    border-radius: 4px !important;
}

.btn-group {
    text-align: center;
    margin: 32px 0 12px;
}

.back-btn {
    background: #64748b !important;
    padding: 6px 14px !important;
    font-size: 13px !important;
}

/* ---------- 表单 ---------- */
.form-group, .form-item {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

.form-group label, .form-item label, .label {
    width: 120px;
    text-align: right;
    padding-right: 12px;
    color: #475569;
    font-weight: 500;
    flex-shrink: 0;
}

.form-group .value, .form-item .value {
    flex: 1;
}

input, select, textarea {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    color: #334155;
    background: #fff;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input[type="checkbox"], input[type="radio"] {
    width: auto;
    margin-right: 6px;
}

/* ---------- 表格 ---------- */
.table-container {
    overflow-x: auto;
    margin: 16px 0;
}

/* 通用业务表格 - 所有列表页面共用（强制完整边框，防止无线条） */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid #cbd5e1; /* 表格外边框 */
}

table th {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    color: #1e293b; /* 加深表头文字 */
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #c4b5fd; /* 表头完整边框 */
}

table td {
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #e2e8f0; /* 单元格完整边框 */
    color: #1e293b; /* 加深正文文字，确保清晰 */
    background: #fff;
}

table tr:nth-child(even) td {
    background: #f8fafc;
}

table tr:hover td {
    background: #f5f3ff !important;
}

/* 带边框的表格变体 */
.data-table, table.data-table, .list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th, .list-table th {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    color: #334155;
    padding: 12px 8px;
    text-align: center;
    font-weight: 500;
    border: 1px solid #c4b5fd;
}

.data-table td, .list-table td {
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
    color: #334155;
    background: #fff;
}

.data-table tr:nth-child(even) td, .list-table tr:nth-child(even) td {
    background: #f8fafc;
}

.data-table tr:hover td, .list-table tr:hover td {
    background: #f5f3ff !important;
}

/* 打印用表格（蓝头灰身）- 仅在带 print-table 类的容器内生效，避免与业务页 .bg 冲突 */
.print-table th.bt {
    text-align: center;
    background-color: #4f46e5;
    color: #fff;
    border: 1px solid #4338ca;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.print-table td.bg {
    text-align: center;
    background-color: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

/* 信息展示表格 */
.info-table, .base-info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.info-table td, .base-info-table td {
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    font-size: 14px;
}

.info-table td:first-child, .base-info-table td.label {
    background-color: #f1f5f9;
    width: 120px;
    font-weight: 500;
    text-align: right;
    color: #475569;
}

/* ---------- 弹窗/模态框 ---------- */
.modal, .mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
}

.modal-body {
    background: #fff;
    width: 80%;
    max-width: 900px;
    margin: 50px auto;
    padding: 24px;
    border-radius: 8px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-body.small {
    width: 500px;
    max-width: 500px;
}

.close {
    float: right;
    cursor: pointer;
    font-size: 24px;
    color: #94a3b8;
    line-height: 1;
    font-weight: bold;
}
.close:hover {
    color: #475569;
}

/* ---------- 搜索框 ---------- */
.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-box input, .search-box select {
    width: 200px;
}

/* ---------- 统计卡片 ---------- */
.stats-container {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 150px;
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stat-card .stat-num {
    font-size: 28px;
    font-weight: 600;
    color: #4f46e5;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* ---------- 汇总栏 ---------- */
.summary-bar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #475569;
}

.summary-bar span {
    margin-right: 20px;
}

.summary-bar b {
    color: #4f46e5;
    font-weight: 500;
}

/* ---------- 分页 ---------- */
.pagination {
    text-align: center;
    margin: 20px 0;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #475569;
    background: #fff;
}

.pagination a:hover {
    border-color: #4f46e5;
    color: #4f46e5;
    text-decoration: none;
}

.pagination .current, .pagination .active {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

/* ---------- 状态标签 ---------- */
.status-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-normal { background: #dcfce7; color: #166534; }
.status-warning { background: #fef3c7; color: #92400e; }
.status-danger { background: #fee2e2; color: #991b1b; }
.status-info { background: #dbeafe; color: #1e40af; }

/* ---------- 图片预览 ---------- */
.img-preview {
    max-width: 200px;
    max-height: 150px;
    border: 1px solid #e2e8f0;
    margin: 8px 0;
    object-fit: cover;
    border-radius: 4px;
}

.info-img {
    max-width: 260px;
    margin: 10px 0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

/* ---------- 打印样式 ---------- */
@media print {
    body {
        padding-top: 0 !important;
        background: #fff !important;
    }
    .biaoti, .btn-group, .jiewei, .search-box, .pagination, .no-print {
        display: none !important;
    }
    .neirongjiedan, .centen2 {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 8px 0 !important;
    }
    .page-title {
        margin-top: 0 !important;
        margin-bottom: 16px !important;
    }
    /* 打印时强制显示表格边框和背景色 */
    table, table th, table td {
        border: 1px solid #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    table th {
        background: #e0e7ff !important;
        color: #000 !important;
    }
    table td {
        color: #000 !important;
    }
    @page {
        size: A4 portrait;
        margin: 15mm 12mm;
    }
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .neirongjiedan {
        margin: 10px;
        padding: 16px;
    }
    .modal-body {
        width: 95%;
        margin: 20px auto;
    }
    .form-group, .form-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .form-group label, .form-item label {
        width: auto;
        text-align: left;
        margin-bottom: 4px;
    }
}
