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

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --radius: 10px;

  --operational: #16a34a;
  --operational-bg: #dcfce7;
  --degraded: #d97706;
  --degraded-bg: #fef3c7;
  --partial: #ea580c;
  --partial-bg: #ffedd5;
  --major: #dc2626;
  --major-bg: #fee2e2;
  --maintenance: #4f46e5;
  --maintenance-bg: #e0e7ff;
  --unknown: #6b7280;
  --unknown-bg: #f3f4f6;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ──────────────────────────────────────────────────────────────────── */
.container { max-width: 880px; margin: 0 auto; padding: 0 20px; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  background: #0f172a;
  color: #fff;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,.25);
}

.header-inner { display: flex; align-items: center; justify-content: space-between; }

.logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: #fff; text-decoration: none; }
.logo svg { opacity: .85; }

.admin-link {
  color: rgba(255,255,255,.5);
  font-size: 13px;
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  transition: color .15s, border-color .15s;
}
.admin-link:hover { color: #fff; border-color: rgba(255,255,255,.4); }

/* ── Overall Banner ──────────────────────────────────────────────────────────── */
.overall-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 28px;
  border-radius: var(--radius);
  margin: 32px 0 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: background .3s;
}
.overall-banner.operational { border-left: 4px solid var(--operational); }
.overall-banner.degraded    { border-left: 4px solid var(--degraded); }
.overall-banner.partial_outage { border-left: 4px solid var(--partial); }
.overall-banner.major_outage   { border-left: 4px solid var(--major); }
.overall-banner.maintenance    { border-left: 4px solid var(--maintenance); }

.overall-icon { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.overall-banner h1 { font-size: 20px; font-weight: 700; }
.overall-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Section Title ───────────────────────────────────────────────────────────── */
.section-title { font-size: 15px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin: 32px 0 12px; }

/* ── Service Group ───────────────────────────────────────────────────────────── */
.service-group { margin-bottom: 20px; }
.service-group-name {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 0 4px 6px;
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  transition: box-shadow .15s;
}
.service-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.07); }

.service-info { flex: 1; min-width: 0; }
.service-name { font-size: 15px; font-weight: 600; }
.service-desc { font-size: 12px; color: var(--text-muted); }

.service-right { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }

.uptime-pct {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  min-width: 50px;
}
.uptime-pct strong { display: block; font-size: 14px; color: var(--text); }

/* ── Status Pill ─────────────────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-operational { background: var(--operational-bg); color: var(--operational); }
.pill-operational::before { background: var(--operational); }
.pill-degraded { background: var(--degraded-bg); color: var(--degraded); }
.pill-degraded::before { background: var(--degraded); }
.pill-partial_outage { background: var(--partial-bg); color: var(--partial); }
.pill-partial_outage::before { background: var(--partial); }
.pill-major_outage { background: var(--major-bg); color: var(--major); }
.pill-major_outage::before { background: var(--major); }
.pill-maintenance { background: var(--maintenance-bg); color: var(--maintenance); }
.pill-maintenance::before { background: var(--maintenance); }
.pill-resolved { background: var(--operational-bg); color: var(--operational); }
.pill-resolved::before { background: var(--operational); }
.pill-investigating { background: var(--major-bg); color: var(--major); }
.pill-investigating::before { background: var(--major); }
.pill-identified { background: var(--partial-bg); color: var(--partial); }
.pill-identified::before { background: var(--partial); }
.pill-monitoring { background: var(--degraded-bg); color: var(--degraded); }
.pill-monitoring::before { background: var(--degraded); }

/* ── 90-Day Timeline ─────────────────────────────────────────────────────────── */
.uptime-timeline { display: flex; flex-direction: column; gap: 16px; margin-bottom: 8px; }

.timeline-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; }
.timeline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.timeline-service-name { font-size: 14px; font-weight: 600; }
.timeline-uptime { font-size: 13px; color: var(--text-muted); }

.timeline-bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 32px;
}

.day-bar {
  flex: 1;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  min-width: 4px;
  transition: opacity .15s, transform .1s;
}
.day-bar:hover { opacity: .8; transform: scaleY(1.05); }

