/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f5f5f5;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    background-color: #2c3e50;
    color: #fff;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.header h1 {
    font-size: 20px;
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info a {
    color: #fff;
    text-decoration: none;
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 3px;
    transition: background-color 0.3s;
}

.user-info a:hover {
    background-color: rgba(255,255,255,0.1);
}

/* 导航样式 */
.nav {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #ccc transparent; /* Firefox */
    width: 100%; /* 确保占满宽度 */
}

/* 隐藏滚动条但保持滚动功能（Webkit浏览器） */
.nav::-webkit-scrollbar {
    height: 6px;
}

.nav::-webkit-scrollbar-track {
    background: transparent;
}

.nav::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.nav::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.nav .container {
    display: flex; /* 使用 flex 布局 */
    padding: 0 20px;
    white-space: nowrap; /* 防止换行 */
    width: max-content; /* 根据内容自适应宽度 */
    max-width: none; /* 移除最大宽度限制 */
    min-width: 100%; /* 至少占满父容器宽度，确保在小屏幕上也能滚动 */
}

.nav a {
    display: block; /* 改为 block，配合 flex 使用 */
    padding: 15px 20px;
    color: #666;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    white-space: nowrap; /* 防止文字换行 */
    flex-shrink: 0; /* 防止收缩 */
    flex-grow: 0; /* 不自动扩展 */
    min-width: fit-content; /* 根据内容自适应最小宽度 */
}

.nav a:hover {
    color: #2c3e50;
    border-bottom-color: #2c3e50;
}

.nav a.active {
    color: #2c3e50;
    border-bottom-color: #2c3e50;
    font-weight: 500;
}

/* 登录页面 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box input,
.search-box select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-box input {
    width: 200px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    background-color: #6c757d;
    color: #fff;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary {
    background-color: #007bff;
}

.btn-success {
    background-color: #28a745;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* 表格样式 */
.table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.table thead {
    background-color: #f8f9fa;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    font-weight: 500;
    color: #666;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table code {
    background-color: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* 分页 */
.pagination {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    background-color: #fff;
    margin: 50px auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 提示框 */
.alert {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
}

