* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* 页面布局 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 登录页面 */
#loginPage {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#loginPage.active {
    display: flex;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background-color: #667eea;
    color: white;
    width: 100%;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary:hover {
    background-color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-warning {
    background-color: #ff6b35; /* 更醒目的橙红色 */
    color: white;
    font-weight: 500;
}

.btn-warning:hover {
    background-color: #e55a2b; /* 深一些的橙红色 */
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

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

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

.btn-success {
    background-color: #48bb78;
    color: white;
}

.btn-success:hover {
    background-color: #38a169;
}

/* 主页面 */
#mainPage {
    display: none;
    flex-direction: column;
    min-height: 100vh;
}

#mainPage.active {
    display: flex;
}

.header {
    background-color: #667eea;
    color: white;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 22px;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.container {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 220px;
    background-color: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    padding: 25px 0;
    overflow-y: auto;
}

.menu {
    display: flex;
    flex-direction: column;
}

.menu-item {
    padding: 14px 25px;
    color: #333;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.3s;
    display: block;
    font-weight: 500;
}

.menu-item:hover {
    background-color: #e9ecef;
    color: #667eea;
}

.menu-item.active {
    background-color: #e8eaf6;
    color: #667eea;
    border-left-color: #667eea;
}

.content {
    flex: 1;
    padding: 25px 30px;
    overflow-y: auto;
}

.page-content {
    display: none;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* 列表 */
.list-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid #eee;
}

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

.list-table thead {
    background-color: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.list-table th {
    padding: 16px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.list-table td {
    padding: 14px 15px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    color: #555;
}

.list-table tr:hover {
    background-color: #f5f7ff;
}

.list-table tr:hover td {
    background-color: #f5f7ff;
}

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

.btn-edit {
    background-color: #4299e1;
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-edit:hover {
    background-color: #3182ce;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(50, 130, 206, 0.3);
}

.btn-view {
    background-color: #3498db;
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-view:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.btn-delete {
    background-color: #f56565;
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-delete:hover {
    background-color: #e53e3e;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(229, 62, 62, 0.3);
}

/* 照片按钮样式 */
.btn-photo {
    background-color: #4299e1; /* 蓝色系 */
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-photo:hover {
    background-color: #3182ce;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(50, 130, 206, 0.3);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #ffffff;
    padding: 0;
    border-radius: 8px;
    max-width: 600px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.modal-close:hover {
    color: #333;
    background-color: #f0f0f0;
    transform: rotate(90deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 表单 */
.form {
    display: flex;
    flex-direction: column;
}

.form h3 {
    margin: 0;
    padding: 18px 20px 15px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    text-align: center;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding: 0 20px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
    padding: 0;
}

/* 记录列表样式 */
.records-list {
    margin-top: 10px;
}

.record-item {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    background-color: #f8fafc;
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.record-type {
    font-weight: 600;
    color: #1e40af;
    font-size: 14px;
    background-color: #dbeafe;
    padding: 2px 8px;
    border-radius: 4px;
}

.record-date {
    font-size: 12px;
    color: #64748b;
}

.record-content {
    font-size: 14px;
    line-height: 1.5;
}

.record-content p {
    margin: 4px 0;
    color: #334155;
}

.record-content strong {
    color: #0f172a;
    font-weight: 600;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

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

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #a0aec0;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin: 15px 20px 20px;
    padding-top: 15px;
    border-top: 1px solid #edf2f7;
}

.form-actions .btn {
    min-width: 90px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.form-actions .btn:active {
    transform: translateY(0);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 0;
    }

    .menu {
        flex-direction: row;
        overflow-x: auto;
    }

    .menu-item {
        min-width: 120px;
        text-align: center;
        border-bottom: 3px solid transparent;
        border-left: none;
    }

    .menu-item.active {
        border-bottom-color: #667eea;
        border-left: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header {
        flex-direction: column;
        gap: 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        text-align: center;
    }

    .page-header h2 {
        min-width: auto;
        text-align: center;
    }

    .page-header .btn {
        width: 100%;
        min-width: auto;
        padding: 12px 24px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .list-table {
        font-size: 12px;
    }

    .list-table th,
    .list-table td {
        padding: 8px;
    }

    .list-actions {
        flex-direction: column;
        gap: 5px;
    }

    .btn-edit,
    .btn-delete,
    .btn-view {
        width: 100%;
    }

    /* 隐藏电箱列表页的电箱编号、位置和电压列 */
    .list-table .box-number,
    .list-table .box-location,
    .list-table .box-voltage {
        display: none;
    }
}

/* 通知 */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.alert-error {
    background-color: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.alert-info {
    background-color: #bee3f8;
    color: #2c5282;
    border: 1px solid #90cdf4;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 页面切换动画 */
.page-content {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 仪表板统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #eee;
    transition: all 0.3s ease;
    text-align: center;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
    line-height: 1.2;
}

.stat-label {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

/* 搜索表单样式 */
#searchInput {
    transition: border-color 0.3s, box-shadow 0.3s;
}

#searchInput:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
