/**
 * XT Server Health V1.0.0
 * xt.pt — Radar's Baby 📡
 * Aesthetic: Ops dashboard — dark, clean, status-forward
 */

:root {
    --font-display: 'Outfit', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius: 10px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg: #0C0E14; --bg-card: #141721; --bg-subtle: #1A1E2C;
    --bg-hover: #222738; --border: #262C40; --border-light: #1E2335;
    --text: #E4E8F2; --text-secondary: #8E95AE; --text-muted: #5A6180;
    --green: #22C55E; --green-soft: rgba(34,197,94,0.1); --green-glow: rgba(34,197,94,0.2);
    --amber: #F59E0B; --amber-soft: rgba(245,158,11,0.1);
    --red: #EF4444; --red-soft: rgba(239,68,68,0.1); --red-glow: rgba(239,68,68,0.15);
    --blue: #3B82F6; --blue-soft: rgba(59,130,246,0.1);
    --accent: #818CF8; --accent-soft: rgba(129,140,248,0.1);
}

[data-theme="light"] {
    --bg: #F3F4F8; --bg-card: #FFFFFF; --bg-subtle: #EDF0F5;
    --bg-hover: #E4E8F0; --border: #D8DCE8; --border-light: #E8ECF4;
    --text: #1A1D2E; --text-secondary: #5A6178; --text-muted: #8B91A8;
    --green: #16A34A; --green-soft: rgba(22,163,74,0.08); --green-glow: rgba(22,163,74,0.12);
    --amber: #D97706; --amber-soft: rgba(217,119,6,0.08);
    --red: #DC2626; --red-soft: rgba(220,38,38,0.08); --red-glow: rgba(220,38,38,0.1);
    --blue: #2563EB; --blue-soft: rgba(37,99,235,0.08);
    --accent: #6366F1; --accent-soft: rgba(99,102,241,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Layout */
.app-header { background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.header-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.header-brand-icon { font-size: 1.5rem; }
.header-brand h1 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.header-brand span { font-size: 0.68rem; color: var(--text-muted); display: block; margin-top: -2px; font-family: var(--font-mono); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-user { font-size: 0.8rem; color: var(--text-muted); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 600; font-family: var(--font-body); border: none; cursor: pointer; transition: all var(--transition); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { opacity: 0.9; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Status indicator */
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }
.status-dot.warn { background: var(--amber); box-shadow: 0 0 8px var(--amber-soft); }
.status-dot.error { background: var(--red); box-shadow: 0 0 8px var(--red-glow); }
.status-dot.unknown { background: var(--text-muted); }

/* Server banner */
.server-banner { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.server-info h2 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.server-info p { font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }
.server-stats { display: flex; gap: 24px; }
.server-stat { text-align: center; }
.server-stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.server-stat-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Section title */
.section-title { font-family: var(--font-display); font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin: 24px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title:first-child { margin-top: 0; }

/* Cards grid */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: all var(--transition); }
.card:hover { border-color: var(--accent); }

/* Service cards */
.service-card { display: flex; align-items: center; gap: 12px; }
.service-emoji { font-size: 1.5rem; }
.service-info h3 { font-size: 0.9rem; font-weight: 600; }
.service-info .status-text { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.status-text.ok { color: var(--green); }
.status-text.error { color: var(--red); }
.status-text.warn { color: var(--amber); }

/* Gauge */
.gauge { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.gauge-ring { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; }
.gauge-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 4px solid var(--border); }
.gauge-value { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; }
.gauge-label { font-size: 0.72rem; color: var(--text-muted); }

/* Disk bars */
.disk-card { padding: 16px 18px; }
.disk-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.disk-path { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 600; }
.disk-size { font-size: 0.75rem; color: var(--text-muted); }
.disk-bar { height: 8px; background: var(--bg-subtle); border-radius: 4px; overflow: hidden; }
.disk-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.disk-bar-fill.ok { background: var(--green); }
.disk-bar-fill.warn { background: var(--amber); }
.disk-bar-fill.error { background: var(--red); }

/* Domain table */
.domain-table { width: 100%; border-collapse: collapse; }
.domain-table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 8px 12px; border-bottom: 2px solid var(--border); font-weight: 600; }
.domain-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); font-size: 0.84rem; vertical-align: middle; }
.domain-table tr:hover { background: var(--bg-hover); }
.domain-table tr:last-child td { border-bottom: none; }
.domain-name { font-family: var(--font-mono); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.domain-name a { color: var(--text); text-decoration: none; }
.domain-name a:hover { color: var(--accent); }
.cert-badge { font-size: 0.72rem; padding: 2px 8px; border-radius: 4px; font-weight: 600; font-family: var(--font-mono); }
.cert-badge.ok { background: var(--green-soft); color: var(--green); }
.cert-badge.warn { background: var(--amber-soft); color: var(--amber); }
.cert-badge.error { background: var(--red-soft); color: var(--red); }
.http-badge { font-size: 0.72rem; padding: 2px 8px; border-radius: 4px; font-weight: 600; font-family: var(--font-mono); }
.http-badge.ok { background: var(--green-soft); color: var(--green); }
.http-badge.redirect { background: var(--blue-soft); color: var(--blue); }
.http-badge.error { background: var(--red-soft); color: var(--red); }
.dns-ip { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }

/* Summary bar */
.summary-bar { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.summary-chip { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.summary-chip.ok { background: var(--green-soft); color: var(--green); }
.summary-chip.warn { background: var(--amber-soft); color: var(--amber); }
.summary-chip.error { background: var(--red-soft); color: var(--red); }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 40px; width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { font-size: 2.5rem; margin-bottom: 8px; display: block; }
.login-logo h1 { font-family: var(--font-display); font-size: 1.2rem; }
.login-logo p { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); }
.login-error { background: var(--red-soft); color: var(--red); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 16px; display: none; }
.login-error.active { display: block; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.form-input { width: 100%; padding: 10px 14px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font-body); font-size: 0.875rem; transition: all var(--transition); }
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-submit { width: 100%; padding: 11px; margin-top: 8px; font-size: 0.9rem; }
.login-footer { text-align: center; margin-top: 20px; font-size: 0.65rem; color: var(--text-muted); font-family: var(--font-mono); }
.login-theme { position: absolute; top: 16px; right: 16px; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); font-size: 0.85rem; margin-top: 8px; animation: fadeIn 0.3s ease; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }

/* Last checked */
.last-checked { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); text-align: right; margin-top: 16px; }

/* Spinner */
.spinner { width: 20px; height: 20px; border: 2px solid transparent; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease-out forwards; opacity: 0; }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 16px; }
    .server-banner { flex-direction: column; align-items: flex-start; }
    .server-stats { width: 100%; justify-content: space-between; }
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .domain-table { font-size: 0.78rem; }
    .domain-table th, .domain-table td { padding: 8px; }
    .dns-ip { display: none; }
}
@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; }
}
