/* ============================================================
   RR Web Development — Status Monitor Stylesheet
   Design: Light professional, blue accent, sharp typography
   ============================================================ */

:root {
    /* ── Palette ── */
    --bg-base:        #f5f7fa;
    --bg-surface:     #ffffff;
    --bg-raised:      #f0f2f5;
    --bg-hover:       #e8ecf0;

    --border:         #d0d7de;
    --border-focus:   #2563eb;

    --text-primary:   #0f1729;
    --text-secondary: #3d4f63;
    --text-muted:     #6b7c93;

    --green:          #16a34a;
    --green-dim:      rgba(22,163,74,.10);
    --red:            #dc2626;
    --red-dim:        rgba(220,38,38,.10);
    --amber:          #b45309;
    --amber-dim:      rgba(180,83,9,.10);
    --blue:           #2563eb;
    --blue-bright:    #1d4ed8;
    --blue-dim:       rgba(37,99,235,.10);

    /* ── Typography ── */
    --font-sans:      'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:      'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* ── Shape ── */
    --radius-sm:      4px;
    --radius:         8px;
    --radius-lg:      12px;

    --transition:     140ms ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100vw;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--blue-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Header ──────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(245, 247, 250, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 1rem;
    min-width: 0;
}

.header-inner > * { min-width: 0; }

.brand {
    display: flex;
    align-items: center;
    gap: .625rem;
    font-weight: 600;
    font-size: .9375rem;
    letter-spacing: -.01em;
    color: var(--text-primary);
}

.brand-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition), box-shadow var(--transition);
    flex-shrink: 0;
}
.brand-dot.up      { background: var(--green); box-shadow: 0 0 7px var(--green); }
.brand-dot.down    { background: var(--red);   box-shadow: 0 0 7px var(--red);   }
.brand-dot.degraded{ background: var(--amber); box-shadow: 0 0 7px var(--amber); }


/* ── Header nav ─────────────────────────────────────────── */
.header-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.header-nav a {
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: .35rem .7rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}

.header-nav a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.header-nav a:last-child {
    color: var(--blue);
    border: 1px solid var(--border);
}

.header-nav a:last-child:hover {
    background: var(--blue-dim);
    color: var(--blue-bright);
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: .8rem;
    color: var(--text-muted);
}

.clock {
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--text-secondary);
    min-width: 68px;
    text-align: right;
    letter-spacing: .02em;
}

/* ── Status Banner ───────────────────────────────────────── */
.status-banner {
    margin-top: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    overflow: hidden;
    transition: border-color var(--transition);
}
.status-banner.operational {
    border-color: var(--green);
    background: linear-gradient(135deg, var(--green-dim) 0%, var(--bg-surface) 55%);
}
.status-banner.degraded {
    border-color: var(--amber);
    background: linear-gradient(135deg, var(--amber-dim) 0%, var(--bg-surface) 55%);
}
.status-banner.outage {
    border-color: var(--red);
    background: linear-gradient(135deg, var(--red-dim) 0%, var(--bg-surface) 55%);
}

.banner-inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.75rem 2rem;
}

.banner-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
}

.banner-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
    color: var(--text-primary);
}

.banner-subtitle {
    font-size: .875rem;
    color: var(--text-secondary);
    margin-top: .25rem;
}

/* ── Incident notice ─────────────────────────────────────── */
.incident-notice {
    margin-top: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    background: var(--bg-surface);
    border: 1px solid var(--amber);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.incident-notice.hidden { display: none; }

.incident-badge {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--amber);
    background: var(--amber-dim);
    padding: .2rem .6rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    margin-top: .15rem;
    flex-shrink: 0;
    border: 1px solid rgba(210,153,34,.3);
}

.incident-content strong {
    font-size: .9375rem;
    color: var(--text-primary);
    font-weight: 600;
}
.incident-content p {
    font-size: .875rem;
    color: var(--text-secondary);
    margin-top: .25rem;
}
.incident-time {
    font-family: var(--font-mono);
    font-size: .75rem;
    color: var(--text-muted);
    display: block;
    margin-top: .375rem;
}

/* ── Section ─────────────────────────────────────────────── */
.section { margin-top: 2.25rem; }
.section-label {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--text-muted);
    margin-bottom: .875rem;
}

/* ── Domain grid ─────────────────────────────────────────── */
.domain-grid {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    min-width: 0;
    width: 100%;
}

.domain-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 1rem;
    align-items: center;
    padding: .875rem 1.25rem;
    background: var(--bg-surface);
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
    min-width: 0;
    overflow: hidden;
}
.domain-row:last-child { border-bottom: none; }
.domain-row:hover { background: var(--bg-hover); }

.domain-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
    transition: background var(--transition);
}
.domain-status-dot.up      { background: var(--green); }
.domain-status-dot.down    { background: var(--red); animation: pulse-red 1.6s infinite; }
.domain-status-dot.unknown { background: var(--text-muted); }

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50%       { opacity: .35; }
}

