﻿/* 
SpeedOnline Monitoring Dashboard
Author: chaoweilangmao
 */
:root {
    --bg-surface: #ffffff;
    --bg-page: #f2f5fc;
    --text-primary: #0f172a;
    --text-secondary: #4b5563;
    --border: #e2e8f0;
    --shadow: 0 18px 40px -24px rgba(15, 23, 42, 0.35);
    --brand: linear-gradient(135deg, #4f46e5, #7c3aed);
    --accent: #6366f1;
    --success: #22c55e;
    --warning: #fbbf24;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
}

.app-header {
    background: var(--brand);
    color: #fff;
    padding: 1.5rem 1rem;
    box-shadow: var(--shadow);
}

.app-header .wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
}

.brand {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.brand i {
    margin-right: 0.75rem;
    font-size: 1.5rem;
}

.subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.78);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.main {
    max-width: 1200px;
    margin: 2.5rem auto 3rem;
    padding: 0 1.5rem;
    display: grid;
    gap: 2rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.summary-card {
    position: relative;
    overflow: hidden;
    padding: 1.6rem;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    color: #fff;
    box-shadow: var(--shadow);
}

.summary-card::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.45), transparent 60%);
}

.summary-card.total {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
}

.summary-card.online {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

.summary-card.offline {
    background: linear-gradient(135deg, #f97316, #ef4444);
}

.summary-icon {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    font-size: 1.4rem;
    z-index: 1;
}

.summary-details {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 1;
}

.summary-label {
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;
}

.summary-value {
    font-size: 2.3rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    padding: 1.5rem;
    color: #1f2937;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metric-card::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.26;
    pointer-events: none;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 60%);
}

.metric-card header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.85);
}

.metric-card .metric-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 1.1rem;
}

.metric-card.metric-cpu {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(79, 70, 229, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.18);
}

.metric-card.metric-cpu .metric-icon {
    background: rgba(79, 70, 229, 0.12);
    color: #4338ca;
}

.metric-card.metric-memory {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(6, 182, 212, 0.08));
    border: 1px solid rgba(14, 165, 233, 0.18);
}

.metric-card.metric-memory .metric-icon {
    background: rgba(14, 165, 233, 0.12);
    color: #0ea5e9;
}

.metric-card.metric-disk {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.22), rgba(245, 158, 11, 0.08));
    border: 1px solid rgba(249, 115, 22, 0.18);
}

.metric-card.metric-disk .metric-icon {
    background: rgba(249, 115, 22, 0.12);
    color: #f97316;
}

.metric-card .metric-value {
    position: relative;
    font-size: 2.15rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.015em;
}

.panel {
    background: var(--bg-surface);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-header {
    padding: 1.5rem 1.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.panel-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.filters .panel-body {
    padding: 1.25rem 1.75rem 1.75rem;
    display: grid;
    gap: 1.5rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.filter-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.search-input {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.search-input:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
}

.search-input i {
    color: var(--text-secondary);
    margin-right: 0.75rem;
}

.search-input input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.region-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.filter-chip {
    border: 1px solid var(--border);
    background: #f9fafc;
    color: var(--text-secondary);
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip:hover {
    border-color: rgba(99, 102, 241, 0.4);
    color: var(--accent);
}

.filter-chip.is-active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
    border-color: transparent;
    font-weight: 600;
}

.panel-body {
    padding: 1.75rem;
}

.alert {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.alert i {
    font-size: 1rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.14);
    color: #b45309;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

thead {
    background: #f8fafc;
}

th {
    text-align: left;
    padding: 0.85rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    position: relative;
    cursor: pointer;
    user-select: none;
}

th:hover {
    color: var(--accent);
}

th.sort-asc::after,
th.sort-desc::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

th.sort-asc::after {
    border-bottom: 7px solid var(--accent);
    transform: translateY(-60%);
}

th.sort-desc::after {
    border-top: 7px solid var(--accent);
    transform: translateY(-40%);
}

td {
    padding: 1rem 1.1rem;
    border-top: 1px solid var(--border);
    background: #fff;
}

tbody tr:hover td {
    background: rgba(99, 102, 241, 0.05);
}

.server-name {
    font-weight: 600;
}

.meter {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.meter-label {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.85rem;
    align-items: center;
}

.meter-title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    color: var(--text-primary);
}

.meter-title i {
    font-size: 0.8rem;
}

.meter-title .fa-microchip {
    color: #6366f1;
}

.meter-title .fa-memory {
    color: #0ea5e9;
}

.meter-title .fa-hdd {
    color: #f97316;
}

.meter-value {
    font-weight: 600;
    color: var(--text-secondary);
}

.meter-bar {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    border-radius: inherit;
    transition: width 0.3s ease;
}

.meter-fill.success {
    background: rgba(34, 197, 94, 0.85);
}

.meter-fill.warning {
    background: rgba(251, 191, 36, 0.85);
}

.meter-fill.danger {
    background: rgba(239, 68, 68, 0.85);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-weight: 500;
    font-size: 0.85rem;
}

.status-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-pill.online {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.status-pill.online .dot {
    background: #22c55e;
}

.status-pill.offline {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.status-pill.offline .dot {
    background: #ef4444;
}

.empty-row {
    text-align: center;
    color: var(--text-secondary);
    padding: 2.5rem 0;
    font-size: 0.95rem;
}

.table-footer {
    margin-top: 1.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.table-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.table-meta select {
    margin-left: 0.35rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 0.35rem 0.6rem;
    background: #fff;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.page-btn {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    padding: 0.45rem 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.page-btn:hover:not(.disabled):not(.active) {
    color: var(--accent);
    border-color: rgba(99, 102, 241, 0.4);
}

.page-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-bottom: 2rem;
}

@media (max-width: 768px) {
    .filters .panel-body {
        padding: 1.25rem;
    }

    .panel-body {
        padding: 1.5rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    table {
        min-width: 600px;
    }
}

@media (max-width: 540px) {
    .table-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
