/* 基础样式重置 */
* {
    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;
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 顶部头部栏 */
.top-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

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

.platform-title {
    font-size: 18px;
    font-weight: 600;
    color: #1890ff;
    margin: 0;
}

.header-icons {
    display: flex;
    gap: 10px;
}

.header-icons i {
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.header-icons i:hover {
    background-color: #f0f0f0;
}

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

.system-balance {
    font-size: 14px;
    color: #666;
}

.user-icon {
    font-size: 24px;
    color: #1890ff;
}

.user-name {
    font-size: 14px;
    color: #333;
}

.logout-btn {
    color: #666;
    text-decoration: none;
    margin-left: 10px;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

/* 主容器 */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧导航栏 */
.sidebar {
    width: 240px;
    background: #3b434a;
    color: white;
    overflow-y: auto;
    flex-shrink: 0;
}

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

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

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

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
}

.nav-item.active .nav-link {
    background-color: rgba(255,255,255,0.15);
    border-left-color: #60a5fa;
}

.nav-link i {
    margin-right: 10px;
    width: 16px;
    text-align: center;
}

.nav-link .fa-chevron-down {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s;
}

.nav-item.has-submenu.open .fa-chevron-down {
    transform: rotate(180deg);
}

.submenu {
    list-style: none;
    background-color: rgba(0,0,0,0.2);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-item.has-submenu.open .submenu {
    max-height: 500px;
}

.submenu li a {
    display: block;
    padding: 10px 20px 10px 50px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s;
}

.submenu li a:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    background: #fff;
    overflow-y: auto;
    padding: 20px;
}

/* 面包屑导航 */
.breadcrumb {
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.breadcrumb span {
    color: #1890ff;
}

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

.tab {
    padding: 10px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    margin-right: 2px;
    cursor: pointer;
    position: relative;
    font-size: 14px;
}

.tab.active {
    background: #fff;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
}

.tab i {
    margin-left: 10px;
    color: #999;
    cursor: pointer;
}

.tab i:hover {
    color: #666;
}

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

.stat-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s;
}

.stat-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* 图表区域 */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.chart-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

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

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

.chart-selector {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    color: #666;
}

.chart-content {
    position: relative;
}

.chart-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.collection {
    background-color: #ff9500;
}

.legend-color.payout {
    background-color: #ff3b30;
}

.chart-placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    border: 1px dashed #d9d9d9;
    border-radius: 4px;
}

.chart-unit {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 12px;
    color: #999;
}

.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #999;
}

