/* assets/css/style.css - 全局样式 + 响应式 + 主题切换 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
    --gray: #a0aec0;
    --dark: #2d3748;
    --light: #f7fafc;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #edf2f7;
    overflow-x: hidden;
}

/* 头部 */
.layui-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.logo {
    font-size: 1.4rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}
.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

/* 用户下拉菜单 */
.user-dropdown {
    position: relative;
    display: inline-block;
}
.username {
    padding: 0 12px;
    cursor: pointer;
}
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 130px;
    display: none;
    z-index: 1001;
    overflow: hidden;
}
.user-dropdown:hover .dropdown-menu {
    display: block;
}
.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}
.dropdown-menu a:hover {
    background: #f0f0f0;
}

/* 主题切换 */
.theme-switcher {
    position: relative;
    display: inline-block;
}
.theme-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    z-index: 1000;
    min-width: 100px;
}
.theme-switcher:hover .theme-dropdown {
    display: block;
}
.theme-option {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    color: #333;
}
.theme-option:hover {
    background: #f0f0f0;
}
.theme-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* 侧边栏 */
.layui-side {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 240px;
    background: #2c3e50;
    overflow-y: auto;
    z-index: 999;
    transition: transform 0.3s ease;
}
.layui-nav-tree {
    list-style: none;
}
.layui-nav-item {
    border-bottom: 1px solid #3a4a5a;
}
.layui-nav-item a {
    display: block;
    padding: 14px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background 0.2s;
}
.layui-nav-item a:hover,
.layui-nav-item.layui-this a {
    background: #1abc9c;
    color: white;
}

/* 主体内容 */
.layui-body {
    position: fixed;
    top: 60px;
    left: 240px;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 20px;
}
.layui-main {
    max-width: 1400px;
    margin: 0 auto;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.card-header {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 12px;
    padding: 20px;
}
.stat-card .number {
    font-size: 2rem;
    font-weight: bold;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}
.form-control, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* 表格响应式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow-x: auto;
}
.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

/* 进度条 */
.progress-bar {
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    height: 10px;
}
.progress-fill {
    background: linear-gradient(90deg, #48bb78, #38a169);
    height: 100%;
    width: 0%;
    transition: width 0.3s;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal.show { display: flex; }
.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}
.modal-body { padding: 20px; }
.modal-footer { padding: 15px; text-align: right; }
.modal-close { cursor: pointer; font-size: 24px; }

/* Toast */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 10px 20px;
    border-radius: 8px;
    color: white;
    z-index: 3000;
    animation: fadeInOut 2s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(20px); }
    10% { opacity: 1; transform: translateX(0); }
    90% { opacity: 1; }
    100% { opacity: 0; transform: translateX(20px); }
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}
.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    font-size: 24px;
    cursor: pointer;
    margin-right: 15px;
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    .layui-side {
        transform: translateX(-100%);
    }
    .layui-side.open {
        transform: translateX(0);
    }
    .layui-body {
        left: 0;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .data-table, .data-table tbody, .data-table tr, .data-table td {
        display: block;
    }
    .data-table thead {
        display: none;
    }
    .data-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 10px;
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px;
        border-bottom: 1px solid #eee;
    }
    .data-table td::before {
        content: attr(data-label);
        font-weight: bold;
        width: 40%;
    }
    .card-header {
        flex-direction: column;
        gap: 10px;
    }
    .filter-bar {
        flex-direction: column;
    }
}