/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 布局容器 */
.container {
    display: flex;
    min-height: 100vh;
}

/* 左侧导航栏 */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #4F46E5 0%, #6366F1 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.sidebar-logo img {
    max-width: 80px;
    max-height: 80px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    padding: 5px;
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

.sidebar-header .version {
    font-size: 12px;
    text-align: center;
    opacity: 0.7;
    margin-top: 5px;
}

.user-info {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
}

.user-info .name {
    font-weight: bold;
}

.user-info .role {
    font-size: 12px;
    opacity: 0.8;
}

.user-info .subscription {
    font-size: 12px;
    margin-top: 5px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: inline-block;
}

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

.sidebar-menu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-menu a {
    display: block;
    padding: 12px 20px;
    color: white;
    transition: background 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-menu a i {
    margin-right: 10px;
    width: 20px;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 主内容区域 */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
}

.top-bar {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar h2 {
    font-size: 20px;
    color: #4F46E5;
}

.content-area {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: calc(100vh - 150px);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: bold;
    color: #4F46E5;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

table tr:hover {
    background: #f9fafb;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

select.form-control {
    cursor: pointer;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: #4F46E5;
    color: white;
}

.btn-primary:hover {
    background: #4338CA;
}

.btn-secondary {
    background: #6B7280;
    color: white;
}

.btn-secondary:hover {
    background: #4B5563;
}

.btn-success {
    background: #10B981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #EF4444;
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
}

.btn-outline:hover {
    background: #f9fafb;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* 标签页 */
.tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    color: #6B7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab.active {
    color: #4F46E5;
    border-bottom-color: #4F46E5;
}

.tab:hover {
    color: #4F46E5;
}

/* 提示信息 */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border-left: 4px solid #10B981;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid #EF4444;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border-left: 4px solid #F59E0B;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border-left: 4px solid #3B82F6;
}

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

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

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #9CA3AF;
}

.close:hover {
    color: #374151;
}

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

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

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    color: #4F46E5;
    margin-bottom: 10px;
}

.login-header p {
    color: #6B7280;
    font-size: 14px;
}

/* 顶部导航栏 - 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #4F46E5;
    padding: 5px;
    margin-right: 10px;
}

/* 侧边栏覆盖层（移动端） */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

/* 响应式设计 */

/* 平板端适配 (768px - 1024px) */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar-header h1 {
        font-size: 16px;
    }

    .sidebar-header .version {
        font-size: 11px;
    }

    /* Logo调整 */
    .sidebar-logo img {
        max-width: 70px;
        max-height: 70px;
    }

    .sidebar-menu a {
        padding: 10px 15px;
        font-size: 14px;
    }

    /* 统计卡片两列布局 */
    .stat-card {
        padding: 15px;
    }

    .stat-card .value {
        font-size: 24px;
    }
}

/* 手机端适配 (小于768px) */
@media (max-width: 768px) {
    /* 顶部栏 - 添加菜单按钮 */
    .mobile-menu-btn {
        display: block;
    }

    .top-bar {
        flex-wrap: wrap;
        padding: 10px 15px;
    }

    .top-bar h2 {
        font-size: 16px;
    }

    /* 侧边栏 - 默认隐藏 */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
        position: fixed;
        width: 280px !important;
        height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
    }

    /* 侧边栏收起/展开按钮（移动端） */
    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        border-radius: 10px;
        cursor: pointer;
        position: fixed;
        left: 10px;
        top: 10px;
        z-index: 101;
        box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
        transition: all 0.3s ease;
    }

    .sidebar-toggle-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
    }

    .sidebar-toggle-btn:active {
        transform: scale(0.95);
    }

    .sidebar-toggle-btn .toggle-icon {
        font-size: 18px;
        transition: transform 0.3s ease;
    }

    .sidebar-toggle-btn.collapsed .toggle-icon {
        transform: rotate(180deg);
    }

    /* 移动端主内容区域适配 */
    @media (max-width: 768px) {
        .main-content {
            margin-left: 0 !important;
            padding: 60px 10px 10px;
        }

        .top-bar {
            padding-left: 50px;
        }

        /* 滑动手势支持 */
        .sidebar-overlay {
            -webkit-tap-highlight-color: transparent;
        }
    }

    /* 侧边栏滑动手势 */
    .sidebar-gesture-area {
        position: fixed;
        left: 0;
        top: 0;
        width: 20px;
        height: 100vh;
        z-index: 98;
    }

    /* Logo样式调整 */
    .sidebar-logo img {
        max-width: 60px;
        max-height: 60px;
    }

    .sidebar-header h1 {
        font-size: 14px;
    }

    .sidebar-header .version {
        font-size: 10px;
    }

    /* 主内容区域 - 占满全屏 */
    .main-content {
        margin-left: 0;
        padding: 10px;
    }

    /* 统计卡片 - 单列布局 */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card .value {
        font-size: 28px;
    }

    /* 两列布局变为单列 */
    .content-area > div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    /* 表格容器 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 12px;
    }

    table th,
    table td {
        padding: 8px 4px;
        white-space: nowrap;
    }

    /* 按钮 - 响应式 */
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

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

    /* 顶部栏按钮容器 */
    .top-bar > div {
        width: 100%;
        margin-top: 10px;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .top-bar > div .btn {
        flex: 1;
        font-size: 12px;
    }

    /* 登录页面 */
    .login-card {
        padding: 20px;
        margin: 10px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    /* 模态框 */
    .modal-content {
        width: 95%;
        padding: 15px;
        margin: 10px;
    }

    /* 表单 */
    .form-control {
        font-size: 14px;
        padding: 8px;
    }

    /* 警告框 */
    .alert {
        font-size: 13px;
        padding: 10px;
    }
}

/* 小屏手机适配 (小于480px) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    /* 侧边栏更窄 */
    .sidebar {
        width: 100%;
    }

    /* Logo更小 */
    .sidebar-logo img {
        max-width: 50px;
        max-height: 50px;
    }

    .sidebar-header {
        padding: 10px;
    }

    .sidebar-header h1 {
        font-size: 12px;
    }

    .sidebar-header .version {
        font-size: 9px;
    }

    /* 顶部栏更紧凑 */
    .top-bar {
        padding: 8px 10px;
    }

    .top-bar h2 {
        font-size: 14px;
    }

    .mobile-menu-btn {
        font-size: 20px;
    }

    /* 统计卡片 */
    .stat-card {
        padding: 12px;
    }

    .stat-card .value {
        font-size: 24px;
    }

    .stat-card h3 {
        font-size: 12px;
    }

    /* 表格 */
    table {
        font-size: 11px;
    }

    table th,
    table td {
        padding: 6px 3px;
    }

    /* 按钮 */
    .btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    /* 登录卡片 */
    .login-card {
        padding: 15px;
    }

    .login-header h1 {
        font-size: 20px;
    }

    .form-group label {
        font-size: 12px;
    }

    /* 标签页 */
    .tab {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* 横屏手机适配 */
@media (max-height: 500px) and (orientation: landscape) {
    .login-page {
        padding: 10px;
    }

    .login-card {
        padding: 15px;
        max-width: 500px;
    }

    .sidebar-header {
        padding: 10px;
    }

    .sidebar-menu a {
        padding: 8px 15px;
    }
}

/* 大屏幕适配 (大于1400px) */
@media (min-width: 1400px) {
    .sidebar {
        width: 280px;
    }

    .main-content {
        margin-left: 280px;
        max-width: 1400px;
        margin-right: auto;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 辅助类 */
.text-center {
    text-align: center;
}

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

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

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

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

.gap-10 {
    gap: 10px;
}
