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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    position: relative;
}

.header-top {
    position: absolute;
    top: 15px;
    right: 20px;
}

.language-selector select {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-selector select:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.language-selector select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.language-selector option {
    background: #667eea;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* 卡片样式 */
section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

section h2 {
    color: #4a5568;
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

section h2 i {
    color: #667eea;
}

/* 网格布局 */
.info-grid, .meter-grid, .signature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-item, .meter-item, .signature-item {
    display: flex;
    flex-direction: column;
}

/* 表单元素 */
label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

input[type="text"], input[type="number"], input[type="date"], select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8fafc;
}

input[type="text"]:focus, input[type="number"]:focus, input[type="date"]:focus, select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 表格样式 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th {
    background: #f7fafc;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.9rem;
}

td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

tr:hover {
    background: #f8fafc;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.3);
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
    transform: translateY(-2px);
}

.btn-danger {
    background: #f56565;
    color: white;
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-danger:hover {
    background: #e53e3e;
}

/* 操作按钮区域 */
.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 16px;
    width: 95%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 20px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

.room-list-container {
    margin-bottom: 20px;
    position: relative;
}

.room-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    padding-bottom: 30px;
}

.room-list-bottom-mask {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(transparent, rgba(255,255,255,0.9));
    pointer-events: none;
    border-radius: 0 0 8px 8px;
    z-index: 1;
}



.room-list h4, .add-room-form h4 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.room-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    cursor: grab;
    user-select: none;
}

.room-item:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.room-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.room-icon {
    font-size: 1.2rem;
}

.room-name {
    font-weight: 500;
    color: #4a5568;
}

.room-actions {
    display: flex;
    gap: 8px;
}

.room-actions button {
    padding: 6px 12px;
    font-size: 0.8rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-actions .edit-btn {
    background: #4299e1;
    color: white;
}

.room-actions .edit-btn:hover {
    background: #3182ce;
}

.room-actions .delete-btn {
    background: #f56565;
    color: white;
}

.room-actions .delete-btn:hover {
    background: #e53e3e;
}

.add-room-form {
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 日期输入框样式 */
.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-input-wrapper input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.date-picker-btn {
    padding: 12px 16px;
    background: #667eea;
    color: white;
    border: 2px solid #667eea;
    border-left: none;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.date-picker-btn:hover {
    background: #5a67d8;
    border-color: #5a67d8;
}

.date-picker-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 拖拽排序样式 */
.room-item {
    cursor: grab;
    user-select: none;
    transition: all 0.3s ease;
}

.room-item:active {
    cursor: grabbing;
}

.room-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 1000;
}

.room-item.drag-over {
    border-top: 3px solid #667eea;
    background: #f0f4ff;
    position: relative;
}

.room-item.drag-over::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.drag-handle {
    cursor: grab;
    padding: 8px;
    margin-right: 10px;
    color: #a0aec0;
    transition: color 0.3s ease;
}

.drag-handle:hover {
    color: #667eea;
}

.drag-handle:active {
    cursor: grabbing;
}

/* 编辑模式样式 */
.room-item.editing .room-info {
    display: none;
}

.room-item.editing .edit-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.room-item .edit-form {
    display: none;
}

.room-item.editing .edit-form {
    display: flex;
}

.edit-form input, .edit-form select {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
}

.edit-form input:focus, .edit-form select:focus {
    outline: none;
    border-color: #667eea;
}

/* 数量输入框 */
.quantity-input {
    width: 80px;
    text-align: center;
}

/* 状态选择器 */
.status-select {
    min-width: 100px;
}

/* 房间选择器 */
.room-select {
    min-width: 120px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    section {
        padding: 20px;
    }
    
    .info-grid, .meter-grid, .signature-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 0.85rem;
    }
    
    /* 移动端模态框优化 */
    .modal-content {
        margin: 1% auto;
        width: 98%;
        max-height: 95vh;
    }
    
    .modal-body {
        padding: 15px;
        max-height: calc(95vh - 70px);
    }
    
    .room-list {
        max-height: 250px;
    }
    
    .room-item {
        padding: 8px 10px;
        margin-bottom: 6px;
    }
    
    .room-actions button {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeIn 0.6s ease-out;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    section {
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }
    
    .actions {
        display: none;
    }
}
