/* =====================================================
   AAA 认证计费系统 - 管理后台样式
   商用级美化 - 自适应设计
   ===================================================== */

/* ===== 基础变量 ===== */
:root {
    --primary-color: #1890ff;
    --primary-hover: #40a9ff;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #ff4d4f;
    --bg-color: #f0f2f5;
    --bg-white: #ffffff;
    --text-primary: #262626;
    --text-secondary: #8c8c8c;
    --border-color: #e8e8e8;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
}

/* ===== 标签页样式 ===== */
.tabs.basic-tabs {
    display: inline-flex;
    border-bottom: 1px solid var(--border-color);
    margin-right: 15px;
}

.basic-tabs .tab-btn {
    background: none;
    border: none;
    padding: 8px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    margin-bottom: -1px;
}

.basic-tabs .tab-btn:hover {
    color: var(--primary-color);
    background: rgba(24, 144, 255, 0.05);
}

.basic-tabs .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 500;
}

/* ===== 通用样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

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

.login-box {
    background: var(--bg-white);
    padding: 40px 50px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 400px;
    max-width: 90%;
}

.login-box h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 28px;
}

.login-box .logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-box .logo img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-success {
    background: var(--success-color);
    color: #fff;
}

/* ===== 后台布局 ===== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 220px;
    background: #001529;
    color: #fff;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: width 0.3s;
}

.sidebar .logo {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #002140;
    border-bottom: 1px solid #003a70;
}

.sidebar .logo h1 {
    color: #fff;
    font-size: 18px;
    margin: 0;
}

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

.sidebar-menu li {
    border-bottom: 1px solid #003a70;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: #1890ff;
    color: #fff;
}

.sidebar-menu li a i {
    margin-right: 10px;
    font-size: 18px;
}

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

/* 顶部导航 */
.header {
    height: 64px;
    background: var(--bg-white);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-left .toggle-sidebar {
    font-size: 20px;
    cursor: pointer;
    margin-right: 20px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* 内容区域 */
.content {
    padding: 24px;
}

/* 页面标题 */
.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-header .breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}

.page-header .breadcrumb span {
    color: var(--text-secondary);
}

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

.stat-card {
    background: var(--bg-white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-right: 16px;
}

.stat-card .stat-icon.blue {
    background: rgba(24,144,255,0.1);
    color: var(--primary-color);
}

.stat-card .stat-icon.green {
    background: rgba(82,196,26,0.1);
    color: var(--success-color);
}

.stat-card .stat-icon.orange {
    background: rgba(250,173,20,0.1);
    color: var(--warning-color);
}

.stat-card .stat-icon.red {
    background: rgba(255,77,79,0.1);
    color: var(--danger-color);
}

.stat-card .stat-info h3 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-card .stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 数据表格 */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: #fafafa;
    font-weight: 600;
    color: var(--text-primary);
}

.table tr:hover {
    background: #f5f5f5;
}

.table .actions {
    display: flex;
    gap: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(82,196,26,0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(250,173,20,0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(255,77,79,0.1);
    color: var(--danger-color);
}

.badge-info {
    background: rgba(24,144,255,0.1);
    color: var(--primary-color);
}

/* 表单 */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius);
    width: 500px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 图表周期选择器 */
.period-selector {
    display: flex;
    gap: 4px;
}

.period-selector .btn {
    padding: 4px 12px;
    font-size: 12px;
    background: #f0f0f0;
    color: #666;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.period-selector .btn:hover {
    background: #e6e6e6;
}

.period-selector .btn.active {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

/* ===== 底部联系信息 ===== */
.footer-contact {
    position: fixed;
    bottom: 0;
    left: 220px;
    right: 0;
    background: #fafafa;
    border-top: 1px solid #e8e8e8;
    padding: 12px 24px;
    text-align: center;
    font-size: 14px;
    color: #666;
    z-index: 100;
}

.footer-contact i {
    color: var(--primary-color);
    margin-right: 8px;
}

/* ===== 子菜单样式 ===== */
.submenu {
    transition: all 0.3s ease;
}

.submenu > a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.submenu-arrow {
    transition: transform 0.3s ease;
    font-size: 12px;
    margin-left: auto;
}

.submenu-content {
    display: none;
    background: rgba(0, 0, 0, 0.15);
    padding: 0;
    margin: 0;
    list-style: none;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.submenu-content li {
    margin: 0;
}

.submenu-content li a {
    padding: 10px 20px 10px 45px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: inherit;
    text-decoration: none;
    transition: background 0.2s;
}

.submenu-content li a:hover {
    background: rgba(24, 144, 255, 0.1);
}

.submenu-content li a i {
    font-size: 12px;
    opacity: 0.8;
}

.submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.submenu.open .submenu-content {
    display: block;
}

/* 侧边栏菜单激活状态 */
.sidebar-menu li.active > a {
    background: var(--primary-color);
    color: white;
}

.sidebar-menu li.active .submenu-content li a {
    color: rgba(255, 255, 255, 0.9);
}

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

/* ===== 选项卡样式 ===== */
.tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-nav button {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-nav button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tab-nav button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.tab-pane {
    display: none;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

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