/* =========================================================
   ESA Status — Clean, responsive CSS
   ========================================================= */

/* ---------- Theme tokens ---------- */
:root {
    color-scheme: dark;

    /* Colors */
    --esa-bg: #0b0f16;
    --esa-card: rgba(24, 26, 34, .72);
    --esa-stroke: rgba(255, 255, 255, .09);
    --esa-text: #e9ecf8;
    --esa-dim: #9aa3b2;

    /* Brand accents */
    --esa-primary: #00C6FF;
    /* blue */
    --esa-accent: #FF7A18;
    /* orange */

    /* Semantic */
    --esa-green: #22c55e;
    --esa-orange: #f59e0b;
    --esa-red: #ef4444;
}

/* ---------- Resets ---------- */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
    background: var(--esa-bg);
    color: var(--esa-text);
}

/* ---------- Layout ---------- */
.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 24px 80px;
}

.grid {
    display: grid;
    gap: 14px;
}

.grid.tw {
    grid-template-columns: 1.1fr .9fr;
}

.header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.logo {
    height: 28px;
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--esa-card);
    border: 1px solid var(--esa-stroke);
    border-radius: 18px;
    backdrop-filter: blur(12px);
    box-shadow: 0 16px 50px rgba(0, 0, 0, .45);
}

.card.pad {
    padding: 20px 22px;
}

.title {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: .2px;
}

.sub {
    color: var(--esa-dim);
}

/* ---------- Buttons ---------- */
.btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .5rem .9rem;
    border-radius: 999px;
    border: 1px solid var(--esa-stroke);
    background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .03));
    color: var(--esa-text);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: .2px;
    transition: transform .15s ease, box-shadow .15s ease, background .2s ease, border-color .2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
}

.btn.primary {
    border-color: rgba(0, 198, 255, .45);
    background: linear-gradient(180deg, rgba(0, 198, 255, .22), rgba(0, 198, 255, .06));
}

.btn.ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, .16);
}

.btn.ghost:hover {
    background: rgba(255, 255, 255, .04);
}

.btn.danger {
    border-color: rgba(239, 68, 68, .45);
    background: linear-gradient(180deg, rgba(239, 68, 68, .18), rgba(239, 68, 68, .06));
}

/* ---------- Pills / Chips ---------- */
.pill {
    padding: .25rem .55rem;
    border-radius: 999px;
    border: 1px solid var(--esa-stroke);
    font-weight: 800;
}

.pill.ok {
    background: rgba(34, 197, 94, .15);
    border-color: rgba(34, 197, 94, .35);
}

.pill.warn {
    background: rgba(245, 158, 11, .15);
    border-color: rgba(245, 158, 11, .35);
}

.pill.crit {
    background: rgba(239, 68, 68, .15);
    border-color: rgba(239, 68, 68, .35);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    border: 1px solid var(--esa-stroke);
    background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .03));
    font-weight: 700;
    letter-spacing: .2px;
}

.chip.small {
    font-size: .85rem;
    padding: .25rem .55rem;
}

.chip.sev-ok {
    background: rgba(34, 197, 94, .15);
    border-color: rgba(34, 197, 94, .35);
    color: #c5f3d3;
}

.chip.sev-warn {
    background: rgba(245, 158, 11, .12);
    border-color: rgba(245, 158, 11, .35);
    color: #ffd89a;
}

.chip.sev-crit {
    background: rgba(239, 68, 68, .12);
    border-color: rgba(239, 68, 68, .35);
    color: #ffb6b6;
}

/* ---------- Uptime status bar (20 days) ---------- */
.statusbar {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    gap: 6px;
    margin-top: 12px;
}

.statusbar div {
    height: 12px;
    border-radius: 999px;
    background: #171b26;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
    transition: transform .08s ease, opacity .15s ease;
}

.statusbar div[data-c] {
    background: var(--esa-green);
}

.statusbar div[data-c="orange"] {
    background: var(--esa-orange);
}

.statusbar div[data-c="red"] {
    background: var(--esa-red);
}

.statusbar div[data-c]::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, .15), transparent);
    opacity: .35;
}

.statusbar div:hover {
    transform: translateY(-1px);
    opacity: .95;
}

/* Tooltip (JS-controlled) */
.tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    padding: .5rem .7rem;
    border-radius: 10px;
    background: rgba(19, 22, 34, .95);
    color: var(--esa-text);
    border: 1px solid rgba(255, 255, 255, .12);
    font-size: .85rem;
    max-width: 320px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}

.tooltip .t-muted {
    color: var(--esa-dim);
    font-size: .8rem;
}

.tooltip .t-title {
    font-weight: 700;
    margin-bottom: .2rem;
}

/* ---------- Lists: incidents & announcements ---------- */
.inc-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.inc-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--esa-stroke);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, .02);
    transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
}

.inc-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, .35);
    border-color: rgba(255, 255, 255, .14);
}

.inc-title {
    font-weight: 900;
    letter-spacing: .2px;
}

.inc-sub {
    color: var(--esa-dim);
    margin-top: 2px;
    font-weight: 600;
}

.ann-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.ann-card {
    border: 1px solid var(--esa-stroke);
    border-radius: 14px;
    padding: 12px 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .02));
    transition: transform .12s, box-shadow .2s, border-color .2s;
}

.ann-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, .35);
    border-color: rgba(255, 255, 255, .14);
}

.ann-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ann-title {
    font-weight: 900;
}

.ann-date {
    font-size: .9rem;
    color: var(--esa-dim);
    font-weight: 700;
}

/* ---------- Single incident page ---------- */
.inc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.inc-title-big {
    font-size: 28px;
    font-weight: 1000;
    letter-spacing: .3px;
}

.inc-upd {
    margin-top: 10px;
    border: 1px solid var(--esa-stroke);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
    padding: 10px 12px;
}

/* ---------- Tables (generic & admin) ---------- */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px;
    border-bottom: 1px solid var(--esa-stroke);
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--esa-stroke);
}

.admin-table th {
    color: var(--esa-dim);
    font-weight: 700;
    letter-spacing: .2px;
    font-size: .95rem;
}

.col-title {
    width: 40%;
}

.col-time {
    width: 25%;
}

.col-status {
    width: 15%;
}

.col-actions {
    width: 20%;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.link-underline {
    color: var(--esa-text);
    text-decoration: none;
}

.link-underline:hover {
    text-decoration: underline;
}

/* ---------- Badges / misc ---------- */
.badge {
    padding: .25rem .5rem;
    border: 1px solid var(--esa-stroke);
    border-radius: .5rem;
    background: rgba(255, 255, 255, .04);
}

.label {
    font-size: 12px;
    color: var(--esa-dim);
}

.footer {
    margin: 28px 0;
    color: var(--esa-dim);
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mono {
    font-variant-numeric: tabular-nums;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .grid.tw {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 20px;
    }

    .inc-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .admin-table {
        table-layout: auto;
    }

    .col-title,
    .col-time,
    .col-status,
    .col-actions {
        width: auto;
    }
}

@media (hover: none) {

    .btn:hover,
    .inc-item:hover,
    .ann-card:hover,
    .statusbar div:hover {
        transform: none;
        box-shadow: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