.no-data i {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.no-data span {
    font-size: 14px;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    margin-right: 8px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #1890ff;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* 日期范围选择器 */
.date-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-range span {
    color: #666;
    font-size: 14px;
}

/* 统计行样式 */
.stats-row {
    display: flex;
    gap: 20px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-label {
    font-size: 14px;
    color: #666;
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* 控制行样式 */
.controls-row {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-top: 15px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-label {
    font-size: 14px;
    color: #666;
}

/* 通道ID和名称样式 */
.channel-id {
    color: #1890ff;
    font-weight: 600;
}

.channel-name {
    color: #333;
}

.interface-id {
    color: #52c41a;
    font-weight: 600;
}

.interface-name {
    color: #666;
}

.status-text {
    font-size: 12px;
    color: #52c41a;
}

/* 加载覆盖层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.loading-spinner i {
    font-size: 20px;
    color: #1890ff;
}

/* 消息提示 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-success {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.message-error {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

.message-warning {
    background: #fffbe6;
    color: #faad14;
    border: 1px solid #ffe58f;
}

.message-info {
    background: #e6f7ff;
    color: #1890ff;
    border: 1px solid #91d5ff;
}

.message-close {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: auto;
    opacity: 0.6;
}

.message-close:hover {
    opacity: 1;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #999;
}

.modal-close:hover {
    color: #666;
}

.modal-body {
    padding: 0 20px;
}

.modal-footer {
    padding: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #f0f0f0;
}

.text-warning {
    color: #faad14;
    font-size: 12px;
}

/* 表格选中行样式 */
.data-table tbody tr.selected {
    background-color: #e6f7ff !important;
}

.data-table tbody tr.selected:hover {
    background-color: #bae7ff !important;
}

/* 表格排序样式 */
.data-table th.sort-asc::after {
    content: ' ↑';
    color: #1890ff;
}

.data-table th.sort-desc::after {
    content: ' ↓';
    color: #1890ff;
}

/* 表单错误样式 */
.form-input.error,
.form-select.error {
    border-color: #ff4d4f;
    box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2);
}

.error-message {
    color: #ff4d4f;
    font-size: 12px;
    margin-top: 4px;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
}

.notification-success {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.notification-error {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

.notification-warning {
    background: #fffbe6;
    color: #faad14;
    border: 1px solid #ffe58f;
}

.notification-info {
    background: #e6f7ff;
    color: #1890ff;
    border: 1px solid #91d5ff;
}

.notification-payment {
    background: #f0f5ff;
    color: #722ed1;
    border: 1px solid #d3adf7;
}

.notification-order {
    background: #fff7e6;
    color: #fa8c16;
    border: 1px solid #ffd591;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: auto;
    opacity: 0.6;
}

.notification-close:hover {
    opacity: 1;
}

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

/* 统计变化指示器 */
.stat-change {
    font-size: 12px;
    margin-top: 5px;
    font-weight: 500;
}

.stat-change.positive {
    color: #52c41a;
}

.stat-change.negative {
    color: #ff4d4f;
}

.stat-change.neutral {
    color: #666;
}

/* 排名徽章 */
.rank-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.rank-1 {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
}

.rank-2 {
    background: linear-gradient(45deg, #c0c0c0, #e8e8e8);
    color: #333;
}

.rank-3 {
    background: linear-gradient(45deg, #cd7f32, #daa520);
}

.rank-4, .rank-5 {
    background: #1890ff;
}

/* 表格头部 */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}

.table-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.table-actions {
    display: flex;
    gap: 10px;
}

/* 文本颜色 */
.text-success {
    color: #52c41a;
}

.text-danger {
    color: #ff4d4f;
}

.text-primary {
    color: #1890ff;
}

.text-warning {
    color: #faad14;
}

/* 状态指示器 */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
}

.status-indicator i {
    font-size: 8px;
}

.status-indicator.status-running {
    color: #52c41a;
}

.status-indicator.status-stopped {
    color: #666;
}

.status-indicator.status-error {
    color: #ff4d4f;
}

/* 配置页面样式 */
.config-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.config-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.config-actions {
    display: flex;
    gap: 10px;
}

.config-form {
    padding: 20px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.form-section .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

/* 收银台样式 */
.cashier-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.cashier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.cashier-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.cashier-actions {
    display: flex;
    gap: 10px;
}

.order-form {
    padding: 20px;
}

.qr-code {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.text-muted {
    color: #999;
    font-size: 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .stats-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .controls-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .modal-content {
        min-width: 90%;
        margin: 20px;
    }
    
    .message,
    .notification {
        min-width: 90%;
        right: 5%;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar .nav-link span {
        display: none;
    }
    
    .sidebar .submenu {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .platform-title {
        font-size: 14px;
    }
    
    .header-right {
        gap: 10px;
    }
    
    .system-balance {
        font-size: 12px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .batch-actions {
        flex-direction: column;
    }
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-dialog {
    background-color: #2c2c2c;
    border-radius: 8px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-header {
    display: flex;
    align-items: center;
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid #404040;
}

.modal-icon {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    color: #ff6b6b;
}

.modal-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    flex: 1;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #ff6b6b;
}

.modal-body {
    padding: 20px;
    color: #ffffff;
    line-height: 1.6;
}

.modal-body p,
.modal-body div {
    margin: 0 0 10px 0;
    font-size: 14px;
    line-height: 1.6;
}

.modal-btn-container {
    margin-top: 20px;
    text-align: right;
}

.modal-footer {
    padding: 10px 20px 20px 20px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
}

.modal-btn {
    background-color: #007bff;
    color: #ffffff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.modal-btn:hover {
    background-color: #0056b3;
}
