/*
 * 功能：AnyRouter Monitor 前端样式 — 高级仪表盘设计
 * 流程：深色玻璃态背景 → 统计卡片 → 渠道列表 → 内联交互
 * 参数：无
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-primary: #050a18;
    --bg-card: rgba(15, 23, 42, 0.65);
    --bg-card-hover: rgba(20, 30, 55, 0.8);
    --bg-input: rgba(15, 23, 42, 0.8);
    --bg-glass: rgba(255,255,255, 0.03);
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(99,102,241,0.25);
    --border-accent: rgba(56,189,248,0.2);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --cyan: #22d3ee;
    --green: #34d399;
    --green-dim: rgba(52,211,153,0.15);
    --green-glow: rgba(52,211,153,0.35);
    --red: #f87171;
    --red-dim: rgba(248,113,113,0.12);
    --red-glow: rgba(248,113,113,0.3);
    --yellow: #fbbf24;
    --yellow-dim: rgba(251,191,36,0.12);
    --gradient-accent: linear-gradient(135deg, #6366f1, #06b6d4);
    --gradient-green: linear-gradient(135deg, #34d399, #06b6d4);
    --gradient-red: linear-gradient(135deg, #f87171, #fb923c);
    --shadow-card: 0 4px 30px rgba(0,0,0,0.25);
    --shadow-glow: 0 0 40px rgba(99,102,241,0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -30%;
    width: 80vw;
    height: 80vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -40%;
    right: -20%;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6,182,212,0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ==================== 顶部导航 ==================== */
.ar-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(5,10,24,0.75);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 0 2.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ar-logo-icon {
    width: 38px;
    height: 38px;
    background: var(--gradient-accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 4px 20px rgba(99,102,241,0.3);
    position: relative;
}

.ar-logo-icon::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 14px;
    background: var(--gradient-accent);
    opacity: 0.3;
    filter: blur(8px);
    z-index: -1;
}

.ar-logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.3px;
}

.ar-header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ar-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}

.ar-status-dot.online {
    background: var(--green);
    box-shadow: 0 0 8px var(--green-glow);
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--green-glow); }
    50% { opacity: 0.6; box-shadow: 0 0 16px var(--green-glow); }
}

/* ==================== 主容器 ==================== */
.ar-main {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem 5rem;
}

/* ==================== 统计概览 ==================== */
.ar-stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.ar-stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ar-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0;
    transition: opacity 0.3s;
}

.ar-stat-card:hover::before { opacity: 1; }
.ar-stat-card.total::before { background: var(--gradient-accent); }
.ar-stat-card.online-stat::before { background: var(--gradient-green); }
.ar-stat-card.offline-stat::before { background: var(--gradient-red); }

.ar-stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.ar-stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.4rem;
}

.ar-stat-card.total .ar-stat-value { color: var(--accent-light); }
.ar-stat-card.online-stat .ar-stat-value { color: var(--green); }
.ar-stat-card.offline-stat .ar-stat-value { color: var(--red); }

.ar-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ==================== 渠道区标题 ==================== */
.ar-section-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.ar-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-accent), transparent 80%);
}

/* ==================== 渠道卡片 ==================== */
.ar-channels-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ar-channel-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.4rem;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.ar-channel-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    transform: translateY(-2px);
}

/* 顶部渐变条 */
.ar-channel-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity 0.35s;
}

.ar-channel-card:hover::after { opacity: 1; }

.ar-channel-card.status-success { border-left: 3px solid var(--green); }
.ar-channel-card.status-fail { border-left: 3px solid var(--red); }
.ar-channel-card.status-unknown { border-left: 3px solid var(--text-muted); }

