/* ═══════════════════════════════════════════════════════════
   ParaCrash Status — Stylesheet
   Matches paracrash.uk design language
═══════════════════════════════════════════════════════════ */

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

:root {
    --green:      #10b981;
    --green-dark: #059669;
    --green-glow: rgba(16,185,129,0.25);
    --amber:      #f59e0b;
    --orange:     #f97316;
    --red:        #ef4444;
    --blue:       #3b82f6;
    --bg:         #080808;
    --bg-card:    #111111;
    --bg-card2:   #0d0d0d;
    --border:     #1e1e1e;
    --border2:    #2a2a2a;
    --text:       #f9fafb;
    --text-2:     #e5e7eb;
    --text-3:     #9ca3af;
    --text-4:     #6b7280;
    --text-5:     #4b5563;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.5; overflow-x: hidden; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fade-up   { from{ opacity:0; transform:translateY(16px); } to{ opacity:1; transform:none; } }
@keyframes pulse-dot { 0%,100%{ box-shadow:0 0 0 0 rgba(16,185,129,.5); } 70%{ box-shadow:0 0 0 8px rgba(16,185,129,0); } }
@keyframes pulse-red { 0%,100%{ box-shadow:0 0 0 0 rgba(239,68,68,.5); } 70%{ box-shadow:0 0 0 8px rgba(239,68,68,0); } }
@keyframes pulse-amb { 0%,100%{ box-shadow:0 0 0 0 rgba(245,158,11,.5); } 70%{ box-shadow:0 0 0 8px rgba(245,158,11,0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Navigation ──────────────────────────────────────────── */
.st-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.9rem 2rem; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    background: rgba(8,8,8,0.92); backdrop-filter: blur(12px);
}
.st-nav-logo { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
.st-nav-logo img { height: 26px; width: auto; }
.st-nav-logo-text { font-size: 1rem; font-weight: 800; color: var(--text); }
.st-nav-badge {
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.25);
    border-radius: 999px; padding: 0.18rem 0.65rem;
}
.st-nav-right { display: flex; align-items: center; gap: 1.25rem; }
.st-nav-link { font-size: 0.82rem; color: var(--text-4); text-decoration: none; transition: color 0.15s; }
.st-nav-link:hover { color: var(--green); text-decoration: none; }
.st-nav-admin-btn {
    font-size: 0.8rem; font-weight: 600; color: var(--text-3);
    padding: 0.35rem 0.9rem; background: rgba(255,255,255,0.05);
    border: 1px solid var(--border2); border-radius: 999px; text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.st-nav-admin-btn:hover { border-color: rgba(16,185,129,0.3); color: var(--green); text-decoration: none; }

/* ── Hero / Overall Status ───────────────────────────────── */
.st-hero {
    padding: 4.5rem 2rem 3.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    position: relative; overflow: hidden;
}
.st-hero::before {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(circle, rgba(16,185,129,.13) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 80%);
    opacity: .15; pointer-events: none;
}
.st-hero-inner { position: relative; z-index: 2; max-width: 700px; margin: 0 auto; }
.st-overall-status {
    display: inline-flex; align-items: center; gap: 0.85rem;
    padding: 1rem 2rem; border-radius: 999px;
    margin-bottom: 1.25rem;
    font-size: 1.4rem; font-weight: 800;
    animation: fade-up 0.6s ease forwards;
}
.st-overall-status.operational { background: rgba(16,185,129,0.08); border: 1.5px solid rgba(16,185,129,0.3); color: #10b981; }
.st-overall-status.degraded    { background: rgba(245,158,11,0.08);  border: 1.5px solid rgba(245,158,11,0.3);  color: #f59e0b; }
.st-overall-status.partial     { background: rgba(249,115,22,0.08);  border: 1.5px solid rgba(249,115,22,0.3);  color: #f97316; }
.st-overall-status.outage      { background: rgba(239,68,68,0.08);   border: 1.5px solid rgba(239,68,68,0.3);   color: #ef4444; }
.st-overall-status.maintenance { background: rgba(59,130,246,0.08);  border: 1.5px solid rgba(59,130,246,0.3);  color: #3b82f6; }
.st-dot {
    width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
}
.st-dot.green { background: #10b981; animation: pulse-dot 2s ease-in-out infinite; }
.st-dot.amber { background: #f59e0b; animation: pulse-amb 2s ease-in-out infinite; }
.st-dot.red   { background: #ef4444; animation: pulse-red 2s ease-in-out infinite; }
.st-dot.blue  { background: #3b82f6; }
.st-dot.grey  { background: #4b5563; }

.st-hero-since { font-size: 0.82rem; color: var(--text-4); animation: fade-up 0.6s ease forwards 0.15s; opacity: 0; }
.st-hero-since strong { color: var(--text-3); }
.st-hero-updated { font-size: 0.75rem; color: var(--text-5); margin-top: 0.35rem; animation: fade-up 0.6s ease forwards 0.25s; opacity: 0; }

/* ── Incident banner (active incidents at top) ───────────── */
.incident-banner {
    border-left: 4px solid; padding: 1rem 1.5rem;
    display: flex; align-items: flex-start; gap: 1rem;
}
.incident-banner.minor    { background: rgba(245,158,11,0.07); border-color: #f59e0b; }
.incident-banner.major    { background: rgba(249,115,22,0.07); border-color: #f97316; }
.incident-banner.critical { background: rgba(239,68,68,0.07);  border-color: #ef4444; }
.incident-banner-title { font-size: 0.9rem; font-weight: 700; color: var(--text-2); margin-bottom: 0.2rem; }
.incident-banner-sub   { font-size: 0.8rem; color: var(--text-4); }
.incident-banner-icon  { flex-shrink: 0; margin-top: 1px; }

/* ── Container ───────────────────────────────────────────── */
.container { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 2.5rem 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-title {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--text-4); margin-bottom: 1.25rem;
    display: flex; align-items: center; gap: 0.75rem;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Service rows ────────────────────────────────────────── */
.services-list { display: flex; flex-direction: column; gap: 0; }
.service-row {
    display: flex; flex-direction: column; gap: 0.55rem;
    padding: 1.1rem 0; border-bottom: 1px solid var(--border);
}
.service-row:last-child { border-bottom: none; }
.service-row-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.service-name { font-size: 0.92rem; font-weight: 600; color: var(--text-2); }
.service-desc { font-size: 0.75rem; color: var(--text-5); margin-top: 0.1rem; }
.service-right { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.service-uptime-pct { font-size: 0.75rem; color: var(--text-4); white-space: nowrap; }
.service-uptime-pct strong { color: var(--text-3); }

/* Status pill */
.st-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    padding: 0.2rem 0.65rem; border-radius: 999px;
}
.st-pill-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.st-pill.operational { background: rgba(16,185,129,0.1); color: #10b981; border: 1px solid rgba(16,185,129,0.25); }
.st-pill.operational .st-pill-dot { background: #10b981; }
.st-pill.degraded    { background: rgba(245,158,11,0.1);  color: #f59e0b; border: 1px solid rgba(245,158,11,0.25); }
.st-pill.degraded    .st-pill-dot { background: #f59e0b; }
.st-pill.partial     { background: rgba(249,115,22,0.1);  color: #f97316; border: 1px solid rgba(249,115,22,0.25); }
.st-pill.partial     .st-pill-dot { background: #f97316; }
.st-pill.outage      { background: rgba(239,68,68,0.1);   color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }
.st-pill.outage      .st-pill-dot { background: #ef4444; }
.st-pill.maintenance { background: rgba(59,130,246,0.1);  color: #3b82f6; border: 1px solid rgba(59,130,246,0.25); }
.st-pill.maintenance .st-pill-dot { background: #3b82f6; }
.st-pill.unknown     { background: rgba(107,114,128,0.1); color: #6b7280; border: 1px solid rgba(107,114,128,0.25); }
.st-pill.unknown     .st-pill-dot { background: #6b7280; }

/* ── Uptime bars ─────────────────────────────────────────── */
.uptime-bar-wrap { display: flex; flex-direction: column; gap: 0.35rem; }
.uptime-bars { display: flex; gap: 2px; height: 28px; align-items: stretch; }
.ub {
    flex: 1; min-width: 2px; border-radius: 3px;
    cursor: default; transition: opacity 0.1s;
}
.ub:hover { opacity: 0.65; }
.ub-up       { background: #10b981; }
.ub-good     { background: rgba(16,185,129,0.5); }
.ub-degraded { background: #f59e0b; }
.ub-partial  { background: #f97316; }
.ub-down     { background: #ef4444; }
.ub-none     { background: #1a2420; }

.uptime-bar-meta { display: flex; align-items: center; justify-content: space-between; }
.uptime-bar-lbl { font-size: 0.68rem; color: var(--text-5); }
.uptime-bar-pct { font-size: 0.72rem; font-weight: 700; color: var(--text-3); }

/* Tooltip */
#bar-tooltip {
    position: fixed; background: #111; border: 1px solid #2a2a2a;
    padding: 7px 11px; border-radius: 9px;
    font-size: 0.75rem; color: var(--text-2);
    z-index: 9999; pointer-events: none;
    white-space: nowrap; display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    line-height: 1.5;
}

/* ── Incident cards ──────────────────────────────────────── */
.incident-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden; margin-bottom: 1rem;
}
.incident-card-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; padding: 1.25rem 1.4rem; border-bottom: 1px solid var(--border);
}
.incident-card-title { font-size: 0.95rem; font-weight: 700; color: var(--text-2); margin-bottom: 0.3rem; }
.incident-card-meta  { font-size: 0.75rem; color: var(--text-4); }
.incident-card-meta span { margin-right: 0.75rem; }
.incident-impact {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
    padding: 0.2rem 0.6rem; border-radius: 999px; flex-shrink: 0;
}
.impact-minor    { background: rgba(245,158,11,0.12); color: #f59e0b; border: 1px solid rgba(245,158,11,0.25); }
.impact-major    { background: rgba(249,115,22,0.12); color: #f97316; border: 1px solid rgba(249,115,22,0.25); }
.impact-critical { background: rgba(239,68,68,0.12);  color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }

.incident-updates { padding: 0 1.4rem; }
.update-item {
    display: flex; gap: 1rem; padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.update-item:last-child { border-bottom: none; }
.update-timeline { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; padding-top: 3px; }
.update-dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex-shrink: 0;
}
.update-dot.investigating { background: #ef4444; }
.update-dot.identified    { background: #f59e0b; }
.update-dot.monitoring    { background: #3b82f6; }
.update-dot.resolved      { background: #10b981; }
.update-body { flex: 1; min-width: 0; }
.update-status {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--text-4); margin-bottom: 0.25rem;
}
.update-message { font-size: 0.85rem; color: var(--text-3); line-height: 1.6; }
.update-time { font-size: 0.72rem; color: var(--text-5); margin-top: 0.3rem; }
.no-incidents {
    text-align: center; padding: 3rem 1.5rem;
    color: var(--text-5); font-size: 0.88rem;
}
.no-incidents svg { display: block; margin: 0 auto 0.75rem; }

/* ── Maintenance card ────────────────────────────────────── */
.maintenance-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-left: 3px solid #3b82f6; border-radius: 12px;
    padding: 1.1rem 1.25rem; margin-bottom: 0.75rem;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.maintenance-card.in-progress { border-left-color: #f59e0b; }
.maintenance-title { font-size: 0.9rem; font-weight: 700; color: var(--text-2); margin-bottom: 0.25rem; }
.maintenance-desc  { font-size: 0.8rem; color: var(--text-4); line-height: 1.5; }
.maintenance-time  { font-size: 0.75rem; color: var(--text-5); margin-top: 0.35rem; }

/* ── Stats bar ───────────────────────────────────────────── */
.stats-bar {
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    padding: 2.5rem 0;
}
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.5rem; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; padding: 1.25rem; text-align: center;
    transition: border-color 0.2s;
}
.stat-card:hover { border-color: rgba(16,185,129,0.2); }
.stat-val  { font-size: 1.9rem; font-weight: 900; color: var(--text); line-height: 1; margin-bottom: 0.4rem; }
.stat-val .green { color: #10b981; }
.stat-val .star  { color: #f59e0b; font-size: 1.3rem; vertical-align: middle; }
.stat-label { font-size: 0.72rem; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.07em; }

/* ── Footer ──────────────────────────────────────────────── */
.st-footer {
    border-top: 1px solid var(--border);
    padding: 1.75rem 2rem;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.st-footer-left { font-size: 0.78rem; color: var(--text-5); }
.st-footer-left a { color: var(--text-4); }
.st-footer-left a:hover { color: var(--green); text-decoration: none; }
.st-footer-right { display: flex; gap: 1.25rem; }
.st-footer-right a { font-size: 0.78rem; color: var(--text-5); text-decoration: none; transition: color 0.15s; }
.st-footer-right a:hover { color: var(--green); }

/* ── Admin styles ────────────────────────────────────────── */
.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 2rem; border-bottom: 1px solid var(--border);
    background: rgba(8,8,8,0.95); position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(12px);
}
.admin-header-left { display: flex; align-items: center; gap: 0.75rem; }
.admin-header-logo img { height: 24px; }
.admin-header-title { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.admin-header-sub   { font-size: 0.72rem; color: var(--text-4); }
.admin-header-right { display: flex; align-items: center; gap: 1rem; }
.admin-greeting { font-size: 0.8rem; color: var(--text-4); }
.admin-greeting strong { color: #10b981; }
.admin-logout {
    font-size: 0.8rem; font-weight: 600; color: var(--text-4);
    padding: 0.3rem 0.85rem; background: rgba(255,255,255,0.04);
    border: 1px solid var(--border2); border-radius: 999px; text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.admin-logout:hover { border-color: rgba(239,68,68,0.3); color: #f87171; text-decoration: none; }
.admin-view-public {
    font-size: 0.8rem; font-weight: 600; color: var(--text-4);
    padding: 0.3rem 0.85rem; background: transparent;
    border: 1px solid var(--border2); border-radius: 999px; text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.admin-view-public:hover { border-color: rgba(16,185,129,0.3); color: #10b981; text-decoration: none; }

/* Admin stats row */
.admin-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 2rem; }
.admin-stat {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 1rem 1.1rem;
    transition: border-color 0.2s;
}
.admin-stat:hover { border-color: rgba(16,185,129,0.2); }
.admin-stat-val   { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1; }
.admin-stat-label { font-size: 0.7rem; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 0.3rem; }

/* Admin tabs */
.admin-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.admin-tab {
    font-size: 0.85rem; font-weight: 600; color: var(--text-4);
    padding: 0.8rem 1.4rem; cursor: pointer; text-decoration: none;
    border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: var(--text-2); text-decoration: none; }
.admin-tab.active { color: #10b981; border-bottom-color: #10b981; }

/* Admin forms */
.admin-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden; margin-bottom: 1.5rem;
}
.admin-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.4rem; border-bottom: 1px solid var(--border);
}
.admin-card-title { font-size: 0.9rem; font-weight: 700; color: var(--text-2); }
.admin-card-body  { padding: 1.4rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-row.full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label { font-size: 0.75rem; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.05em; }
.form-input, .form-select, .form-textarea {
    background: #0d0d0d; border: 1px solid #2a2a2a; border-radius: 9px;
    color: var(--text-2); font-size: 0.88rem; font-family: inherit;
    padding: 0.65rem 0.85rem; transition: border-color 0.15s; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: #10b981; }
.form-input::placeholder, .form-textarea::placeholder { color: #374151; }
.form-textarea { min-height: 80px; resize: vertical; }
.form-checkbox-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-checkbox { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.85rem; color: var(--text-3); }
.form-checkbox input { accent-color: #10b981; width: 15px; height: 15px; cursor: pointer; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.6rem 1.25rem; border-radius: 9px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: opacity 0.15s, transform 0.15s; }
.btn:hover { opacity: 0.88; text-decoration: none; }
.btn-primary   { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #fff; box-shadow: 0 0 20px rgba(16,185,129,0.2); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 30px rgba(16,185,129,0.35); }
.btn-danger    { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-amber     { background: rgba(245,158,11,0.12); color: #f59e0b; border: 1px solid rgba(245,158,11,0.25); }
.btn-ghost     { background: transparent; color: var(--text-3); border: 1px solid var(--border2); }
.btn-ghost:hover { border-color: rgba(16,185,129,0.3); color: #10b981; }
.btn-sm        { padding: 0.4rem 0.85rem; font-size: 0.78rem; border-radius: 7px; }

/* Admin tables */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th { text-align: left; padding: 0.65rem 0.9rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-4); border-bottom: 1px solid var(--border); }
.admin-table td { padding: 0.85rem 0.9rem; border-bottom: 1px solid var(--border); color: var(--text-3); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }

/* Flash messages */
.flash { padding: 0.75rem 1rem; border-radius: 9px; margin-bottom: 1.25rem; font-size: 0.85rem; }
.flash-ok  { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25); color: #6ee7b7; }
.flash-err { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #fca5a5; }

/* ── Anthropic status row ────────────────────────────────── */
.anthropic-source { font-size: 0.7rem; color: var(--text-5); margin-top: 0.2rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 760px) {
    .st-nav { padding: 0.75rem 1rem; }
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .admin-stats { grid-template-columns: repeat(2,1fr); }
    .form-row { grid-template-columns: 1fr; }
    .st-hero { padding: 3rem 1.25rem 2.5rem; }
    .st-overall-status { font-size: 1.1rem; padding: 0.75rem 1.25rem; }
    .admin-tabs { overflow-x: auto; }
}
@media (max-width: 500px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .admin-stats { grid-template-columns: 1fr 1fr; }
}
