/* ============================================================
 * Status page — public /status (status.claude.com 스타일)
 * ------------------------------------------------------------
 * 사용처: /WEB-INF/jsp/status/index.jsp
 *         /public/module/status/status-page.js
 *
 * 시그널 테마 토큰 (--pp-*) 사용. 라이트/다크 모두에서 동작.
 * 인라인 스타일 0. !important 자제.
 * ============================================================ */

body.pp-status-body {
    /* SUIT 로컬 호스팅 폰트(@font-face 는 pp-00-fonts.css). status 페이지 전체 SUIT 적용.
     *
     * ⚠️ 아래 font-family 선언만으로는 적용되지 않는다 — 전역 규칙
     *   `body:not(.pp-login-page), ... { font-family: var(--pp-ui-font-family) <중요선언>; }`
     * 이 status body 에도 매칭되고 중요선언이라 특이도와 무관하게 이긴다.
     * 같은 방식으로 맞받는 대신 **그 규칙이 참조하는 변수 자체를 재정의**한다 —
     * 디자인시스템과 싸우지 않고 같은 레버를 쓰는 쪽이 안전하고,
     * 전역 규칙이 바뀌어도 따라간다.
     */
    --pp-ui-font-family: 'SUIT', -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", sans-serif;
    font-family: 'SUIT', -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", sans-serif;
    background: var(--pp-bg-muted, #f8fafc);
    color: var(--pp-text, #0f172a);
    min-height: 100vh;
    margin: 0;
}

.status-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px 64px 24px;
}

/* ── Header ───────────────────────────────────────────────── */

.status-page-header {
    margin-bottom: 24px;
}

.status-page-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-page-logo {
    height: 36px;
    width: auto;
    display: block;
    /* 브랜드 로고 단색화 — 헤더 타이틀(.status-page-title, #0d0e0e)과 같은 다크톤으로 맞춘다.
       원본 logo-dark.png 는 중간 회색 2톤(외곽링 밝음 / 팬 어두움)이라 타이틀 옆에서 떠 보였다.
       <img> 라 mask 로 색을 입힐 수 없어(이미지 픽셀이 그대로 그려짐) filter 로 처리한다.
       brightness(0) 은 불투명 픽셀을 배경색과 무관하게 검정으로 눌러 결과가 결정적이다
       (opacity 계열은 배경에 따라 달라져 부적합). */
    filter: brightness(0);
}

.status-page-title-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.status-page-title {
    margin: 0;                  /* h1 승격(a11y) 시 기본 margin 중화 — 기존 div 외형 유지 */
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #0d0e0e;
}

/* .status-page-subtitle 제거(2026-07-26) — 헤더에서 서브타이틀 문구를 없애면서
   유일 사용처가 사라져 규칙도 함께 정리. i18n 키 status.subtitle 도 en/ko 양쪽 삭제. */

/* ── Top banner ───────────────────────────────────────────── */

.status-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    border-radius: 12px;
    margin-bottom: 28px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
    color: var(--pp-white, #ffffff);
    background: var(--pp-tone-muted-bg, #6b7280);
    transition: background 0.3s ease;
}

.status-banner-operational {
    background: var(--pp-tone-success-bg);
}

.status-banner-degraded {
    background: var(--pp-tone-warn-bg);
}

.status-banner-outage {
    background: var(--pp-tone-danger-bg);
}

.status-banner-loading {
    background: var(--pp-tone-muted-bg, #6b7280);
}

.status-banner-icon {
    font-size: 36px;
    line-height: 1;
    flex-shrink: 0;
}

.status-banner-text {
    flex: 1;
    min-width: 0;
}

.status-banner-headline {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin-bottom: 4px;
}

.status-banner-asof {
    font-size: 13px;
    opacity: 0.92;
}

.status-banner-uptime {
    text-align: right;
    flex-shrink: 0;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.status-uptime-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.status-uptime-unit {
    font-size: 16px;
    font-weight: 600;
    margin-left: 2px;
    opacity: 0.85;
}

.status-uptime-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.85;
    margin-top: 2px;
}

/* ── Endpoint cards list ─────────────────────────────────── */

.status-endpoints {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-endpoints-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-endpoints-empty {
    padding: 32px;
    text-align: center;
    color: var(--pp-text-muted, #64748b);
    background: var(--pp-bg, #ffffff);
    border: 1px solid var(--pp-border, #e5e7eb);
    border-radius: 10px;
}

.endpoint-card {
    background: var(--pp-bg, #ffffff);
    border: 1px solid var(--pp-border, #e5e7eb);
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.endpoint-card:hover {
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    border-color: var(--pp-border-strong, #cbd5e1);
}

.endpoint-card-skeleton {
    height: 156px;
    background: linear-gradient(90deg,
        var(--pp-bg-muted, #f1f5f9) 0%,
        var(--pp-bg, #ffffff) 50%,
        var(--pp-bg-muted, #f1f5f9) 100%);
    background-size: 200% 100%;
    animation: pp-status-skeleton 1.6s ease-in-out infinite;
}

@keyframes pp-status-skeleton {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.endpoint-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.endpoint-card-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.endpoint-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--pp-text, #0f172a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.endpoint-card-category {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--pp-text-muted, #64748b);
    padding: 2px 8px;
    border: 1px solid var(--pp-border, #e5e7eb);
    border-radius: 6px;
    background: var(--pp-bg-muted, #f8fafc);
}

/* ── Endpoint status badge (라이트 테마: 진한 배경 + 흰 텍스트) ── */

.endpoint-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--pp-tone-on-solid, #ffffff);
}

.endpoint-status-badge > i {
    font-size: 8px;
    line-height: 1;
}

/* tone classes(pp-tone-*) 는 pp-12-status-tones.css 에서 배경/텍스트 색 공급. */

/* ── Endpoint metric grid ────────────────────────────────── */

.endpoint-card-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 14px;
}

.endpoint-metric {
    min-width: 0;
}

.endpoint-metric-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pp-text-muted, #64748b);
    margin-bottom: 2px;
}

.endpoint-metric-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--pp-text, #0f172a);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.endpoint-metric-unit {
    font-size: 12px;
    font-weight: 500;
    color: var(--pp-text-muted, #64748b);
    margin-left: 2px;
}

/* ── status timeline ─────────────────────────────────────────
   칸 수는 백엔드가 정한다(인프라 36칸 x 10분, API 90칸 x 1분). 그래서 그리드에
   개수를 박지 않고 auto-fit 으로 "몇 개가 오든 가로를 꽉 채우게" 둔다.
   종전에는 repeat(90, ...) 고정이라 36칸이 오면 앞쪽 40% 만 차지하고 쪼그라들었다. */

.timeline-90 {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 2px;
    height: 28px;
    align-items: stretch;
}

.timeline-bar {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    background: var(--pp-bg-muted, #e5e7eb);
}

/* 칸이 굵어진 만큼(36칸) 마우스 오버 시 어느 칸인지 분명히 보이게 한다.
   색은 디자인 토큰만 쓴다 — hex 하드코딩은 테마 전환 시 어긋난다. */
.timeline-bar:hover {
    outline: 2px solid var(--pp-fg-muted);
    outline-offset: -1px;
}

.timeline-bar-ok {
    background: var(--pp-tone-success-bg);
}

.timeline-bar-degraded {
    background: var(--pp-tone-warn-bg);
}

.timeline-bar-outage {
    background: var(--pp-tone-danger-bg);
}

.timeline-bar-no-data {
    background: var(--pp-border, #e5e7eb);
}

/* ── Footer ──────────────────────────────────────────────── */

.status-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding: 12px 4px;
    font-size: 12px;
    color: var(--pp-text-muted, #64748b);
    border-top: 1px solid var(--pp-border, #e5e7eb);
}

.status-footer-left,
.status-footer-right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-footer-right span:last-child {
    font-variant-numeric: tabular-nums;
    color: var(--pp-text-soft, #334155);
}

/* ── Dark theme override (status page 전용) ──────────────── */

body.pp-status-body {
    /* Signal theme base tokens — pp-fonts.css paints `body { background: var(--background) }`,
       so the page-level dark background must override these, not just the pp-* tokens.
       Overriding them here makes the dark background hold regardless of which body
       rule wins the cascade — no !important needed. */
    --background:     #0f172a;
    --foreground:     #f1f5f9;
    --pp-bg:          #1e293b;
    --pp-bg-muted:    #0f172a;
    --pp-text:        #f1f5f9;
    --pp-text-muted:  #94a3b8;
    --pp-text-soft:   #cbd5e1;
    --pp-border:      #334155;
    --pp-border-strong: #475569;
    --pp-white:       #ffffff;
    background: #0f172a;
    color: #f1f5f9;
}

/* ── Section title (인프라 / API 구분자) ─────────────────── */

.status-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--pp-text-muted, #94a3b8);
    margin: 0 0 12px 2px;
}

/* ── Infra section ───────────────────────────────────────── */

.status-infra-section {
    margin-bottom: 36px;
}

.infra-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.infra-card {
    background: var(--pp-bg, #1e293b);
    border: 1px solid var(--pp-border, #334155);
    border-radius: 10px;
    padding: 18px 18px 14px 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.infra-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-color: var(--pp-border-strong, #475569);
}

.infra-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.infra-card-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--pp-text, #f1f5f9);
}

.infra-card-uptime {
    font-size: 12px;
    color: var(--pp-text-muted, #94a3b8);
    font-variant-numeric: tabular-nums;
}

/* ── API section ─────────────────────────────────────────── */

.status-api-section {
    margin-bottom: 0;
}

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

@media (max-width: 720px) {
    .status-page {
        padding: 20px 14px 48px 14px;
    }

    .status-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 18px 20px;
    }

    .status-banner-uptime {
        padding-left: 0;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.25);
        padding-top: 10px;
        text-align: left;
        width: 100%;
    }

    .endpoint-card-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .timeline-90 {
        height: 22px;
    }
}

/* ── 타임라인 전용 툴팁 ───────────────────────────────────────
   Bootstrap Tooltip 을 쓰지 않는 이유는 status-page.js 주석 참조
   (이 페이지는 body 가 스크롤 컨테이너라 Popper 좌표가 어긋난다).
   position:fixed + 마우스 좌표라 스크롤 상태와 무관하게 커서 옆에 뜬다. */
.status-tip {
    position: fixed;
    z-index: 2000;
    max-width: 260px;
    padding: 6px 10px;
    border-radius: 4px;
    /* 색은 실재하는 토큰만 쓴다 — --pp-bg-inverse/--pp-fg-inverse 는 이 테마에 없어서
       배경이 투명해지고 글자만 떠 보였다(2026-08-02 실측). 어두운 --pp-text 를 배경으로,
       흰 --pp-bg 를 글자로 뒤집어 풍선 대비를 만든다. */
    background: var(--pp-text);
    color: var(--pp-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .28);
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;   /* 툴팁이 커서를 가로채 mouseout 이 튀는 것을 막는다 */
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s ease;
}

.status-tip.is-visible {
    opacity: 1;
    visibility: visible;
}