/* 头部行 */
.ar-channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ar-channel-name {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.ar-channel-index {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ar-channel-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* 状态徽章 */
.ar-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.3px;
}

.ar-badge.success {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(52,211,153,0.2);
}

.ar-badge.fail {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(248,113,113,0.2);
}

.ar-badge.unknown {
    background: rgba(71,85,105,0.2);
    color: var(--text-muted);
    border: 1px solid rgba(71,85,105,0.2);
}

.ar-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.ar-badge.success .ar-badge-dot {
    background: var(--green);
    box-shadow: 0 0 6px var(--green-glow);
}

.ar-badge.fail .ar-badge-dot { background: var(--red); }
.ar-badge.unknown .ar-badge-dot { background: var(--text-muted); }

.ar-time-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* 状态光点 */
.ar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ar-dot.success {
    background: var(--green);
    box-shadow: 0 0 10px var(--green-glow);
}

.ar-dot.fail {
    background: var(--red);
    box-shadow: 0 0 10px var(--red-glow);
}

.ar-dot.unknown { background: var(--text-muted); }

/* 48h 时间线 */
.ar-timeline-wrap {
    margin: 0.5rem 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ar-timeline-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.ar-timeline {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.ar-timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.ar-timeline-dot:hover {
    transform: scale(2);
    z-index: 10;
    border-radius: 2px;
}

.ar-timeline-dot.success { background: var(--green); }
.ar-timeline-dot.fail { background: var(--red); }
.ar-timeline-dot.unknown { background: var(--text-muted); opacity: 0.3; }

/* 悬浮提示 */
.ar-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15,23,42,0.95);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-xs);
    padding: 6px 10px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 999;
    backdrop-filter: blur(8px);
}

.ar-timeline-dot:hover .ar-tooltip { opacity: 1; }

/* 错误信息 */
.ar-error-text {
    font-size: 0.72rem;
    color: var(--red);
    margin-top: 0.3rem;
    padding: 4px 10px;
    background: var(--red-dim);
    border-radius: var(--radius-xs);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== 按钮系统 ==================== */
.ar-btn-test {
    font-family: 'Inter', sans-serif;
    background: transparent;
    border: 1px solid rgba(52,211,153,0.25);
    color: var(--green);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.ar-btn-test:hover:not(:disabled) {
    background: var(--green-dim);
    border-color: rgba(52,211,153,0.4);
    box-shadow: 0 0 12px rgba(52,211,153,0.1);
}

.ar-btn-test:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    color: var(--text-muted);
    border-color: var(--border);
}

/* ==================== 兑换区 ==================== */
.ar-redeem-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255,255,255,0.03);
}

.ar-input {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 0.78rem;
    color: var(--text-primary);
    outline: none;
    transition: all 0.25s ease;
    flex: 1;
}

.ar-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.ar-input::placeholder { color: var(--text-muted); font-family: 'Inter', sans-serif; }

.ar-redeem-input { max-width: 260px; }

.ar-btn-redeem {
    font-family: 'Inter', sans-serif;
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.25);
    color: var(--accent-light);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ar-btn-redeem:hover {
    background: rgba(99,102,241,0.18);
    border-color: rgba(99,102,241,0.4);
    box-shadow: 0 0 12px rgba(99,102,241,0.1);
}

/* 兑换结果 */
.ar-redeem-result {
    margin-top: 0.5rem;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    display: none;
    animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.ar-redeem-result.success {
    background: var(--green-dim);
    border: 1px solid rgba(52,211,153,0.2);
    color: var(--green);
    display: block;
}

.ar-redeem-result.error {
    background: var(--red-dim);
    border: 1px solid rgba(248,113,113,0.2);
    color: var(--red);
    display: block;
}

.ar-redeem-key {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--green);
    background: rgba(15,23,42,0.6);
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    margin-top: 0.4rem;
    word-break: break-all;
    user-select: all;
    border: 1px solid rgba(52,211,153,0.15);
}

/* ==================== Toast ==================== */
.ar-toast {
    position: fixed;
    top: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 500;
    z-index: 9999;
    background: rgba(15,23,42,0.9);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    color: var(--text-primary);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ar-toast.warn {
    border-color: rgba(251,191,36,0.3);
    color: var(--yellow);
}

.ar-toast.success-toast {
    border-color: rgba(52,211,153,0.3);
    color: var(--green);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==================== 页脚 ==================== */
.ar-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ==================== 加载 ==================== */
.ar-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    gap: 1rem;
}

.ar-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.ar-loading-text {
    font-size: 0.82rem;
    color: var(--text-muted);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .ar-header { padding: 0 1rem; }
    .ar-main { padding: 1.2rem 0.8rem 4rem; }
    .ar-stats-bar { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .ar-stat-card { padding: 0.8rem; }
    .ar-stat-value { font-size: 1.4rem; }
    .ar-stat-label { font-size: 0.65rem; }
    .ar-channel-card { padding: 0.8rem 1rem; }
    .ar-channel-header { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
    .ar-channel-actions { flex-wrap: wrap; width: 100%; }
    .ar-redeem-inline { flex-direction: column; }
    .ar-redeem-input { max-width: 100%; width: 100%; }
    .ar-header-info { display: none; }
}

@media (max-width: 480px) {
    .ar-stats-bar { grid-template-columns: 1fr; }
}
