/* 路由器AI管理系统样式 */

:root {
    --primary: #2563eb;
    --secondary: #7c3aed;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f1f5f9;
    --border: #e2e8f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--light);
    color: var(--dark);
}

/* 顶部导航 */
.top-nav {
    background: linear-gradient(135deg, var(--dark) 0%, #334155 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.logo h1 {
    font-size: 24px;
}

.badge {
    background: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.nav-items {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.2);
}

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

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 主容器 */
.container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
}

/* 标签内容 */
.tab-content {
    display: none;
}

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

/* 卡片 */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 20px;
    font-size: 18px;
}

/* 控制台网格 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

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

/* 统计 */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 600;
    color: var(--primary);
}

/* 安全状态 */
.security-status {
    margin-bottom: 20px;
}

.security-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--light);
    border-radius: 8px;
    margin-bottom: 10px;
}

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

.status.active {
    background: #d1fae5;
    color: var(--success);
}

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

/* 按钮 */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
}

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

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

.btn-danger:hover {
    background: #dc2626;
}

.full-width {
    width: 100%;
}

/* 快速操作 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.action-btn {
    background: var(--light);
    border: none;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.action-btn:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.action-btn .icon {
    font-size: 24px;
}

/* 设备列表 */
.device-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.device-list {
    max-height: 500px;
    overflow-y: auto;
}

.device-card {
    background: var(--light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-info h4 {
    margin-bottom: 5px;
}

.device-info p {
    font-size: 12px;
    color: #64748b;
}

.device-actions {
    display: flex;
    gap: 8px;
}

/* 表单 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

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

.form-textarea {
    resize: vertical;
    font-family: inherit;
}

/* 结果框 */
.result-box {
    margin-top: 20px;
    padding: 20px;
    background: var(--light);
    border-radius: 8px;
}

.result-box h4 {
    margin-bottom: 15px;
}

/* 设置列表 */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
}

.setting-info strong {
    display: block;
    margin-bottom: 5px;
}

.setting-info p {
    font-size: 12px;
    color: #64748b;
}

/* 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

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

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

input:checked + .slider {
    background-color: var(--primary);
}

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

/* 活动列表 */
.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

.activity-item:last-child {
    border-bottom: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    background: var(--dark);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
}

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

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 1000;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* 规则列表 */
.rules-list {
    max-height: 500px;
    overflow-y: auto;
}

.rule-card {
    background: var(--light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

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

.rule-header h4 {
    margin: 0;
}

.rule-body p {
    font-size: 14px;
    color: #64748b;
    margin: 5px 0;
}

/* 文本颜色 */
.text-muted {
    color: #94a3b8;
}

/* 响应式 */
@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        gap: 15px;
    }

    .nav-items {
        flex-wrap: wrap;
        justify-content: center;
    }

    .dashboard-grid,
    .stats,
    .quick-actions {
        grid-template-columns: 1fr;
    }
}
