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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f5f5f5;
}

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

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

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

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

.login-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

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

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

.login-box button {
    width: 100%;
    padding: 10px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-box button:hover {
    background-color: #5568d3;
}

.login-box .default-credentials {
    margin-top: 20px;
    padding: 15px;
    background-color: #f0f4ff;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.6;
}

.login-box .default-credentials p {
    margin-bottom: 5px;
}

.login-box .default-credentials strong {
    color: #667eea;
}

.alert {
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 14px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 主布局 */
.main-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #34495e;
    text-align: center;
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 12px;
    color: #95a5a6;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    border-bottom: 1px solid #34495e;
}

.sidebar-menu a {
    display: block;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background-color: #34495e;
    border-left-color: #667eea;
    padding-left: 23px;
}

.sidebar-menu a.active {
    background-color: #667eea;
    border-left-color: #667eea;
    color: white;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 250px;
    padding: 15px 20px;
    border-top: 1px solid #34495e;
    background-color: #2c3e50;
}

.sidebar-footer a {
    display: block;
    color: #95a5a6;
    text-decoration: none;
    font-size: 12px;
    padding: 5px 0;
    cursor: pointer;
}

.sidebar-footer a:hover {
    color: #ecf0f1;
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.header {
    background-color: white;
    padding: 15px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header h1 {
    font-size: 20px;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

.user-info span {
    font-size: 14px;
    color: #666;
}

.logout-btn {
    padding: 8px 16px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: #c0392b;
}

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

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

.table-container.filter-container {
    overflow: visible;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.table-header h2 {
    font-size: 18px;
    color: #333;
}

.btn-primary {
    padding: 10px 20px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-secondary {
    padding: 8px 16px;
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    margin-right: 5px;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-success {
    padding: 8px 16px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

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

.btn-danger {
    padding: 8px 16px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

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

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

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

thead {
    background-color: #f8f9fa;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* 表单样式 */
.form-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 30px;
    max-width: 600px;
    margin: 0 auto;
}

.form-container h2 {
    margin-bottom: 30px;
    color: #333;
    font-size: 20px;
}

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

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

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

.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);
}

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.form-actions button {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.form-actions .btn-submit {
    background-color: #667eea;
    color: white;
}

.form-actions .btn-submit:hover {
    background-color: #5568d3;
}

.form-actions .btn-cancel {
    background-color: #e0e0e0;
    color: #333;
}

.form-actions .btn-cancel:hover {
    background-color: #d0d0d0;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
    padding: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination a:hover {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .disabled {
    color: #ccc;
    cursor: not-allowed;
    border-color: #ddd;
}

.pagination .disabled:hover {
    background-color: transparent;
    color: #ccc;
}

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

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

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.modal-lg {
    max-width: 900px;
}

/* 两列表单布局 */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #333;
}

/* 数据板样式 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.dashboard-card h3 {
    font-size: 14px;
    color: #999;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dashboard-card .number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

.dashboard-card .unit {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* 图片预览 */
.image-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 5px;
}

/* 图片上传 */
.image-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.image-upload-wrapper input[type="file"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.image-upload-wrapper input[type="file"]::file-selector-button {
    padding: 6px 12px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.image-upload-wrapper input[type="file"]::file-selector-button:hover {
    background-color: #5568d3;
}

.image-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.image-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    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); }
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -50px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    white-space: nowrap;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 技术支持悬停提示 */
.support-tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.support-tooltip:hover::after {
    content: attr(data-support);
    position: absolute;
    bottom: 100%;
    right: 0;
    background-color: #333;
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 5px;
    z-index: 1000;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* 维度表交互样式 */
.summary-row {
    background-color: #f8f9fa;
    font-weight: 600;
    border-top: 2px solid #667eea;
}
.toggle-btn {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 3px;
    margin-right: 6px;
    cursor: pointer;
    user-select: none;
    color: #667eea;
}
.collapsed-row {
    display: none;
}

.search-results-container {
    position: relative;
}
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.search-results.show {
    display: block;
}
.search-result-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    z-index: 999;
}
.search-result-item:hover {
    background-color: #f7faff;
}
.search-result-item strong {
    color: #007bff;
}

.summary-row.level-batch {
    background-color: #fff4e6;
}
.summary-row.level-model {
    background-color: #f0fff4;
}
.summary-row.level-customer {
    background-color: #eef3ff;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 60px;
        display: flex;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .sidebar-header {
        display: none;
    }

    .sidebar-menu {
        display: flex;
        padding: 0;
        width: 100%;
    }

    .sidebar-menu li {
        border-bottom: none;
        border-right: 1px solid #34495e;
    }

    .sidebar-menu a {
        padding: 15px 15px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .sidebar-menu a:hover {
        border-left: none;
        border-bottom-color: #667eea;
    }

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

    .sidebar-footer {
        display: none;
    }

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

    .header-right {
        width: 100%;
        justify-content: center;
    }

    .main-content {
        padding: 15px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 10px 5px;
    }

    .btn-small {
        padding: 4px 8px;
        font-size: 11px;
    }

    .form-container {
        padding: 20px;
    }

    .login-box {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .sidebar-menu {
        flex-wrap: wrap;
    }

    .sidebar-menu li {
        flex: 1 1 50%;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn-primary {
        width: 100%;
        margin-top: 10px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .modal-content {
        width: 95%;
    }

    .modal-content.modal-lg {
        max-width: 95%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}