.day-bar.operational { background: var(--operational); height: 100%; }
.day-bar.degraded    { background: var(--degraded);    height: 70%; }
.day-bar.partial_outage { background: var(--partial);  height: 50%; }
.day-bar.major_outage   { background: var(--major);    height: 35%; }
.day-bar.maintenance    { background: var(--maintenance); height: 100%; }
.day-bar.no-data        { background: #e2e8f0;           height: 100%; }

.day-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 50;
  transition: opacity .15s;
}
.day-bar:hover .day-tooltip { opacity: 1; }

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Incident Cards ──────────────────────────────────────────────────────────── */
.incident-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.incident-card.active { border-left: 4px solid var(--major); }
.incident-card.maintenance-card { border-left: 4px solid var(--maintenance); }

.incident-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  gap: 12px;
}
.incident-header:hover { background: rgba(0,0,0,.015); }

.incident-title { font-size: 15px; font-weight: 600; }
.incident-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.incident-body {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: none;
}
.incident-body.open { display: block; }

.update-item {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.update-item:last-child { border-bottom: none; }

.update-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; min-width: 130px; }
.update-content { flex: 1; }
.update-message { font-size: 14px; }

.chevron { width: 16px; height: 16px; transition: transform .2s; flex-shrink: 0; }
.chevron.open { transform: rotate(180deg); }

/* ── Subscribe Box ───────────────────────────────────────────────────────────── */
.subscribe-box {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: var(--radius);
  padding: 32px;
  margin: 32px 0;
  color: #fff;
}

.subscribe-inner { max-width: 560px; }
.subscribe-box h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.subscribe-box p { font-size: 14px; opacity: .75; margin-bottom: 16px; }

.subscribe-form { display: flex; gap: 8px; flex-wrap: wrap; }
.subscribe-form input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 14px;
  outline: none;
}
.subscribe-form input::placeholder { color: rgba(255,255,255,.4); }
.subscribe-form input:focus { border-color: rgba(255,255,255,.5); }

.subscribe-form button {
  padding: 10px 20px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.subscribe-form button:hover { background: #4338ca; }

.subscribe-msg { margin-top: 10px; font-size: 13px; opacity: .85; }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 40px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 12px; opacity: .4; }

/* ── Skeleton Loader ─────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: -100% 0 } }

/* ── Day Modal ───────────────────────────────────────────────────────────────── */
.day-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.day-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.day-modal-box {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.day-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.day-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.day-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
}
.day-modal-close:hover { color: var(--text); }

.day-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.day-modal-empty {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 0 16px; }

  .overall-banner { padding: 18px 20px; gap: 14px; margin: 20px 0 18px; }
  .overall-banner h1 { font-size: 17px; }

  .section-title { margin: 24px 0 10px; }

  .timeline-row { padding: 12px 16px; }
  .timeline-bars { gap: 1px; }
  .day-bar { min-width: 0; }

  .service-card { padding: 12px 16px; }
  .service-name { font-size: 14px; }

  .subscribe-box { padding: 24px 20px; }

  .day-modal-box {
    max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
    align-self: flex-end;
    width: 100%;
  }
  .day-modal { align-items: flex-end; padding: 0; }
  .day-modal-header { padding: 16px 20px 14px; }
  .day-modal-body { padding: 16px 20px; }
}

@media (max-width: 600px) {
  .service-right { gap: 8px; }
  .uptime-pct { display: none; }

  .update-item { flex-direction: column; gap: 4px; }
  .update-time { min-width: unset; font-size: 11px; }

  .subscribe-box { padding: 20px 16px; }
  .subscribe-form { flex-direction: column; }
  .subscribe-form input { min-width: unset; width: 100%; }
  .subscribe-form button { width: 100%; justify-content: center; }

  .incident-header { padding: 12px 16px; }
  .incident-body { padding: 14px 16px; }
  .incident-title { font-size: 14px; }
}

@media (max-width: 400px) {
  .overall-banner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .overall-icon { width: 32px; height: 32px; }
  .overall-banner h1 { font-size: 16px; }

  .timeline-header { flex-direction: column; align-items: flex-start; gap: 2px; }
  .timeline-uptime { font-size: 12px; }

  .status-pill { font-size: 11px; padding: 3px 8px; }
}

/* Touch: Tooltips per Tap statt Hover (Modal übernimmt das bereits) */
@media (hover: none) {
  .day-bar:hover { opacity: 1; transform: none; }
  .day-bar:hover .day-tooltip { opacity: 0; }
  .day-bar:active { opacity: .75; }
  .service-card:hover { box-shadow: none; }
  .incident-header:hover { background: transparent; }
}
