/* ==========================================================================
   LonexStatus — Public Status Page
   Brand stack: #0a0a0b background, #29cd96 accent, Plus Jakarta Sans.
   No gradients, no radial glows, no decorative colour. Status colour
   appears ONLY in status indicators.
   ========================================================================== */

:root {
    --bg:          #0a0a0b;
    --surface:    #121214;
    --surface-2:  #18181b;
    --border:     #1f1f23;
    --text:       #eaeaec;
    --text-muted: #8a8a92;
    --text-dim:   #4f4f56;
    --accent:     #29cd96;

    --status-up:        #29cd96;
    --status-degraded:  #f5a623;
    --status-outage:    #e44b4b;
    --status-unknown:   #3a3a40;
    --status-maintenance: #5b8def;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.lx-wrap {
    max-width: 920px;
    margin: 0 auto;
    padding: var(--space-7) var(--space-5);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.lx-header {
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
}
.lx-header[data-logo-position="left"] {
    flex-direction: row-reverse;
}
.lx-header[data-logo-position="left"] .lx-header-text {
    text-align: right;
}
.lx-header-text {
    min-width: 0;
}

.lx-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.lx-header .lx-logo {
    display: block;
    max-height: 56px;
    max-width: 200px;
    width: auto;
    flex-shrink: 0;
}
.lx-header .tagline {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 14px;
}

/* --------------------------------------------------------------------------
   Overall status banner
   Single solid surface, no gradient. The status word itself gets the
   accent treatment — nothing else.
   -------------------------------------------------------------------------- */
.lx-overall {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}
.lx-overall .dot {
    width: 12px; height: 12px; border-radius: 50%;
    flex-shrink: 0;
}
.lx-overall .label {
    font-weight: 600;
    font-size: 16px;
}
.lx-overall .ts {
    margin-left: auto;
    color: var(--text-dim);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.lx-overall[data-state="operational"]     .dot { background: var(--status-up); }
.lx-overall[data-state="degraded"]         .dot { background: var(--status-degraded); }
.lx-overall[data-state="partial_outage"]   .dot { background: var(--status-outage); }
.lx-overall[data-state="major_outage"]     .dot { background: var(--status-outage); }
.lx-overall[data-state="pending"]          .dot { background: var(--status-unknown); }

/* --------------------------------------------------------------------------
   Groups
   -------------------------------------------------------------------------- */
.lx-group {
    margin-bottom: var(--space-6);
}
.lx-group h2 {
    margin: 0 0 var(--space-3);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.lx-group .group-desc {
    margin: -4px 0 var(--space-3);
    color: var(--text-dim);
    font-size: 13px;
}

/* --------------------------------------------------------------------------
   Monitor card
   -------------------------------------------------------------------------- */
.lx-monitor {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-3);
}

.lx-monitor-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.lx-monitor-name {
    font-weight: 600;
    font-size: 15px;
    margin: 0;
}
.lx-monitor-desc {
    color: var(--text-dim);
    font-size: 12px;
    margin: 2px 0 0;
}

/* Status indicator — the ONE place colour is used to convey state. */
.lx-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.lx-status .sd {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--status-unknown);
}
.lx-status[data-key="operational"] .sd { background: var(--status-up); }
.lx-status[data-key="degraded"]    .sd { background: var(--status-degraded); }
.lx-status[data-key="outage"]      .sd { background: var(--status-outage); }
.lx-status[data-key="maintenance"] .sd { background: var(--status-maintenance); }
.lx-status[data-key="operational"] { color: var(--text); }
.lx-status[data-key="degraded"]    { color: var(--text); }
.lx-status[data-key="outage"]      { color: var(--text); }
.lx-status[data-key="maintenance"] { color: var(--text); }

/* --------------------------------------------------------------------------
   Uptime bar (inline SVG container)
   -------------------------------------------------------------------------- */
.lx-uptime {
    margin-top: var(--space-3);
}
.lx-uptime-bar {
    display: block;
    width: 100%;
    height: 34px;
}
.lx-uptime-bar rect {
    transition: opacity 0.15s ease;
}
.lx-uptime-bar rect:hover {
    opacity: 0.85;
}
.lx-uptime-bar .cell-operational { fill: var(--status-up); }
.lx-uptime-bar .cell-degraded    { fill: var(--status-degraded); }
.lx-uptime-bar .cell-outage      { fill: var(--status-outage); }
.lx-uptime-bar .cell-no_data     { fill: var(--status-unknown); }

.lx-uptime-meta {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-2);
    color: var(--text-dim);
    font-size: 11px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Sparkline (inside the status pill)
   -------------------------------------------------------------------------- */
.lx-spark {
    display: inline-block;
    margin-left: var(--space-2);
    vertical-align: -3px;
    overflow: visible;
}
.lx-spark polyline {
    fill: none;
    stroke: var(--c, var(--accent));
    stroke-width: 1.25;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Group collapse
   -------------------------------------------------------------------------- */
.lx-group-h {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    user-select: none;
}
.lx-group-caret {
    display: inline-block;
    color: var(--text-dim);
    font-size: 11px;
    transition: transform 150ms ease;
}
.lx-group.is-collapsed .lx-group-caret { transform: rotate(-90deg); }
.lx-group.is-collapsed .lx-monitor,
.lx-group.is-collapsed .group-desc { display: none; }

/* --------------------------------------------------------------------------
   Live-refresh countdown
   -------------------------------------------------------------------------- */
.lx-refresh {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: var(--space-3);
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-dim);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}
.lx-refresh .ring {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--text-dim);
    border-top-color: var(--accent);
    animation: lx-spin 1.4s linear infinite;
}
.lx-refresh.is-pulling .ring { border-top-color: var(--text); }
@keyframes lx-spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
    .lx-refresh { margin-left: 0; margin-top: var(--space-2); }
}

