/* ════════════════════════════════════════════════════════════════
   Billtonic Status Page — style.css
   Diseño inspirado en status.brevo.com
   ════════════════════════════════════════════════════════════════ */

/* ─── Variables ─────────────────────────────────────────────────── */
:root {
  --bt-green:       #0bba83;
  --bt-green-light: #e6f9f3;
  --bt-yellow:      #f5a623;
  --bt-yellow-light:#fff8ec;
  --bt-orange:      #f07b30;
  --bt-orange-light:#fff1e6;
  --bt-red:         #e0433a;
  --bt-red-light:   #fdf0ef;
  --bt-blue:        #3b82f6;
  --bt-blue-light:  #eff6ff;
  --bt-gray:        #d1d5db;
  --bt-gray-light:  #f9fafb;

  --bt-text:        #1a1f36;
  --bt-text-muted:  #6b7280;
  --bt-border:      #e5e7eb;
  --bt-bg:          #f6f8fa;
  --bt-white:       #ffffff;

  --bt-header-bg:   #0f172a;
  --bt-header-text: #f8fafc;

  --bt-radius:      10px;
  --bt-radius-sm:   6px;
  --bt-shadow:      0 1px 4px rgba(0,0,0,.07);
  --bt-shadow-md:   0 4px 16px rgba(0,0,0,.10);

  --day-width:      6px;
  --day-height:     30px;
  --day-gap:        2px;
  --day-radius:     3px;
}

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

