/* ── Variables ── */
:root {
    --brand: #F75934;
    --brand-light: #FF8E2B;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --surface: var(--card-bg, #fff);
    --border: var(--input-border, #e2e8f0);
}

/* ── Base ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background-color: var(--bg-color, #f5f6fa);
    color: var(--text-color, #1e293b);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 12px 60px;
    overflow-x: hidden;
}

/* ── Back button ── */
.back-btn {
    position: fixed;
    top: 18px;
    left: 18px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
    color: #fff;
    font-weight: 600;
    font-size: .88rem;
    border-radius: 30px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(247, 89, 52, .30);
    transition: all 0.2s cubic-bezier(.4, 0, .2, 1);
    z-index: 1000;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(247, 89, 52, .40);
    color: #fff;
}

/* ── Header ── */
.page-header {
    text-align: center;
    margin: 80px 0 30px;
}

.page-header h1 {
    font-size: 1.9rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.page-header h1 i {
    font-size: 1.6rem;
    -webkit-text-fill-color: var(--brand);
}

.page-subtitle {
    color: var(--footer-text, #64748b);
    margin-top: 8px;
    font-size: 0.95rem;
}

/* ── Container ── */
.monitor-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* ── Loading ── */
.loading-wrap {
    text-align: center;
    padding: 60px 20px;
    color: var(--footer-text, #64748b);
    font-size: .95rem;
    line-height: 1.8;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(247, 89, 52, .15);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Server List Layout ── */
.server-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.server-row {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px 28px;
    box-shadow: 0 4px 6px -1px var(--shadow-color, rgba(0, 0, 0, 0.05)), 0 2px 4px -1px var(--shadow-color, rgba(0, 0, 0, 0.03));
    transition: all 0.3s ease;
    gap: 30px;
}

.server-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px var(--shadow-color, rgba(0, 0, 0, 0.08)), 0 4px 6px -2px var(--shadow-color, rgba(0, 0, 0, 0.04));
    border-color: var(--brand-light, #cbd5e1);
}

body.dark-mode .server-row {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

body.dark-mode .server-row:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    border-color: var(--brand);
}

/* ── Server Info Section ── */
.server-info {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 0 0 250px;
}

.server-icon {
    font-size: 2rem;
    color: var(--footer-text, #94a3b8);
    background: var(--input-bg, #f8fafc);
    padding: 14px;
    border-radius: 12px;
}

body.dark-mode .server-icon {
    background: #334155;
    color: #e2e8f0;
}

.server-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.server-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
}

.server-mount {
    font-size: 0.82rem;
    color: var(--footer-text, #64748b);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Metrics Section ── */
.metric-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.metric-title i {
    opacity: 0.7;
}

.metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
}

.progress-bar {
    height: 8px;
    background: var(--input-bg, #e2e8f0);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

body.dark-mode .progress-bar {
    background: #334155;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.warning {
    background: var(--warning);
}

.progress-fill.danger {
    background: var(--danger);
}

.progress-fill.ram-usage {
    background: var(--info);
}

.metric-subinfo {
    font-size: 0.8rem;
    color: var(--footer-text, #64748b);
    text-align: right;
    font-weight: 500;
}

.error-text {
    color: var(--danger);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

/* ── Footer ── */
.footer {
    width: 100%;
    text-align: center;
    color: var(--footer-text, #94a3b8);
    font-size: .8rem;
    margin-top: 50px;
}

/* ── Dark Mode: High-contrast text ── */
body.dark-mode {
    --text-color: #000000;
    --footer-text: #1c1d1e;
}

body.dark-mode .server-name,
body.dark-mode .metric-title,
body.dark-mode .metric-value {
    color: #000000;
}

body.dark-mode .server-mount,
body.dark-mode .metric-subinfo,
body.dark-mode .page-subtitle,
body.dark-mode .loading-wrap {
    color: #646464;
}

body.dark-mode .footer {
    color: #646464;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .server-row {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        padding: 20px;
    }

    .server-info {
        flex: auto;
        border-bottom: 1px solid var(--border);
        padding-bottom: 16px;
    }

    .page-header {
        margin-top: 70px;
    }
}