/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #4A148C 0%, #6A1B9A 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 顶部控制栏 */
.control-bar {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: white;
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    color: #FF6B6B;
    font-size: 28px;
}

.right-controls {
    display: flex;
    gap: 12px;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    min-width: 100px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    min-width: 80px;
}

.btn-export {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-print {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

/* 统计面板 */
.stats-section {
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
}

.stat-total::before { background: linear-gradient(180deg, #667eea 0%, #764ba2 100%); }
.stat-unresolved::before { background: linear-gradient(180deg, #f5365c 0%, #f56036 100%); }
.stat-warning::before { background: linear-gradient(180deg, #ffd600 0%, #ff9500 100%); }
.stat-info::before { background: linear-gradient(180deg, #11cdef 0%, #1171ef 100%); }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
}

.stat-total .stat-icon { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-unresolved .stat-icon { background: linear-gradient(135deg, #f5365c 0%, #f56036 100%); }
.stat-warning .stat-icon { background: linear-gradient(135deg, #ffd600 0%, #ff9500 100%); }
.stat-info .stat-icon { background: linear-gradient(135deg, #11cdef 0%, #1171ef 100%); }

.stat-info h3 {
    color: #6c757d;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: #32325d;
    line-height: 1;
}

.stat-trend {
    margin-left: auto;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.stat-trend.up { background: rgba(40, 167, 69, 0.1); color: #28a745; }
.stat-trend.down { background: rgba(220, 53, 69, 0.1); color: #dc3545; }
.stat-trend.stable { background: rgba(108, 117, 125, 0.1); color: #6c757d; }

/* 选项卡 */
.tabs-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tabs-nav {
    display: flex;
    padding: 5px;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #6A1B9A;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 工具条 */
.toolbar {
    background: white;
    border-radius: 12px;
    padding: 20px 25px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.toolbar h2 {
    font-size: 18px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar h2 i {
    color: #6A1B9A;
}

.toolbar-right {
    display: flex;
    gap: 10px;
}

/* 筛选栏 */
.filter-section {
    background: white;
    border-radius: 12px;
    padding: 20px 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.filter-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #6A1B9A;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    background: white;
    color: #333;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #6A1B9A;
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.1);
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-left: auto;
}

/* 表格 */
.table-section {
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.alert-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

.alert-table thead {
    background: linear-gradient(135deg, #6A1B9A 0%, #4A148C 100%);
}

.alert-table th {
    padding: 16px 20px;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.alert-table th:last-child {
    border-right: none;
}

.alert-table tbody tr {
    border-bottom: 1px solid #f1f3f9;
    transition: all 0.3s ease;
}

.alert-table tbody tr:hover {
    background-color: #f8f9fe;
}

.alert-table td {
    padding: 15px 20px;
    color: #525f7f;
    font-size: 14px;
}

/* 报警级别 */
.alert-level {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    display: inline-block;
    min-width: 60px;
}

.level-critical { background: rgba(245, 54, 92, 0.1); color: #f5365c; border: 1px solid rgba(245, 54, 92, 0.3); }
.level-warning { background: rgba(255, 214, 0, 0.1); color: #ff9500; border: 1px solid rgba(255, 214, 0, 0.3); }
.level-info { background: rgba(17, 205, 239, 0.1); color: #1171ef; border: 1px solid rgba(17, 205, 239, 0.3); }

/* 设备信息 */
.device-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.device-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6A1B9A 0%, #4A148C 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.device-name {
    font-weight: 600;
    color: #333;
}

.device-location {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

/* 状态 */
.alert-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
    display: inline-block;
}

.status-unresolved { background: rgba(245, 54, 92, 0.1); color: #f5365c; border: 1px solid rgba(245, 54, 92, 0.3); }
.status-resolved { background: rgba(40, 167, 69, 0.1); color: #28a745; border: 1px solid rgba(40, 167, 69, 0.3); }

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-resolve { background: linear-gradient(135deg, #28a745 0%, #20c997 100%); color: white; }
.btn-detail { background: linear-gradient(135deg, #1171ef 0%, #11cdef 100%); color: white; }
.btn-ignore { background: linear-gradient(135deg, #6c757d 0%, #495057 100%); color: white; }

/* 分页 */
.pagination-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pagination span {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.btn-prev, .btn-next {
    padding: 8px 16px;
    background: linear-gradient(135deg, #6A1B9A 0%, #4A148C 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.btn-prev:hover:not(:disabled),
.btn-next:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.3);
}

.btn-prev:disabled,
.btn-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 实时报警流 */
.realtime-stream-section {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stream-header {
    background: linear-gradient(135deg, #6A1B9A 0%, #4A148C 100%);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stream-header h3 {
    color: white;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-clear {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.btn-clear:hover {
    background: rgba(255, 255, 255, 0.3);
}

.stream-content {
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.stream-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid;
}

.stream-item:last-child {
    margin-bottom: 0;
}

.stream-item.critical { background: rgba(245, 54, 92, 0.1); border-left-color: #f5365c; }
.stream-item.warning { background: rgba(255, 214, 0, 0.1); border-left-color: #ff9500; }
.stream-item.info { background: rgba(17, 205, 239, 0.1); border-left-color: #1171ef; }

.stream-time {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    min-width: 60px;
}

.stream-device {
    font-weight: 600;
    color: #333;
    min-width: 80px;
}

.stream-message {
    color: #666;
    flex: 1;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    background: linear-gradient(135deg, #6A1B9A 0%, #4A148C 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.sidebar-header h4 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-close-sidebar {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-close-sidebar:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.manual-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.manual-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.manual-section h5 {
    color: #6A1B9A;
    font-size: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.manual-section ul {
    padding-left: 20px;
    color: #666;
    line-height: 1.6;
}

.manual-section p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

/* 侧边栏开关 */
.btn-toggle-sidebar {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #6A1B9A 0%, #4A148C 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.4);
    transition: all 0.3s;
    z-index: 999;
}

.btn-toggle-sidebar:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(106, 27, 154, 0.6);
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.loading i {
    animation: spin 1s linear infinite;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-icon {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 10px;
}

/* 动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* 响应式设计 */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-row {
        flex-wrap: wrap;
    }
    
    .filter-group {
        min-width: calc(50% - 10px);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .control-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        padding: 20px;
    }
    
    .right-controls {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .tab-btn {
        min-width: 150px;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .toolbar-right {
        justify-content: center;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .filter-actions {
        width: 100%;
        justify-content: center;
    }
    
    .sidebar {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-prev, .btn-next {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .stream-item {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .stream-time,
    .stream-device {
        min-width: auto;
    }
}