body {
  background-color: var(--bt-bg);
  color: var(--bt-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout (container más estrecho que el de Bootstrap) ─────────── */
@media (min-width: 576px)  { .container { max-width: 420px; } }
@media (min-width: 768px)  { .container { max-width: 600px; } }
@media (min-width: 992px)  { .container { max-width: 720px; } }
@media (min-width: 1200px) { .container { max-width: 760px; } }
@media (min-width: 1400px) { .container { max-width: 800px; } }

/* ─── Header ────────────────────────────────────────────────────── */
.bt-header {
  background: var(--bt-header-bg);
  color: var(--bt-header-text);
  padding: 0.875rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.bt-logo-link {
  text-decoration: none;
  color: var(--bt-header-text);
}

.bt-logo-img {
  height: 26px;
  display: block;
}

.bt-header-sep {
  color: rgba(255,255,255,.25);
  font-size: 1.1rem;
}

.bt-header-subtitle {
  color: rgba(255,255,255,.6);
  font-size: 0.875rem;
}

.bt-nav-link {
  color: rgba(255,255,255,.65);
  font-size: 0.8125rem;
  transition: color .15s;
}
.bt-nav-link:hover { color: #fff; text-decoration: none; }

/* ─── Banner global ─────────────────────────────────────────────── */
.bt-banner {
  padding: 1.125rem 0;
  border-bottom: 1px solid transparent;
}

.bt-banner .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bt-banner-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.bt-banner-text {
  font-weight: 600;
  font-size: 1.05rem;
}

.bt-banner-date {
  font-size: 0.8rem;
  opacity: .75;
}

/* Banner variants */
.banner-ok          { background: var(--bt-green-light);  color: #065f46; border-color: #a7f3d0; }
.banner-degraded    { background: var(--bt-yellow-light); color: #78350f; border-color: #fde68a; }
.banner-partial     { background: var(--bt-orange-light); color: #7c2d12; border-color: #fed7aa; }
.banner-major       { background: var(--bt-red-light);    color: #7f1d1d; border-color: #fecaca; }
.banner-maintenance { background: var(--bt-blue-light);   color: #1e3a5f; border-color: #bfdbfe; }
.banner-unknown     { background: #f3f4f6;                color: #374151; border-color: var(--bt-border); }

/* ─── Main ──────────────────────────────────────────────────────── */
.bt-main {
  flex: 1;
  padding: 2rem 0 3rem;
}

/* ─── Secciones ─────────────────────────────────────────────────── */
.bt-section {
  margin-bottom: 2.5rem;
}

.bt-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bt-text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--bt-border);
}

/* ─── Acordeón ──────────────────────────────────────────────────── */
.bt-accordion {
  border-radius: var(--bt-radius);
  overflow: hidden;
  box-shadow: var(--bt-shadow);
  border: 1px solid var(--bt-border);
}

.bt-accordion-item {
  border: none;
  border-bottom: 1px solid var(--bt-border);
  background: var(--bt-white);
}
.bt-accordion-item:last-child { border-bottom: none; }

.bt-accordion-btn {
  background: var(--bt-white) !important;
  color: var(--bt-text) !important;
  padding: 1rem 1.25rem;
  box-shadow: none !important;
  font-size: 0.9375rem;
}

.bt-accordion-btn:not(.collapsed) {
  background: #fafbfd !important;
}

.bt-accordion-btn::after {
  filter: none;
  opacity: .5;
}

/* cabecera interna del botón del acordeón */
.bt-svc-header {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.bt-svc-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bt-badge-primary {
  background: var(--bt-blue-light);
  color: var(--bt-blue);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2em 0.55em;
  border-radius: 20px;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bt-svc-status-label {
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

/* etiquetas de color para estado */
.bt-label-operational  { color: var(--bt-green);  }
.bt-label-degraded     { color: var(--bt-yellow); }
.bt-label-partial      { color: var(--bt-orange); }
.bt-label-major        { color: var(--bt-red);    }
.bt-label-maintenance  { color: var(--bt-blue);   }
.bt-label-unknown      { color: var(--bt-text-muted); }

.bt-accordion-body {
  padding: 1.25rem 1.25rem 1.5rem;
  background: #fafbfd;
}

.bt-svc-desc {
  font-size: 0.875rem;
  color: var(--bt-text-muted);
  margin-bottom: 1rem;
}

/* ─── Punto de estado ────────────────────────────────────────────── */
.bt-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.bt-dot-operational  { background: var(--bt-green);  }
.bt-dot-degraded     { background: var(--bt-yellow); }
.bt-dot-partial      { background: var(--bt-orange); }
.bt-dot-major        { background: var(--bt-red);    }
.bt-dot-maintenance  { background: var(--bt-blue);   }
.bt-dot-unknown      { background: var(--bt-gray);   }

/* ─── Heatmap ───────────────────────────────────────────────────── */
.bt-history-wrap {
  margin-bottom: 1.25rem;
}

.bt-history-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--bt-text-muted);
}

.bt-history-footer .bt-history-uptime {
  text-align: center;
  white-space: nowrap;
}

.bt-history-footer .bt-history-uptime strong {
  color: var(--bt-text);
}

.bt-history-footer .bt-history-today {
  text-align: right;
}

.bt-heatmap {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--day-gap);
}

.bt-day {
  display: inline-block;
  width: var(--day-width);
  height: var(--day-height);
  border-radius: var(--day-radius);
  flex-shrink: 0;
  cursor: pointer;
  transition: filter .1s;
}

.bt-heatmap .bt-day {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

.bt-day:hover {
  filter: brightness(0.75);
}

/* colores de días */
.bt-day-operational  { background: var(--bt-green);  }
.bt-day-degraded     { background: var(--bt-yellow); }
.bt-day-partial      { background: var(--bt-orange); }
.bt-day-major        { background: var(--bt-red);    }
.bt-day-maintenance  { background: var(--bt-blue);   }
.bt-day-unknown      { background: var(--bt-gray);   }

/* ─── Popover del heatmap ───────────────────────────────────────────── */
.bt-day-popover {
  position: fixed;
  z-index: 1050;
  width: 260px;
  background: #fdfbf6;
  border: 1px solid var(--bt-border);
  border-radius: var(--bt-radius-sm);
  box-shadow: var(--bt-shadow-md);
  padding: 0.9rem 1rem;
  font-size: 0.8125rem;
  color: var(--bt-text);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
}

.bt-day-popover.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.bt-day-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  left: var(--arrow-left, 50%);
  width: 11px;
  height: 11px;
  background: #fdfbf6;
  border-left: 1px solid var(--bt-border);
  border-top: 1px solid var(--bt-border);
  transform: translateX(-50%) rotate(45deg);
}

.bt-day-popover.bt-day-popover-flip::before {
  top: auto;
  bottom: -6px;
  border-left: none;
  border-top: none;
  border-right: 1px solid var(--bt-border);
  border-bottom: 1px solid var(--bt-border);
}

.bt-day-popover-date {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.55rem;
}

.bt-day-popover-headline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.bt-day-popover-icon { font-size: 0.85rem; line-height: 1; flex-shrink: 0; }
.bt-day-popover-icon-degraded    { color: var(--bt-yellow); }
.bt-day-popover-icon-partial     { color: var(--bt-orange); }
.bt-day-popover-icon-major       { color: var(--bt-red);    }
.bt-day-popover-icon-maintenance { color: var(--bt-blue);   }

.bt-day-popover-label {
  font-weight: 600;
  flex: 1;
}

.bt-day-popover-duration {
  color: var(--bt-text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.bt-day-popover-related {
  margin-top: 0.65rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--bt-border);
}

.bt-day-popover-related-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--bt-text-muted);
  margin-bottom: 0.4rem;
}

.bt-day-popover-related-item {
  font-size: 0.78rem;
  color: var(--bt-text);
  margin-bottom: 0.35rem;
}
.bt-day-popover-related-item:last-child { margin-bottom: 0; }

.bt-day-popover-empty {
  color: var(--bt-text-muted);
  font-size: 0.8rem;
}

.bt-heatmap-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
}

.bt-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--bt-text-muted);
}

.bt-legend-item .bt-day {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ─── Incidencias ───────────────────────────────────────────────── */
.bt-incidents {
  border-top: 1px solid var(--bt-border);
  padding-top: 1rem;
  margin-top: 0.25rem;
}

.bt-incidents-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--bt-text-muted);
  margin-bottom: 0.75rem;
}

.bt-incident,
.bt-incident-global {
  border-radius: var(--bt-radius-sm);
  border: 1px solid var(--bt-border);
  background: var(--bt-white);
  padding: 0.875rem 1rem;
  margin-bottom: 0.75rem;
}

.bt-incident:last-child,
.bt-incident-global:last-child { margin-bottom: 0; }

.bt-incident-global {
  box-shadow: var(--bt-shadow);
}

/* borde izquierdo según estado incidencia */
.bt-incident-investigating { border-left: 4px solid var(--bt-red);    }
.bt-incident-identified    { border-left: 4px solid var(--bt-orange); }
.bt-incident-monitoring    { border-left: 4px solid var(--bt-yellow); }
.bt-incident-resolved      { border-left: 4px solid var(--bt-green);  }

.bt-incident-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.bt-incident-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.bt-incident-desc {
  font-size: 0.8375rem;
  color: var(--bt-text-muted);
  margin-bottom: 0.4rem;
  margin-top: 0.25rem;
}

.bt-incident-date {
  font-size: 0.78rem;
  color: var(--bt-text-muted);
  white-space: nowrap;
}

.bt-incident-resolved {
  font-size: 0.8rem;
  color: var(--bt-text-muted);
  margin-top: 0.25rem;
}

/* badges de severidad */
.bt-severity-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 0.2em 0.55em;
  border-radius: 20px;
}
.bt-severity-degradado     { background: #fffbeb; color: #92400e; }
.bt-severity-parcial       { background: #fff7ed; color: #9a3412; }
.bt-severity-critico       { background: #fef2f2; color: #7f1d1d; }
.bt-severity-mantenimiento { background: var(--bt-blue-light); color: #1e3a5f; }

/* badges de estado de incidencia */
.bt-incident-status-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2em 0.55em;
  border-radius: 20px;
}
.bt-inc-investigating { background: #fef2f2; color: var(--bt-red);    }
.bt-inc-identified    { background: #fff7ed; color: var(--bt-orange); }
.bt-inc-monitoring    { background: #fffbeb; color: var(--bt-yellow); }
.bt-inc-resolved      { background: #f0fdf4; color: var(--bt-green);  }

/* tag de servicio en incidencias globales */
.bt-svc-tag {
  font-size: 0.75rem;
  background: var(--bt-gray-light);
  border: 1px solid var(--bt-border);
  border-radius: 20px;
  padding: 0.15em 0.6em;
  color: var(--bt-text-muted);
  white-space: nowrap;
}

/* ─── Footer ────────────────────────────────────────────────────── */
.bt-footer {
  background: var(--bt-white);
  border-top: 1px solid var(--bt-border);
  padding: 1.125rem 0;
  font-size: 0.8125rem;
  color: var(--bt-text-muted);
}

.bt-footer-link {
  color: var(--bt-text-muted);
  transition: color .15s;
}
.bt-footer-link:hover { color: var(--bt-text); text-decoration: none; }

/* ─── Tooltips de Bootstrap (ajuste) ────────────────────────────── */
.tooltip-inner {
  font-size: 0.75rem;
  max-width: 220px;
  text-align: left;
}

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .bt-svc-header { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .bt-svc-status-label { display: none; }
  .bt-banner .container { flex-direction: column; align-items: flex-start; }
  :root { --day-height: 34px; --day-gap: 3px; }
  .bt-day:not(.bt-day-recent) { display: none; }
  .bt-incident:not(.bt-incident-recent) { display: none; }
}
