/* WorkVell Status Page - スタイルシート */

:root {
  --brand: #FF8E00;
  --brand-light: #FFF3E0;
  --green: #22C55E;
  --yellow: #F59E0B;
  --red: #EF4444;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --text: #1F2937;
  --border: #E5E7EB;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html { font-size: 16px; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #fff;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ── ヘッダー ── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header__logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-header__logo-mark {
  width: 28px;
  height: 28px;
  background: var(--brand);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.site-header__subtitle {
  color: var(--gray-500);
  font-size: 0.85rem;
}

.site-header__logo-img {
  height: 26px;
  width: auto;
  display: block;
}

/* ── 言語切り替え ── */
.lang-switcher {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.lang-link {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 6px;
  color: var(--gray-500);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.lang-link:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  text-decoration: none;
}

.lang-link--active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}

/* ── 最終更新 ── */
.last-updated {
  text-align: right;
  font-size: 0.72rem;
  color: var(--gray-500);
  margin: -20px 0 24px;
  padding: 0;
}

/* ── メンテナンスバナー ── */
.maintenance-card {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid #BAE6FD;
  background: #F0F9FF;
}

.maintenance-card--active {
  border-color: #7DD3FC;
  background: #E0F2FE;
}

.maintenance-card__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.maintenance-card__body { flex: 1; }

.maintenance-card__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  background: #BAE6FD;
  color: #0369A1;
  margin-bottom: 4px;
}

.maintenance-card--active .maintenance-card__badge {
  background: #38BDF8;
  color: #fff;
}

.maintenance-card__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.maintenance-card__desc {
  font-size: 0.8rem;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.maintenance-card__time {
  font-size: 0.75rem;
  color: #0369A1;
}

/* ── メインコンテンツ ── */
.main {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── 全体ステータスバナー ── */
.status-banner {
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  transition: background .3s, border-color .3s;
}

.status-banner--operational {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
}

.status-banner--degraded {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
}

.status-banner--down {
  background: #FFF1F2;
  border: 1px solid #FECDD3;
}

.status-banner--connecting {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}

.status-banner--offline {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
}

.status-banner--stale {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
}

.status-banner--fallback {
  background: #FFF7ED;
  border: 1px solid #FDBA74;
}

.status-banner__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.status-banner--operational .status-banner__icon { background: #DCFCE7; }
.status-banner--degraded .status-banner__icon { background: #FEF3C7; }
.status-banner--down .status-banner__icon { background: #FFE4E6; }
.status-banner--connecting .status-banner__icon { background: var(--gray-100); }

.status-banner__text h2 {
  margin: 0 0 2px;
  font-size: 1.1rem;
  font-weight: 600;
}

.status-banner__text p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* ── セクション ── */
.section {
  margin-bottom: 40px;
}

.section__title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin: 0 0 12px;
}

/* ── コンポーネントリスト ── */
.component-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.component-group__header {
  background: var(--gray-50);
  padding: 10px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.component-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  transition: background .15s;
}

.component-row:last-child { border-bottom: none; }
.component-row:hover { background: var(--gray-50); }

.component-row--down      { background: #FFF5F5; border-left: 3px solid var(--red); }
.component-row--degraded  { background: #FFFBEB; border-left: 3px solid var(--yellow); }
.component-row--down:hover     { background: #FEE2E2; }
.component-row--degraded:hover { background: #FEF3C7; }

.component-row__status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--operational { background: var(--green); }
.status-dot--degraded { background: var(--yellow); }
.status-dot--down { background: var(--red); animation: blink 1.2s ease-in-out infinite; }
.status-dot--unknown { background: var(--gray-300); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.component-row__name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

.component-row__badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
}

.badge--operational { background: #DCFCE7; color: #15803D; }
.badge--degraded { background: #FEF3C7; color: #92400E; }
.badge--down { background: #FFE4E6; color: #BE123C; }
.badge--unknown { background: var(--gray-100); color: var(--gray-500); }

.component-row__uptime {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 200px;
}

.uptime-label {
  font-size: 0.7rem;
  color: var(--gray-500);
}

.component-row__response-time {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  text-align: right;
  flex-shrink: 0;
}

.uptime-bar {
  display: flex;
  gap: 1px;
  align-items: flex-end;
}

.uptime-bar__day {
  width: 2.5px;
  border-radius: 1px;
  transition: background .2s;
  cursor: default;
  position: relative;
}

.uptime-bar__day--full    { background: var(--green);    height: 28px; }
.uptime-bar__day--partial { background: var(--yellow);   height: 28px; }
.uptime-bar__day--down    { background: var(--red);      height: 28px; }
.uptime-bar__day--no-data { background: var(--gray-200); height: 16px; }

/* ── 稼働率バー ツールチップ ── */
.uptime-tooltip {
  position: absolute;
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: var(--gray-900);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 9999;
  white-space: normal;
  min-width: 180px;
  max-width: 260px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

.uptime-tooltip__date {
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--gray-300);
  margin-bottom: 2px;
}

.uptime-tooltip__val {
  font-size: 0.82rem;
  font-weight: 500;
}

.uptime-tooltip__related-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  margin-top: 8px;
}

.uptime-tooltip__related-item {
  font-size: 0.75rem;
  color: var(--gray-200);
  line-height: 1.4;
}

/* ── インシデントタイムライン ── */
.incident-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.incident-card--active {
  border-color: #FDE68A;
}

.incident-card__header {
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.incident-card__severity {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .04em;
  flex-shrink: 0;
  margin-top: 2px;
}

.severity--minor { background: #DBEAFE; color: #1D4ED8; }
.severity--major { background: #FEF3C7; color: #92400E; }
.severity--critical { background: #FFE4E6; color: #BE123C; }

.incident-card__title {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
}

.incident-card__meta {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.incident-card__status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  flex-shrink: 0;
  margin-top: 2px;
}

.inc-status--investigating { background: #FFE4E6; color: #BE123C; }
.inc-status--identified { background: #FEF3C7; color: #92400E; }
.inc-status--monitoring { background: #DBEAFE; color: #1D4ED8; }
.inc-status--resolved { background: #DCFCE7; color: #15803D; }

.incident-timeline {
  padding: 12px 16px;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.85rem;
}

.timeline-item:last-child { border-bottom: none; }

.timeline-item__time {
  color: var(--gray-500);
  min-width: 110px;
  font-size: 0.78rem;
  padding-top: 1px;
}

.timeline-item__status {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 1px 7px;
  border-radius: 99px;
  height: fit-content;
  flex-shrink: 0;
}

.timeline-item__message {
  color: var(--gray-700);
  flex: 1;
}

.status-unavailable {
  padding: 32px 24px;
  text-align: center;
  color: var(--gray-500);
  font-size: 0.9rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.no-incidents {
  text-align: center;
  padding: 32px;
  color: var(--gray-500);
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── ローディング ── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

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

/* ── フッター ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
}

.site-footer__copy {
  margin: 0 0 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
}

.site-footer__copy a {
  color: var(--gray-700);
}

.site-footer__copy a:hover {
  color: var(--brand);
  text-decoration: none;
}

.site-footer__note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* ── レスポンシブ ── */
@media (max-width: 600px) {
  .component-row__uptime { display: none; }
  .main { padding: 20px 16px 48px; }
  .site-header__inner { padding: 0 16px; }
}
