/* 管理后台样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    font-size: 12px;
}

html, body {
    overflow-x: hidden;
}

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

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

.login-box {
    background: white;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.login-header {
    background: #667eea;
    color: white;
    padding: 30px;
    text-align: center;
}

.login-header h2 {
    margin-bottom: 10px;
    font-size: 20px;
}

.login-form {
    padding: 30px;
}

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

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

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 5px;
    font-size: 12px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-block {
    width: 100%;
}

.login-footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    font-size: 10px;
    color: #666;
}

/* 后台主页面样式 */
.admin-page {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: #667eea;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.mobile-menu-btn:hover {
    background: #5a6fd8;
}

/* 移动端遮罩层 */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-header {
    padding: 20px;
    background: #34495e;
    border-bottom: 1px solid #465c71;
}

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

.menu-item {
    display: block;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.menu-item:hover,
.menu-item.active {
    background: #34495e;
    color: white;
    border-left-color: #667eea;
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
    transition: margin-left 0.3s ease;
}

.content-header {
    background: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card {
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
}

.card-body {
    padding: 20px;
}

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

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.alert {
    padding: 10px 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    font-size: 12px;
}

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

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

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

/* 选项卡样式 */
.tab-nav {
    display: flex;
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow-x: auto;
    flex-wrap: wrap;
}

.tab-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
}

.tab-item:first-child {
    border-top-left-radius: 5px;
}

.tab-item:last-child {
    border-right: none;
    border-top-right-radius: 5px;
}

.tab-item:hover {
    background: #e9ecef;
    color: #333;
}

.tab-item.active {
    background: white;
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 500;
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* 响应式选项卡 */
@media (max-width: 768px) {
    .tab-nav {
        flex-direction: column;
        border-radius: 5px;
    }
    
    .tab-item {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        border-radius: 0;
    }
    
    .tab-item:first-child {
        border-top-left-radius: 5px;
        border-top-right-radius: 5px;
    }
    
    .tab-item:last-child {
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
    }
    
    .tab-item.active {
        border-bottom-color: #667eea;
    }
}

/* 移动端响应式布局 */
@media (max-width: 768px) {
    /* 隐藏侧边栏 */
    .sidebar {
        transform: translateX(-100%);
    }
    
    /* 显示移动端菜单按钮 */
    .mobile-menu-btn {
        display: block;
    }
    
    /* 主内容区域占满全屏 */
    .main-content {
        margin-left: 0;
        padding: 60px 15px 20px 15px;
    }
    
    /* 内容头部调整 */
    .content-header {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* 卡片调整 */
    .card {
        margin-bottom: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* 表单元素调整 */
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 10px 12px;
    }
    
    /* 按钮组调整 */
    .button-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .button-group .btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    /* 选项卡导航调整 */
    .tab-nav {
        margin-bottom: 15px;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .tab-item {
        white-space: nowrap;
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* 平板端响应式布局 */
@media (max-width: 992px) and (min-width: 769px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
        padding: 20px 15px;
    }
    
    .content-header {
        padding: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
}

/* 大屏幕优化 */
@media (min-width: 1200px) {
    .main-content {
        padding: 20px 30px;
    }
    
    .content-header {
        padding: 25px;
    }
    
    .card-body {
        padding: 25px;
    }
}

/* 移动端侧边栏激活状态 */
.sidebar.active {
    transform: translateX(0);
}

.mobile-overlay.active {
    display: block;
}

/* 移动端额外优化 */
@media (max-width: 768px) {
    /* 防止页面横向滚动 */
    body {
        overflow-x: hidden;
    }
    
    /* 优化按钮触摸区域 */
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    /* 优化输入框触摸区域 */
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 44px;
    }
    
    /* 优化选项卡触摸区域 */
    .tab-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* 优化菜单项触摸区域 */
    .menu-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* 移动端菜单按钮优化 */
    .mobile-menu-btn {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 表格响应式处理 */
    table {
        font-size: 12px;
    }
    
    /* 长文本处理 */
    .card-body {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* 平板端优化 */
@media (max-width: 992px) and (min-width: 769px) {
    .btn {
        min-height: 40px;
        padding: 10px 16px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 40px;
    }
}

/* 选项卡横向并列显示优化 */
@media (max-width: 768px) {
    .tab-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
        scrollbar-width: thin;
        scrollbar-color: #bfc4cc #fff;
        /* margin-left: -10px;
        margin-right: -10px; */
        padding-left: 10px;
        padding-right: 10px;
        /* 让滚动条始终可见 */
        background: #fff;
        border-bottom: 1.5px solid #e9ecef;
        position: relative;
    }
    .tab-nav::-webkit-scrollbar {
        height: 8px;
        background: #fff;
    }
    .tab-nav::-webkit-scrollbar-thumb {
        background: #bfc4cc;
        border-radius: 4px;
    }
    .tab-nav::-webkit-scrollbar-track {
        background: #fff;
    }
    .tab-item {
        min-width: 90px;
        flex: 0 0 auto;
        text-align: center;
        border-radius: 0;
        margin-right: 2px;
        font-size: 12px;
        padding: 10px 8px;
        background: #f8f9fa;
        border-bottom: 2px solid transparent;
        transition: background 0.2s, color 0.2s;
    }
    .tab-item.active {
        background: #fff;
        color: #667eea;
        border-bottom: 2px solid #667eea;
        font-weight: 500;
    }
    .tab-nav::-webkit-scrollbar {
        height: 4px;
    }
    .tab-nav::-webkit-scrollbar-thumb {
        background: #e9ecef;
        border-radius: 2px;
    }
}

/* 输入框字体全局统一 */
.form-group input,
.form-group select,
.form-group textarea {
    font-size: 12px !important;
}

/* 优化移动端顶部悬浮按钮 */
.mobile-menu-btn {
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
   /*  border-radius: 50%;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px; */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: linear-gradient(135deg, #667eea 60%, #5a6fd8 100%);
    top: 16px;
    left: 16px;
    transition: box-shadow 0.2s, background 0.2s;
}
.mobile-menu-btn:active {
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    background: linear-gradient(135deg, #5a6fd8 60%, #667eea 100%);
}
@media (max-width: 768px) {
    .mobile-menu-btn {
        top: 12px;
        left: 12px;
    }
}

/* 顶部栏和底部栏固定（移动端） */
@media (max-width: 768px) {
    .content-header {
        position: sticky;
        top: 0;
        z-index: 20;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }
    .footer-bar {
        position: sticky;
        bottom: 0;
        z-index: 20;
        background: #fff;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
    }
    .tab-nav {
        position: relative;
        z-index: 15;
        background: #fff;
        border-bottom: 1px solid #e9ecef;
        box-shadow: 0 1px 4px rgba(0,0,0,0.03);
        margin-bottom: 0;
    }
    .tab-content {
        margin-top: 0;
    }
}

@media (max-width: 768px) {
    .sidebar-header {
        padding-top: 56px !important; /* 48px按钮+8px间距，避免被遮住 */
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none !important;
    }
}