/* 设备管理系统 - 主样式 */

:root {
    --color-primary: #1E40AF;
    --color-primary-light: #3B82F6;
    --color-success: #059669;
    --color-warning: #D97706;
    --color-danger: #DC2626;
    --color-offline: #6B7280;
    --color-gradient: linear-gradient(135deg, #1E40AF 0%, #059669 100%);
    
    --color-bg-light: #f8fafc;
    --color-bg-lighter: #f1f5f9;
    --color-bg-white: #ffffff;
    
    --color-text-dark: #000000;
    --color-text-medium: #1F2937;
    --color-text-light: #4B5563;
    --color-text-lighter: #9CA3AF;
    
    --color-border: #E5E7EB;
    --color-border-light: #F3F4F6;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: var(--color-text-dark);
    background: #f5f7fa;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-light);
}

/* 侧边栏布局 */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: white;
    border-right: 1px solid var(--color-border);
    padding: var(--space-lg) 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 0 var(--space-lg);
    margin-bottom: var(--space-xl);
}

.sidebar-logo-icon {
    font-size: 28px;
}

.sidebar-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--color-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: 0 var(--space-md);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    color: var(--color-text-medium);
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: var(--color-bg-lighter);
    color: var(--color-primary);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    width: 3px;
    height: 24px;
    background: var(--color-gradient);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: var(--space-xl);
}

/* 页面标题 */
.page-header {
    margin-bottom: var(--space-xl);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: var(--space-xs);
}

.page-subtitle {
    color: var(--color-text-light);
    font-size: 0.95rem;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.stat-label {
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.online { background: rgba(5, 150, 105, 0.1); }
.stat-icon.offline { background: rgba(107, 114, 128, 0.1); }
.stat-icon.total { background: rgba(30, 64, 175, 0.1); }
.stat-icon.company { background: rgba(217, 119, 6, 0.1); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-dark);
}

.stat-change {
    font-size: 0.8rem;
    margin-top: var(--space-xs);
}

.stat-change.up { color: var(--color-success); }
.stat-change.down { color: var(--color-danger); }

/* 内容区域 */
.content-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
    margin-bottom: var(--space-lg);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.content-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-dark);
}

/* 标签 */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tag-primary { background: rgba(30, 64, 175, 0.1); color: var(--color-primary); }
.tag-success { background: rgba(5, 150, 105, 0.1); color: var(--color-success); }
.tag-warning { background: rgba(217, 119, 6, 0.1); color: var(--color-warning); }
.tag-danger { background: rgba(220, 38, 38, 0.1); color: var(--color-danger); }
.tag-offline { background: rgba(107, 114, 128, 0.1); color: var(--color-offline); }

/* 设备卡片 */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.device-card, a.device-card {
    display: block;
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
    transition: all 0.2s;
    color: inherit;
    text-decoration: none;
}

a.device-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md);
}

.device-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-dark);
}

.device-status {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.8rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online { background: var(--color-success); }
.status-dot.offline { background: var(--color-offline); }

.device-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.device-info-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.device-info-label {
    color: var(--color-text-light);
}

.device-info-value {
    color: var(--color-text-medium);
    font-weight: 500;
}

.device-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.data-table th {
    background: var(--color-bg-lighter);
    font-weight: 600;
    color: var(--color-text-medium);
    font-size: 0.875rem;
}

.data-table tr:hover td {
    background: var(--color-bg-lighter);
}

.data-table td {
    color: var(--color-text-medium);
    font-size: 0.9rem;
}

/* 搜索框 */
.search-bar {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.search-input {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

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

.filter-select {
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--color-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-secondary {
    background: white;
    color: var(--color-text-medium);
    border: 1px solid var(--color-border);
}

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

/* 数据分析图表区域 */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.chart-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: var(--space-lg);
}

.chart-placeholder {
    height: 200px;
    background: var(--color-bg-lighter);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-lighter);
}

/* 分隔线 */
.divider {
    height: 1px;
    background: var(--color-border-light);
    margin: var(--space-lg) 0;
}

/* 响应式 */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .device-grid {
        grid-template-columns: 1fr;
    }
    
    .search-bar {
        flex-direction: column;
    }
}