/* --------------------------------------------------------------------------
   Server metrics strip (FiveM / Minecraft agent values)
   -------------------------------------------------------------------------- */
.lx-srv {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}
.lx-srv-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.lx-srv-item .k {
    font-size: 11px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.lx-srv-item .v {
    font-size: 13px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Metrics expand (chart)
   -------------------------------------------------------------------------- */
/* Toggle row — one button per metrics panel. */
.lx-metrics-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin-top: var(--space-3);
}

.lx-metrics-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}
.lx-metrics-toggle:hover { color: var(--text); }
.lx-metrics-toggle .caret {
    display: inline-block;
    transition: transform 0.15s ease;
    font-size: 10px;
}
.lx-metrics-toggle.is-on .caret {
    transform: rotate(180deg);
}

.lx-metrics {
    display: none;
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}
.lx-metrics.is-open { display: block; }

.lx-range {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    margin-bottom: var(--space-3);
}
.lx-range button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
}
.lx-range button:hover  { color: var(--text); }
.lx-range button.is-on  {
    background: var(--surface);
    color: var(--text);
}

.lx-chart {
    position: relative;
    height: 200px;
}
.lx-chart-empty {
    color: var(--text-dim);
    font-size: 12px;
    text-align: center;
    padding: var(--space-6) 0;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.lx-footer {
    margin-top: var(--space-7);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.lx-footer a:hover { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Per-monitor detail page (/m/<slug>)
   -------------------------------------------------------------------------- */
.lx-back {
    color: var(--text-dim);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.lx-back:hover { color: var(--text-muted); }
.lx-back-row {
    margin: 0 0 var(--space-4);
}

.lx-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin: var(--space-6) 0 var(--space-5);
}
.lx-detail-title { margin: 0; font-size: 22px; font-weight: 600; color: var(--text); }
.lx-detail-sub   { margin: var(--space-2) 0 0; color: var(--text-muted); font-size: 13px; }

.lx-monitor-name a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 120ms ease;
}
.lx-monitor-name a:hover { border-bottom-color: var(--text-dim); }

.lx-monitor.is-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.lx-embed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-3);
}
.lx-embed {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
}
.lx-embed > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.lx-embed > header .t {
    color: var(--text-dim);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.lx-embed .badge-preview { height: 20px; display: block; }
.lx-embed label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-3);
    color: var(--text-dim);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.lx-embed input[type="text"] {
    width: 100%;
    margin-top: 4px;
    padding: 6px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
}
.lx-embed input[type="text"]:focus { outline: 1px solid var(--accent); outline-offset: -1px; }
.lx-copy {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font: inherit;
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 8px;
    cursor: pointer;
}
.lx-copy:hover { color: var(--text); border-color: var(--text-dim); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
    .lx-wrap { padding: var(--space-5) var(--space-4); }
    .lx-overall { flex-wrap: wrap; }
    .lx-overall .ts { margin-left: 0; flex-basis: 100%; }
    .lx-uptime-bar { height: 28px; }
}

