/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

/* 应用容器 */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #001529 0%, #001529 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s;
}

.logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo h1 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo i {
    color: #1890ff;
}

/* 导航菜单 */
.nav-menu {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    margin: 5px 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: #1890ff;
}

.nav-item.active {
    background: rgba(24, 144, 255, 0.1);
    color: white;
    border-left-color: #1890ff;
}

.nav-item i {
    width: 20px;
    margin-right: 10px;
    font-size: 16px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部栏 */
.top-bar {
    background: white;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: #1890ff;
}

/* 表格容器 */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.data-table th {
    background-color: #fafafa;
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #666;
}

.data-table tr:hover {
    background-color: #fafafa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    gap: 8px;
    white-space: nowrap;
}

.btn i {
    font-size: 12px;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-primary {
    background-color: #1890ff;
    color: white;
    border: 1px solid #1890ff;
}

.btn-primary:hover {
    background-color: #40a9ff;
    border-color: #40a9ff;
}

.btn-success {
    background-color: #52c41a;
    color: white;
    border: 1px solid #52c41a;
}

.btn-success:hover {
    background-color: #73d13d;
    border-color: #73d13d;
}

.btn-danger {
    background-color: #ff4d4f;
    color: white;
    border: 1px solid #ff4d4f;
}

.btn-danger:hover {
    background-color: #ff7875;
    border-color: #ff7875;
}

.btn-warning {
    background-color: #faad14;
    color: white;
    border: 1px solid #faad14;
}

.btn-warning:hover {
    background-color: #ffc53d;
    border-color: #ffc53d;
}

.btn-outline-primary {
    background-color: transparent;
    color: #1890ff;
    border: 1px solid #1890ff;
}

.btn-outline-primary:hover {
    background-color: #1890ff;
    color: white;
}

/* 按钮组 */
.btn-group {
    display: flex;
    gap: 8px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.form-control.error {
    border-color: #ff4d4f;
}

.form-control.error:focus {
    box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2);
}

.error-message {
    color: #ff4d4f;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* 输入框组 */
.input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-group .form-control {
    flex: 1;
}

/* 网格布局 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 10px;
}

.col-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    padding: 0 10px;
}

.col-3 {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 0 10px;
}

/* 搜索栏 */
.search-bar {
    background: white;
    padding: 20px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    gap: 5px;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    text-decoration: none;
    color: #666;
    font-size: 14px;
    transition: all 0.3s;
}

.pagination a:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.pagination .active {
    background-color: #1890ff;
    border-color: #1890ff;
    color: white;
}

.pagination .disabled {
    color: #d9d9d9;
    cursor: not-allowed;
}

.pagination .disabled:hover {
    border-color: #d9d9d9;
    color: #d9d9d9;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: white;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.action-btn:hover {
    background-color: #f5f5f5;
}

.action-btn.view:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.action-btn.edit:hover {
    color: #52c41a;
    border-color: #52c41a;
}

.action-btn.delete:hover {
    color: #ff4d4f;
    border-color: #ff4d4f;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #ff4d4f;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 警告框 */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background-color: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #52c41a;
}

.alert-error {
    background-color: #fff2f0;
    border: 1px solid #ffccc7;
    color: #ff4d4f;
}

.alert-warning {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    color: #faad14;
}

.alert-info {
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
    color: #1890ff;
}

/* 水表编号输入网格 */
.meter-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .meter-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .meter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .meter-grid {
        grid-template-columns: 1fr;
    }
}

.meter-input-group {
    margin-bottom: 10px;
}

.meter-input-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    color: #666;
}

.meter-input-group input {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* 打印样式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        margin: 0;
        padding: 0;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .top-bar {
        padding: 0 15px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ddd;
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: #333;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    margin-bottom: -5px;
}