/* ==========================================================================
   StatusApp Customer Portal — Stylesheet
   Clean, customer-facing design. System font stack. No external resources.
   ========================================================================== */

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

:root {
    --color-bg:           #f4f6f9;
    --color-surface:      #ffffff;
    --color-border:       #dee2e6;
    --color-text:         #212529;
    --color-text-muted:   #6c757d;
    --color-primary:      #0d6efd;
    --color-primary-dark: #0a58ca;
    --color-danger:       #dc3545;
    --color-success:      #198754;
    --color-warning:      #ffc107;

    --status-up:          #198754;
    --status-down:        #dc3545;
    --status-degraded:    #e67e00;
    --status-ssl:         #0dcaf0;
    --status-maintenance: #6f42c1;
    --status-unknown:     #6c757d;

    --radius: 8px;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --font:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html { font-size: 16px; }

body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--color-primary); }
a:hover { text-decoration: underline; }

/* ── Header ────────────────────────────────────────────────────────────────── */
.portal-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.portal-header__inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.portal-header__brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}
.portal-header__tagline {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    border-left: 1px solid var(--color-border);
    padding-left: 12px;
}

/* ── Main & Footer ─────────────────────────────────────────────────────────── */
.portal-main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 24px;
}

.portal-footer {
    text-align: center;
    padding: 20px 24px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
}

/* ── Access box (request / sent / invalid pages) ────────────────────────────── */
.access-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    width: 100%;
    max-width: 440px;
}

.access-box__header  { text-align: center; margin-bottom: 28px; }
.access-box__icon    { font-size: 2.4rem; margin-bottom: 12px; }
.access-box__title   { font-size: 1.5rem; font-weight: 700; }
.access-box__subtitle { font-size: 0.95rem; color: var(--color-text-muted); margin-top: 8px; }
.access-box__note    { font-size: 0.83rem; color: var(--color-text-muted); text-align: center; margin-top: 18px; }
.access-box__back    { text-align: center; margin-top: 20px; font-size: 0.9rem; }

.access-box__checklist {
    list-style: none;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}
.access-box__checklist li::before { content: "✓ "; color: var(--color-success); font-weight: 700; }

.access-form { display: flex; flex-direction: column; gap: 16px; }

/* ── Flash messages ────────────────────────────────────────────────────────── */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
}
.flash--error   { background: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }
.flash--success { background: #d1e7dd; color: #0f5132; border: 1px solid #badbcc; }

/* ── Form elements ─────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label  { font-size: 0.9rem; font-weight: 600; }
.form-input {
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--color-surface);
    color: var(--color-text);
}
.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}
.form-group--error .form-input { border-color: var(--color-danger); }
.field-error { font-size: 0.82rem; color: var(--color-danger); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dark); color: #fff; }
.btn--full { width: 100%; }

/* ── Overall status banner ─────────────────────────────────────────────────── */
.overall-banner {
    width: 100%;
    padding: 16px 24px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.01em;
}
.overall-banner--up          { background: #d1e7dd; color: #0f5132; }
.overall-banner--down        { background: #f8d7da; color: #842029; }
.overall-banner--degraded    { background: #fff3cd; color: #664d03; }
.overall-banner--ssl_warning { background: #cff4fc; color: #055160; }
.overall-banner--unknown     { background: #e2e3e5; color: #41464b; }

.overall-banner__inner { max-width: 900px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 10px; }
.overall-banner__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}
.overall-banner--up .overall-banner__dot { animation: none; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Portal content area ───────────────────────────────────────────────────── */
.portal-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
    width: 100%;
}

.portal-greeting {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    margin-bottom: 28px;
}

.portal-footer-note {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-top: 32px;
    text-align: center;
}

/* ── Resource section ──────────────────────────────────────────────────────── */
.resource-section { margin-bottom: 36px; }
.resource-section__title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

/* ── Resource card ─────────────────────────────────────────────────────────── */
.resource-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
    border-left-width: 4px;
}
.resource-card--up          { border-left-color: var(--status-up); }
.resource-card--down        { border-left-color: var(--status-down); }
.resource-card--degraded    { border-left-color: var(--status-degraded); }
.resource-card--ssl_warning { border-left-color: var(--status-ssl); }
.resource-card--unknown     { border-left-color: var(--status-unknown); }

.resource-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
}
.resource-card__info { min-width: 0; }
.resource-card__name {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.resource-card__meta {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    display: block;
    margin-top: 2px;
}
.resource-card__url {
    font-size: 0.82rem;
    color: var(--color-primary);
    text-decoration: none;
    display: block;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}
.resource-card__url:hover { text-decoration: underline; }

.resource-card__incident {
    padding: 8px 20px;
    background: #fff3cd;
    border-top: 1px solid #ffe69c;
    font-size: 0.85rem;
    color: #664d03;
}
.incident-label::before { content: "⚠ "; }

.resource-card__response-time {
    padding: 6px 20px;
    font-size: 0.83rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    background: #fafbfc;
}

.resource-card__history {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-top: 1px solid var(--color-border);
    background: #fafbfc;
}
.history-label {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* ── Check history dots ────────────────────────────────────────────────────── */
.check-history { display: flex; gap: 4px; align-items: center; }
.check-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}
.check-dot--up          { background: var(--status-up); }
.check-dot--down        { background: var(--status-down); }
.check-dot--degraded    { background: var(--status-degraded); }
.check-dot--ssl_warning { background: var(--status-ssl); }
.check-dot--unknown     { background: var(--color-border); }

/* ── Status pills ──────────────────────────────────────────────────────────── */
.status-pill {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status-pill--up          { background: #d1e7dd; color: #0f5132; }
.status-pill--down        { background: #f8d7da; color: #842029; }
.status-pill--degraded    { background: #fff3cd; color: #664d03; }
.status-pill--ssl_warning { background: #cff4fc; color: #055160; }
.status-pill--maintenance { background: #e9d8fd; color: #4a1972; }
.status-pill--unknown     { background: #e2e3e5; color: #41464b; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.status-empty {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.8;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .portal-main     { padding: 24px 16px; }
    .access-box      { padding: 28px 20px; }
    .portal-content  { padding: 24px 16px; }
    .portal-header__inner { padding: 0 16px; }
    .overall-banner  { padding: 14px 16px; font-size: 0.9rem; }
    .resource-card__header { flex-wrap: wrap; }
    .resource-card__url { max-width: 200px; }
}
