/* vps-usage.css
 * The LeaseWeb Usage and System panels.
 *
 * A LeaseWeb VPS has no provider API behind it, so these two panels render
 * figures read off the box itself: vnStat's transfer history, and a system
 * report gathered over SSH. Everything else on the VPS console is shared with
 * the Linode and DigitalOcean panels and styled in client.css — only the parts
 * with no equivalent there live here.
 *
 * Colours reuse the console's existing palette (slate on near-black, the same
 * inbound/outbound pairing the Network panel uses) so the new tabs read as part
 * of the same screen rather than a bolt-on.
 */

.vps-usage-panel,
.vps-system-panel {
  display: grid;
  gap: 16px;
}

/* --- Setup states -------------------------------------------------------- */

/* Shown while the traffic counter is being installed, or when it could not be.
 * Deliberately quiet: on a newly assigned VPS this is the expected state for a
 * few minutes and should not read as a fault. */
.vps-usage-setup {
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(2, 6, 23, 0.38);
}

.vps-usage-setup h4 {
  margin: 0 0 6px;
  color: #f8fafc;
  font-size: 0.95rem;
}

.vps-usage-setup p {
  margin: 0;
  color: rgba(203, 213, 225, 0.78);
  font-size: 0.85rem;
  line-height: 1.5;
}

.vps-usage-setup .btn {
  margin-top: 12px;
}

.vps-usage-setup.is-working {
  border-color: rgba(56, 189, 248, 0.28);
  background: rgba(8, 47, 73, 0.35);
}

.vps-usage-setup.is-blocked {
  border-color: rgba(248, 113, 113, 0.32);
  background: rgba(69, 10, 10, 0.32);
}

/* --- Daily transfer chart ------------------------------------------------ */

.vps-usage-charts h4,
.vps-usage-months h4,
.vps-system-block h4 {
  margin: 0 0 10px;
  color: #e2e8f0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.usage-chart {
  display: grid;
  gap: 8px;
}

.usage-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.42);
  /* A month of bars on a phone is narrower than a finger; scrolling beats
   * squashing them into invisibility. */
  overflow-x: auto;
}

.usage-bar {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 6px;
  height: 100%;
}

.usage-bar span {
  display: block;
  flex: 1 1 50%;
  border-radius: 2px 2px 0 0;
  /* A day with traffic too small to see is still a day with traffic, so every
   * bar keeps a visible floor. */
  min-height: 2px;
  transition: height 0.2s ease;
}

.usage-bar-out {
  background: linear-gradient(180deg, #38bdf8, #0284c7);
}

.usage-bar-in {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.7), rgba(100, 116, 139, 0.5));
}

.usage-chart-axis {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: rgba(148, 163, 184, 0.78);
  font-size: 0.72rem;
}

/* --- Monthly totals and system lists ------------------------------------- */

.vps-usage-months ul,
.vps-system-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vps-usage-months li,
.vps-system-list li {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(2, 6, 23, 0.32);
  font-size: 0.82rem;
}

.vps-usage-months li span,
.vps-system-list li span {
  color: #e2e8f0;
  font-weight: 600;
  /* Process names and mount points can be long; they truncate rather than
   * pushing the numbers off the row. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vps-usage-months li em,
.vps-system-list li em {
  color: rgba(203, 213, 225, 0.8);
  font-style: normal;
  text-align: right;
}

.vps-system-block {
  display: grid;
  gap: 8px;
}

/* --- Listening ports ----------------------------------------------------- */

.vps-system-ports {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* An internet-reachable port is the default look; a loopback-only one is
 * deliberately dimmer, because "this is exposed" is the fact worth noticing. */
.vps-system-port {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.32);
  background: rgba(8, 47, 73, 0.38);
  color: #bae6fd;
  font-size: 0.76rem;
  font-weight: 700;
}

.vps-system-port.is-local {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.42);
  color: rgba(203, 213, 225, 0.72);
}

/* Power controls belong to the provider on a hand-assigned VPS, so the card
 * that would hold them explains itself instead of sitting empty. */
.vps-power-card.is-unavailable {
  display: block;
  padding: 12px 14px;
}

.vps-power-card.is-unavailable p {
  margin: 0;
}

@media (max-width: 640px) {
  .vps-usage-months li,
  .vps-system-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .vps-usage-months li em:last-child,
  .vps-system-list li em:last-child {
    grid-column: 2;
  }
}
