/* 管理后台样式 */
:root {
    --primary: #0089ff;
    --success: #52c41a;
    --warning: #faad14;
    --error: #ff4d4f;
    --text-primary: #1f2329;
    --text-secondary: #646a73;
    --text-tertiary: #8f959e;
    --bg-primary: #ffffff;
    --bg-secondary: #f7f8fa;
    --bg-tertiary: #eef0f3;
    --border: #dee0e3;
    --sidebar-width: 240px;
    --topbar-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
    color: var(--text-primary);
    line-height: 1.6;
}

.hidden {
    display: none;
}

/* ========== 登录页面 ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.logo-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-large .logo-icon {
    font-size: 48px;
}

.logo-large h1 {
    font-size: 28px;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.label-icon {
    font-size: 16px;
}

.form-input {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.login-btn {
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer p {
    font-size: 13px;
    color: var(--text-tertiary);
}

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

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: #1e1e2d;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 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;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: rgba(0, 137, 255, 0.15);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.nav-icon {
    font-size: 20px;
}

.nav-text {
    font-size: 15px;
}

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

.logout-btn {
    width: 100%;
    padding: 10px;
    background: rgba(255, 77, 79, 0.1);
    color: var(--error);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255, 77, 79, 0.2);
}

/* 强制显示页面内容 - 解决蓝色背景问题 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: white !important;
    min-height: 100vh;
}

.content-wrapper {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    background: white !important;
    min-height: calc(100vh - 64px);
    position: relative;
}

/* 强制页面内容隐藏/显示规则 */
.page-content {
    animation: fadeIn 0.3s ease-out;
    background: white !important;
    padding: 24px;
    min-height: calc(100vh - 64px);
    overflow-y: visible;
    display: none !important;
    visibility: hidden !important;
}

.page-content:not(.hidden) {
    display: block !important;
    visibility: visible !important;
}

.page-content.hidden {
    display: none !important;
    visibility: hidden !important;
}

.hidden {
    display: none !important;
    visibility: hidden !important;
}

/* 顶部栏 */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left h2 {
    font-size: 20px;
    font-weight: 600;
}

.topbar-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(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

/* ========== 数据概览 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-trend {
    font-size: 12px;
    color: var(--text-tertiary);
}

.stat-trend.positive {
    color: var(--success);
}

.stat-trend.negative {
    color: var(--error);
}

/* 图表 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.chart-select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.chart-body {
    height: 300px;
}

/* 表格 */
.recent-orders-card,
.table-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.card-header a {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
}

.table-wrapper {
    overflow-x: auto;
}

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

.data-table thead {
    background: var(--bg-secondary);
}

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

.data-table th {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.data-table td {
    font-size: 14px;
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.empty-row {
    text-align: center;
    padding: 60px 20px !important;
    color: var(--text-tertiary);
}

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

.status-pending {
    background: #fff7e6;
    color: var(--warning);
}

.status-paid {
    background: #f6ffed;
    color: var(--success);
}

.status-expired {
    background: #fff1f0;
    color: var(--error);
}

.action-btn {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.action-btn:hover {
    background: var(--bg-tertiary);
}

/* ========== 订单管理 ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.search-bar {
    display: flex;
    gap: 12px;
}

.search-input {
    width: 300px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.search-btn {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.search-btn:hover {
    background: #0070d9;
}

.filter-group {
    display: flex;
    gap: 8px;
}

.filter-tag {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-tag.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

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

.page-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

/* ========== 系统设置 ========== */
.settings-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.settings-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.settings-input {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.settings-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-primary {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #0070d9;
}

.btn-secondary {
    padding: 12px 24px;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

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

/* Toast提示 */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    animation: slideInRight 0.3s ease-out;
}

.toast-message {
    font-size: 14px;
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 响应式 */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .topbar {
        padding: 0 16px;
    }
    
    .content-wrapper {
        padding: 0;
        height: calc(100vh - 64px);
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        width: 100%;
    }
}

/* ========== 智能化运维样式 ========== */

/* 监控概览卡片 */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.metric-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.metric-content {
    flex: 1;
}

.metric-content h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.metric-status {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 监控区域 */
.monitoring-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    min-height: 200px;
}

/* 确保指标卡片可见 */
.metric-card {
    background: white !important;
    color: #333 !important;
    border: 2px solid #e0e0e0 !important;
}

.monitoring-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--bg-secondary);
}

.chart-container {
    position: relative;
    height: 400px;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
}

/* 告警列表 */
.alert-list {
    max-height: 300px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-left: 4px solid var(--warning);
}

.alert-icon {
    font-size: 16px;
}

.alert-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

/* 控制面板 */
.control-panel {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* 运维概览 */
.ops-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.ops-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.3s ease;
}

.ops-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.ops-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.ops-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.ops-status {
    font-size: 14px;
    color: var(--success);
    font-weight: 500;
    margin-bottom: 4px;
}

.ops-count {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 运维区域 */
.ops-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.ops-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--bg-secondary);
}

/* 任务列表 */
.task-list {
    space-y: 12px;
}

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 12px;
}

.task-info {
    flex: 1;
}

.task-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.task-description {
    font-size: 14px;
    color: var(--text-secondary);
}

.task-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: #e6f7ff;
    color: #1890ff;
}

.status-badge.inactive {
    background: #fff2e8;
    color: #fa8c16;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-small:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

/* 运维控制 */
.ops-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* 运维日志 */
.ops-log {
    max-height: 300px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.log-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-tertiary);
    min-width: 140px;
}

.log-level {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    min-width: 50px;
    text-align: center;
}

.log-level.info {
    background: #e6f7ff;
    color: #1890ff;
}

.log-level.warning {
    background: #fff2e8;
    color: #fa8c16;
}

.log-level.error {
    background: #fff1f0;
    color: #ff4d4f;
}

.log-level.success {
    background: #f6ffed;
    color: #52c41a;
}

.log-message {
    flex: 1;
    color: var(--text-primary);
}

.log-controls {
    display: flex;
    gap: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .ops-overview {
        grid-template-columns: 1fr;
    }
    
    .control-panel,
    .ops-controls {
        flex-direction: column;
    }
    
    .task-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .task-status {
        justify-content: space-between;
    }
}

