/* ========================================
   公共样式 - 自适应电脑/手机
   ======================================== */

/* 全局重置 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    height: 100%;
    font-family: "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f5f7fa;
}
a { text-decoration: none; color: #409eff; cursor: pointer; }
a:hover { color: #66b1ff; }

/* 通用容器 */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* 清除浮动 */
.clearfix::after {
    content: ''; display: block; clear: both;
}

/* ========================================
   登录页样式
   ======================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 12px;
    padding: 40px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
.login-title {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}
.login-subtitle {
    text-align: center;
    color: #909399;
    margin-bottom: 30px;
    font-size: 13px;
}
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 14px;
    color: #606266;
    margin-bottom: 8px;
}
.form-input {
    width: 100%;
    height: 44px;
    padding: 0 15px;
    font-size: 14px;
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.3s;
}
.form-input:focus { border-color: #409eff; }
.btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 15px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}
.btn-primary:hover { opacity: 0.9; }

/* ========================================
   主布局样式
   ======================================== */
.main-layout { display: flex; min-height: 100vh; }

/* 左侧菜单 */
.sidebar {
    width: 220px;
    background: #304156;
    color: #bfcbd9;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s, width 0.3s;
}
.sidebar.collapsed {
    width: 64px;
}
.sidebar.collapsed .sidebar-logo span.txt {
    display: none;
}
.sidebar.collapsed .menu-link span.txt {
    display: none;
}
.sidebar.collapsed .submenu {
    display: none !important;
}
.sidebar-logo {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #263445;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
}
.menu-list { list-style: none; }
.menu-item { }
.menu-link {
    display: block;
    padding: 14px 20px;
    color: #bfcbd9;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}
.menu-link:hover, .menu-link.active {
    background: #1890ff;
    color: #fff;
}
.submenu { list-style: none; }
.submenu .menu-link {
    padding-left: 40px;
    font-size: 13px;
}

/* 手机端菜单遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
.sidebar-overlay.show {
    display: block;
}

/* 右侧内容区 */
.main-content {
    flex: 1;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh; /* 高度占满 */
    transition: margin-left 0.3s;
}
.main-content.collapsed {
    margin-left: 64px;
}

/* 顶部导航（整合标签栏+用户信息） */
.header {
    height: 60px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    display: flex;
    align-items: center;
    padding: 0 15px;
    position: sticky;
    top: 0;
    z-index: 98;
    flex-shrink: 0; /* 固定高度，不收缩 */
}
.header-left { display: flex; align-items: center; }
.menu-toggle-btn {
    font-size: 18px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
}
.menu-toggle-btn:hover {
    background: #f5f7fa;
}
.header-tabs {
    flex: 1;
    display: flex;
    align-items: center;
    margin: 0 15px;
    max-width: 70%;
}
.header-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.tabs-scroll {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-right: 10px;
    flex: 1;
}
.tabs-scroll::-webkit-scrollbar {
    height: 4px;
}
.tabs-scroll::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}
.tab-item {
    height: 32px;
    line-height: 30px;
    padding: 0 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #f9f9f9;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
.tab-item:hover { background: #f0f0f0; }
.tab-item.active {
    background: #409eff;
    color: #fff;
    border-color: #409eff;
}
.tab-close {
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    font-size: 12px;
    border-radius: 50%;
}
.tab-close:hover { background: rgba(0,0,0,0.1); }
.tabs-actions {
    flex-shrink: 0;
    margin-left: 10px;
}

/* 用户下拉菜单 */
.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}
.user-dropdown .user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
}
.user-dropdown:hover .user-info { background: #f5f7fa; }
.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 150px;
    display: none;
    z-index: 100;
}
.user-dropdown-menu.show { display: block; }
.user-dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: #606266;
    font-size: 14px;
}
.user-dropdown-menu a:hover {
    background: #f5f7fa;
    color: #409eff;
}
.user-dropdown-menu .logout { color: #f56c6c; }
.user-dropdown-menu .logout:hover { color: #f78989; }

/* 内容区域（iframe） */
.content { flex: 1; padding: 0; overflow: hidden; }
.content-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #f5f7fa;
}

/* ========================================
   卡片样式
   ======================================== */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}
