/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f5f5f5;
    line-height: 1.5;
}

/* 管理系统容器 */
.admin-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* 顶部导航栏 */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px;
    background-color: #1890ff;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-left .logo {
    font-size: 20px;
    font-weight: bold;
}

.header-right .user-info {
    display: flex;
    align-items: center;
}

/* 主内容区 */
.admin-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧菜单 */
.admin-sidebar {
    width: 220px;
    background-color: #001529;
    color: white;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    margin: 0;
}

.nav-item.active {
    background-color: #1890ff;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
}

.nav-link:hover {
    background-color: #1890ff;
}

.nav-icon {
    margin-right: 10px;
    font-size: 16px;
}

/* 右侧内容 */
.admin-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f5f5f5;
}

/* 内容标题 */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e8e8;
}

.content-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
    color: #262626;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.3s;
}

.btn-primary {
    color: white;
    background-color: #1890ff;
    border-color: #1890ff;
}

.btn-primary:hover {
    background-color: #40a9ff;
    border-color: #40a9ff;
}

.btn-secondary {
    color: #333;
    background-color: #fff;
    border-color: #d9d9d9;
}

.btn-secondary:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.btn-danger {
    color: white;
    background-color: #ff4d4f;
    border-color: #ff4d4f;
}

.btn-danger:hover {
    background-color: #ff7875;
    border-color: #ff7875;
}

/* 表单样式 */
.form-control {
    display: inline-block;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: white;
    background-image: none;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    transition: all 0.3s;
}

.form-control:focus {
    border-color: #1890ff;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

/* 表格样式 */
.table-container {
    margin-bottom: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

.data-table th {
    background-color: #fafafa;
    font-weight: bold;
    color: #262626;
}

.data-table tr:hover {
    background-color: #f5f5f5;
}

.data-table tr.no-data td {
    text-align: center;
    padding: 40px;
    color: #999;
    background-color: #fafafa;
}

/* 筛选区域 */
.filter-section {
    margin-bottom: 20px;
    padding: 16px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

/* 所有筛选器项水平排列 */
.filter-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.filter-item label {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    margin: 0;
}

/* 客户和款号选择器的下拉框 */
#customer-select, #item-select {
    min-width: 120px;
    height: 32px;
    font-size: 14px;
}

/* 日期范围选择器 */
.filter-item:has(#date-from),
.filter-item:has(#stats-date-from),
.filter-item:has(#bill-date-from) {
    gap: 8px;
    margin-left: 0;
}

/* 日期范围选择器的标签 */
.filter-item:has(#date-from) label,
.filter-item:has(#stats-date-from) label,
.filter-item:has(#bill-date-from) label {
    margin-right: 8px;
    font-size: 14px;
}

/* 日期输入框 */
.filter-item:has(#date-from) .form-control,
.filter-item:has(#stats-date-from) .form-control,
.filter-item:has(#bill-date-from) .form-control {
    width: 150px;
    height: 32px;
    margin: 0;
    padding: 4px 8px;
    font-size: 14px;
}

.date-separator {
    margin: 0 8px;
    white-space: nowrap;
    font-size: 14px;
    color: #666;
}

/* 模态框样式 */
.modal {
    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.show {
    display: flex;
}

.modal-content {
    width: 500px;
    max-width: 90%;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #e8e8e8;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #666;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e8e8e8;
    background-color: #fafafa;
}

/* 分页控件 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 12px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    color: #666;
}

/* 统计信息区域 */
.total-section {
    margin: 20px 0;
    padding: 16px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.total-section h3 {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: bold;
}

.total-info {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.total-info span {
    margin-right: 16px;
    font-size: 14px;
}

.total-info strong {
    color: #1890ff;
}

/* 打印设置区域 */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-section {
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.settings-section h3 {
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: bold;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.print-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 12px 0;
}

.print-option-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    color: white;
}

.action-btn.edit {
    background-color: #1890ff;
}

.action-btn.delete {
    background-color: #ff4d4f;
}

/* 账单生成区域 */
.bill-generation-section {
    margin: 10px 0;
    padding: 16px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.bill-generation-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 标签页内容 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 打印标题 */
.print-title {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 24px;
}

/* 图片预览 */
.images-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.image-preview-item {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #d9d9d9;
}

/* 详情页面 */
.detail-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.detail-header {
    text-align: center;
    margin-bottom: 24px;
}

.detail-header h2 {
    margin-bottom: 8px;
    font-size: 24px;
    font-weight: bold;
}

.detail-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e8e8e8;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h3 {
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: bold;
}

.detail-item {
    margin-bottom: 12px;
}

.detail-item strong {
    display: inline-block;
    width: 100px;
}

/* 字段配置样式 */
.fields-config-container {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-top: 15px;
}

.field-config-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.field-config-table th,
.field-config-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.field-config-table th {
    background-color: #f0f0f0;
    font-weight: bold;
    color: #333;
}

.field-config-table tr:last-child td {
    border-bottom: none;
}

.field-config-table tr:hover {
    background-color: #f5f5f5;
}

.field-config-table .form-control {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.field-config-table .order-input {
    width: 60px;
}

.field-config-table .btn {
    padding: 4px 8px;
    font-size: 12px;
    margin-right: 5px;
}

.field-config-table .btn-sm {
    padding: 2px 6px;
    font-size: 11px;
}

.field-config-table .move-up-btn,
.field-config-table .move-down-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.fields-config-container .btn {
    margin-right: 10px;
    margin-top: 10px;
}

/* DIY项目选择栏样式 */
.diy-projects-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 10px;
}

.diy-tab-btn {
    padding: 8px 16px;
    border: 1px solid #d9d9d9;
    background-color: #f5f5f5;
    color: #333;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.diy-tab-btn:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.diy-tab-btn.active {
    background-color: white;
    color: #1890ff;
    border-color: #1890ff;
    border-bottom-color: white;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(24, 144, 255, 0.2);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .admin-main {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        height: auto;
    }
    
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .total-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .field-config-table {
        font-size: 12px;
    }
    
    .field-config-table th,
    .field-config-table td {
        padding: 8px 6px;
    }
    
    .field-config-table .form-control {
        font-size: 12px;
        padding: 4px 6px;
    }
    
    /* DIY项目选择栏响应式调整 */
    .diy-projects-tabs {
        flex-wrap: wrap;
    }
    
    .diy-tab-btn {
        flex: 1;
        min-width: 120px;
    }
}

/* 打印样式 */
@media print {
    .admin-header,
    .admin-sidebar,
    .header-actions,
    .filter-section,
    .bill-generation-section,
    .pagination,
    .action-buttons {
        display: none !important;
    }
    
    .admin-content {
        padding: 0;
    }
    
    .table-container {
        box-shadow: none;
    }
    
    .data-table {
        border: 1px solid #000;
    }
    
    .data-table th,
    .data-table td {
        border: 1px solid #000;
    }
    
    .print-title {
        display: block !important;
    }
}