.domain-name {
    font-size: .9375rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.domain-url {
    font-size: .78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: .1rem;
}

.domain-checked {
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: .15rem;
    font-style: italic;
}

.domain-uptime {
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    text-align: right;
}

.domain-response {
    font-family: var(--font-mono);
    font-size: .8rem;
    white-space: nowrap;
    text-align: right;
    min-width: 68px;
}
.domain-response.fast   { color: var(--green); }
.domain-response.medium { color: var(--amber); }
.domain-response.slow   { color: var(--red);   }
.domain-response.down   { color: var(--text-muted); }

.domain-badge {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .2rem .55rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    border: 1px solid transparent;
}
.domain-badge.up      { color: var(--green); background: var(--green-dim); border-color: rgba(63,185,80,.2); }
.domain-badge.down    { color: var(--red);   background: var(--red-dim);   border-color: rgba(248,81,73,.2); }
.domain-badge.unknown { color: var(--text-muted); background: var(--bg-raised); border-color: var(--border); }

/* ── Outage list ─────────────────────────────────────────── */
.outage-list {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    min-width: 0;
    width: 100%;
}

.outage-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.outage-row:last-child { border-bottom: none; }
.outage-row:hover { background: var(--bg-hover); }
.outage-row.ongoing { background: rgba(248,81,73,.05); }

.outage-domain {
    font-size: .9375rem;
    font-weight: 500;
    color: var(--text-primary);
}
.outage-time {
    font-size: .78rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-top: .2rem;
}
.outage-root-cause {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

.outage-duration {
    font-family: var(--font-mono);
    font-size: .875rem;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
}

.outage-status-badge {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .2rem .55rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    border: 1px solid transparent;
}
.outage-status-badge.ongoing  { color: var(--red);   background: var(--red-dim);   border-color: rgba(248,81,73,.2); }
.outage-status-badge.resolved { color: var(--green); background: var(--green-dim); border-color: rgba(63,185,80,.2); }

.no-outages {
    padding: 2.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .9rem;
    background: var(--bg-surface);
}

/* ── Skeleton loader ─────────────────────────────────────── */
.skeleton-row {
    height: 54px;
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-raised) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-bottom: 1px solid var(--border);
}
.skeleton-row:last-child { border-bottom: none; }

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
    margin-top: 4rem;
    padding: 1.5rem 0 2.5rem;
    border-top: 1px solid var(--border);
}
.site-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .8rem;
    color: var(--text-muted);
}
.site-footer a {
    color: var(--text-muted);
}
.site-footer a:hover {
    color: var(--text-secondary);
    text-decoration: none;
}

/* ── Admin layout ────────────────────────────────────────── */
.admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.admin-nav {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.admin-nav-brand {
    font-weight: 700;
    font-size: .9375rem;
    padding: .5rem .75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .75rem;
    color: var(--text-primary);
}

.admin-nav a {
    display: block;
    padding: .575rem .75rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    color: var(--text-secondary);
    transition: all var(--transition);
    text-decoration: none;
}
.admin-nav a:hover,
.admin-nav a.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.admin-main {
    padding: 2rem;
    overflow-y: auto;
}

.admin-page-title {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: .4rem;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.form-control {
    width: 100%;
    padding: .625rem .875rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: .9375rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59,111,212,.18);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.btn-primary       { background: var(--blue);     color: #fff; }
.btn-primary:hover { background: #2f5ab8; }
.btn-danger        { background: var(--red);      color: #fff; }
.btn-danger:hover  { background: #d73a3a; }
.btn-ghost         { background: var(--bg-raised); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover   { background: var(--bg-hover);  color: var(--text-primary); }
.btn-sm { padding: .375rem .7rem; font-size: .8rem; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-title {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    padding: .875rem 1.125rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--green-dim); border-color: rgba(63,185,80,.3);  color: var(--green); }
.alert-error   { background: var(--red-dim);   border-color: rgba(248,81,73,.3);  color: var(--red);   }

/* ── Login page ──────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg-base);
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
}
.login-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: .375rem;
    color: var(--text-primary);
}
.login-subtitle {
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* ── Tables ──────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.data-table th {
    text-align: left;
    padding: .625rem .875rem;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: .75rem .875rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

/* ── Responsive ──────────────────────────────────────────── */

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .header-nav a:not(:last-child) { display: none; }
}

@media (max-width: 768px) {
    /* Header */
    .header-nav { display: none; }

    /* Banner */
    .banner-inner {
        padding: 1.25rem;
        gap: .875rem;
    }
    .banner-title { font-size: 1.1rem; }
    .banner-subtitle { font-size: .8rem; }

    /* Domain rows — hide uptime column, collapse to 3 cols */
    .domain-row {
        grid-template-columns: auto 1fr auto;
        padding: .75rem 1rem;
        gap: .75rem;
    }
    .domain-uptime { display: none; }
    .domain-response { min-width: unset; }

    /* Outage rows */
    .outage-row {
        grid-template-columns: 1fr auto;
        padding: .875rem 1rem;
    }
    .outage-status-badge { display: none; }

    /* Admin */
    .admin-layout { grid-template-columns: 1fr; }
    .admin-nav { display: none; }
    .admin-main { padding: 1.25rem; }

    /* Footer */
    .site-footer .container {
        flex-direction: column;
        gap: .5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    /* Extra small — phones */
    .container { padding: 0 1rem; }

    .header-inner { height: 52px; }
    .brand { font-size: .875rem; }

    .status-banner { margin-top: 1.25rem; }
    .banner-inner { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .banner-icon { width: 38px; height: 38px; font-size: 1.1rem; }
    .banner-title { font-size: 1rem; }

    .section { margin-top: 1.75rem; }

    .domain-row {
        grid-template-columns: auto 1fr auto;
        gap: .5rem;
    }
    .domain-name { font-size: .875rem; }
    .domain-badge { font-size: .65rem; padding: .15rem .4rem; }

    .outage-row { grid-template-columns: 1fr auto; }
    .outage-duration { font-size: .8rem; }

    .login-card { padding: 1.75rem 1.25rem; }

    .site-footer { margin-top: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}