.card-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* ========================================
   工作台统计卡片
   ======================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 25px 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
}
.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin-right: 18px;
}
.stat-icon.blue { background: linear-gradient(135deg, #409eff, #1890ff); }
.stat-icon.green { background: linear-gradient(135deg, #67c23a, #85ce61); }
.stat-icon.orange { background: linear-gradient(135deg, #e6a23c, #ebb563); }
.stat-icon.red { background: linear-gradient(135deg, #f56c6c, #f78989); }
.stat-info { flex: 1; }
.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}
.stat-label { font-size: 13px; color: #909399; }

/* ========================================
   列表页样式
   ======================================== */
.table-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.search-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-input { height: 38px; padding: 0 12px; border: 1px solid #dcdfe6; border-radius: 4px; font-size: 14px; width: 200px; }
.btn-sm { padding: 8px 16px; font-size: 14px; border-radius: 4px; border: none; cursor: pointer; }
.btn-default { background: #fff; border: 1px solid #dcdfe6; color: #606266; }
.btn-default:hover { border-color: #c0c4cc; }
.btn-success { background: #67c23a; color: #fff; }
.btn-success:hover { background: #85ce61; }
.btn-danger { background: #f56c6c; color: #fff; }
.btn-danger:hover { background: #f78989; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
.data-table th { background: #f5f7fa; padding: 12px 10px; text-align: left; border: 1px solid #ebeef5; font-weight: bold; color: #606266; }
.data-table td { padding: 12px 10px; border: 1px solid #ebeef5; color: #606266; }
.data-table tr:hover td { background: #fafafa; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 15px; }
.pagination span { color: #909399; font-size: 13px; }
.pagination a, .pagination span.page { display: inline-block; padding: 6px 12px; border: 1px solid #dcdfe6; border-radius: 4px; color: #606266; font-size: 13px; text-decoration: none; cursor: pointer; }
.pagination a:hover, .pagination span.page.active { background: #409eff; border-color: #409eff; color: #fff; }

/* ========================================
   表单页样式
   ======================================== */
.form-row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 15px; }
.form-item { flex: 1; min-width: 280px; }
.form-item label { display: block; font-size: 14px; color: #606266; margin-bottom: 6px; }
.form-item input, .form-item select, .form-item textarea {
    width: 100%; height: 40px; padding: 0 12px; border: 1px solid #dcdfe6; border-radius: 4px; font-size: 14px;
}
.form-item textarea { height: 100px; padding: 10px; resize: vertical; }
.form-footer { margin-top: 30px; padding-top: 15px; border-top: 1px solid #eee; display: flex; gap: 12px; }
.form-footer .btn-primary {
    width: 200px;
}
.form-footer .btn-default {
    width: 200px;
}
.tag { display: inline-block; padding: 3px 8px; font-size: 12px; border-radius: 3px; }
.tag-success { background: #e1f3d8; color: #67c23a; }
.tag-danger { background: #fde2e2; color: #f56c6c; }
.tag-warning { background: #faecd8; color: #e6a23c; }

/* ========================================
   响应式 - 手机端适配
   ======================================== */
@media screen and (max-width: 992px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media screen and (max-width: 768px) {
    /* 侧边栏 */
    .sidebar {
        transform: translateX(-100%);
        z-index: 9999;
        transition: transform 0.3s ease;
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    
    /* 手机端菜单遮罩 */
    .sidebar-overlay.show {
        display: block;
    }
    
    /* 手机端菜单按钮 */
    .menu-toggle-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    /* 统计 */
    .stat-grid { grid-template-columns: 1fr; }
    .stat-card { text-align: center; flex-direction: column; }
    .stat-icon { margin-right: 0; margin-bottom: 15px; }
    
    /* 登录 */
    .login-box { margin: 20px; max-width: 100%; }
}
@media screen and (max-width: 480px) {
    .header { padding: 0 12px; }
    .content { padding: 0; }
    .card { padding: 15px; }
    .form-row { flex-direction: column; gap: 12px; }
}