/* --------------------------------------------------------------------------
   Incidents & Maintenance sections
   -------------------------------------------------------------------------- */

.lx-section {
    margin-bottom: var(--space-6);
}
.lx-section h2 {
    margin: 0 0 var(--space-3);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* Active incidents are visually prominent; recent ones recede. */
.lx-section-incidents .lx-incident {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--status-outage);
    border-radius: var(--radius);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
}
.lx-section-incidents .lx-incident[data-impact="critical"] { border-left-color: var(--status-outage); }
.lx-section-incidents .lx-incident[data-impact="major"]    { border-left-color: var(--status-outage); }
.lx-section-incidents .lx-incident[data-impact="minor"]    { border-left-color: var(--status-degraded); }
.lx-section-incidents .lx-incident[data-impact="none"]     { border-left-color: var(--status-unknown); }

.lx-section-recent .lx-incident {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
}

.lx-incident-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
}
.lx-incident-meta {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    color: var(--text-dim);
    font-size: 12px;
}
.lx-incident-affected {
    margin: var(--space-2) 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

/* Maintenance section */
.lx-section-maintenance .lx-maint {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--status-maintenance);
    border-radius: var(--radius);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
}
.lx-maint-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
}
.lx-maint-meta {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    color: var(--text-dim);
    font-size: 12px;
}
.lx-maint-desc {
    margin: var(--space-2) 0 0;
    color: var(--text-muted);
    font-size: 13px;
}
.lx-maint-affected {
    margin: var(--space-2) 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

/* Timeline (shared with admin) */
.lx-timeline {
    list-style: none;
    margin: var(--space-3) 0 0;
    padding: 0;
    border-left: 2px solid var(--border);
}
.lx-timeline li {
    position: relative;
    padding: 0 0 var(--space-3) var(--space-4);
}
.lx-timeline li::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
}
.lx-timeline-head {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.lx-timeline-ts { font-variant-numeric: tabular-nums; }
.lx-timeline-body {
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
}

/* Tags shared between admin and public */
.lx-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--surface-2);
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}
.lx-tag.lx-status-investigating { color: var(--status-outage); }
.lx-tag.lx-status-identified    { color: var(--status-degraded); }
.lx-tag.lx-status-monitoring    { color: var(--status-maintenance); }
.lx-tag.lx-status-resolved      { color: var(--status-up); }

.lx-tag.lx-impact-none     { color: var(--text-dim); }
.lx-tag.lx-impact-minor    { color: var(--status-degraded); }
.lx-tag.lx-impact-major    { color: var(--status-outage); }
.lx-tag.lx-impact-critical { color: var(--status-outage); }

.lx-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: var(--text-dim);
}


/* Discord help button -- used in the installer footer and other support links. */
.lx-btn-discord {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #5865f2;
    color: #fff !important;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    text-decoration: none;
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 500;
    transition: background 0.15s ease;
}
.lx-btn-discord:hover { background: #4752c4; color: #fff !important; }
.lx-btn-discord svg { flex-shrink: 0; }
