/* Hide Glance branding footer and trim main's built-in bottom padding to
   reclaim the last ~27px needed for a true one-viewport fit (no page scroll) */
.footer {
  display: none;
}

main {
  padding-bottom: 0 !important;
}

.head-widgets {
  margin-bottom: 19px !important;
}

/* Docker head-widget already shows its own "N containers" summary line;
   the native "DOCKER" title above it is redundant and costs 22px+ of height. */
.head-widgets .widget-header {
  display: none;
}

/* Docker Status widget (head-widget, full-width) */

.docker-summary {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0.5rem 0 0.75rem;
  border-bottom: 1px solid var(--color-separator, rgba(255, 255, 255, 0.1));
  margin-bottom: 0.75rem;
}

.docker-stat {
  font-size: var(--font-size-base); /* was 0.85rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
}

.docker-stat b {
  color: var(--color-text-base, #fff);
}

.docker-stat-ok b {
  color: var(--color-positive, #4caf50);
}

.docker-stat-crit b {
  color: var(--color-negative, #f44336);
}

.docker-filter {
  cursor: pointer;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  margin: -0.15rem -0.4rem;
  transition: background-color 0.15s ease;
}

.docker-filter:hover {
  background: rgba(128, 128, 128, 0.15);
}

.docker-filter-active {
  background: rgba(128, 128, 128, 0.22);
  outline: 1px solid rgba(128, 128, 128, 0.35);
}

.docker-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-separator, rgba(255, 255, 255, 0.1));
}

.docker-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  margin: -0.15rem -0.4rem;
  font-size: var(--font-size-h6);
  color: var(--color-text-subdue, #9aa0a6);
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.docker-legend-item:hover {
  background: rgba(128, 128, 128, 0.15);
}

.docker-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--group-color, #888);
}

.docker-legend-count {
  color: var(--color-text-base, #fff);
  font-variant-numeric: tabular-nums;
}

/* Toggling any group on dims the ones not selected, same convention as a
   chart legend — no group active means "show everything" (handled in JS). */
.docker-legend:has(.docker-legend-active) .docker-legend-item:not(.docker-legend-active) {
  opacity: 0.4;
}

.docker-legend-active {
  background: rgba(128, 128, 128, 0.18);
}

/* Shared "card carousel" grid: fixed-size cards (not 1fr-elastic), 2 rows,
   horizontal scroll beyond what fits. Used by both the Docker and
   Pterodactyl widgets so their cards read as the same visual language.
   Width/height are set in px (not cqw/%) specifically so card size stays
   constant regardless of (a) how many cards are currently visible after
   filtering — 1fr/cqw both redistribute freed space into remaining cards,
   stretching them — and (b) how wide the containing column happens to be.
   Number of visible columns is however-many-fit, not a fixed count. */
.card-carousel {
  display: grid;
  grid-template-rows: repeat(2, var(--card-carousel-row-h, 82px));
  grid-auto-flow: column;
  grid-auto-columns: var(--card-carousel-col-w, 186px);
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.docker-grid {
  --card-carousel-col-w: 186px;
  --card-carousel-row-h: 82px;
}

.ptero-grid {
  --card-carousel-col-w: 186px;
  --card-carousel-row-h: 96px;
}

.docker-card,
.ptero-card {
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.4rem;
  border: 1px solid rgba(128, 128, 128, 0.28);
  background: rgba(128, 128, 128, 0.11);
  transition: filter 0.15s ease;
}

/* Uniform hover "veil" across every card type regardless of its own base
   color (grey Docker groups, orange Pterodactyl) — brightness() lightens
   whatever's already there instead of overriding with a hardcoded tint,
   so it looks the same everywhere without duplicating each card's palette. */
.docker-card:hover,
.ptero-card:hover {
  filter: brightness(1.35);
}

/* ponytail: backend emits Group-cased names (Homelab/Stremio/Pterodactyl) and
   Glance's custom-api template has no lower/toLower function, so match the
   class on the exact casing the backend sends instead of adding one.
   --group-color is set here once per group and reused by both the card
   background/border and the legend swatch below, so the palette lives in
   one place instead of being duplicated as hex values in two rulesets.
   The generic fallback must come first — later same-specificity rules win,
   and every named group's own selector also matches [class*="docker-group-"]. */
[class*="docker-group-"] {
  --group-color: #888; /* groups outside docker_groups config, e.g. "base", "Other" */
}

.docker-group-Homelab {
  --group-color: #3b82f6;
}

.docker-group-Stremio {
  --group-color: #a855f7;
}

.docker-group-Pterodactyl {
  --group-color: #f97316;
}

.docker-card[class*="docker-group-"] {
  background: color-mix(in srgb, var(--group-color) 11%, transparent);
  border-color: color-mix(in srgb, var(--group-color) 28%, transparent);
}

.docker-card-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.docker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.docker-dot-ok {
  background: var(--color-positive, #4caf50);
}

.docker-dot-warn {
  background: #f5a623;
}

.docker-dot-off {
  background: #888;
}

.docker-name {
  font-size: var(--font-size-base); /* was 0.82rem @16px-assumed root */
  font-weight: 600;
  color: var(--color-text-base, #fff);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.docker-uptime {
  font-size: var(--font-size-h6); /* was 0.72rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
  flex-shrink: 0;
  margin-left: auto;
}

.docker-spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
}

.docker-spark i {
  flex: 1;
  min-width: 2px;
  background: var(--color-primary, #4caf50);
  opacity: 0.35;
  border-radius: 1px;
}

.docker-spark i:last-child {
  opacity: 1;
}

.docker-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-h6); /* was 0.72rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
}

.docker-pct {
  font-variant-numeric: tabular-nums;
}

.docker-group-label {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.8;
}

/* Services / fail2ban / MariaDB / Timers / sync-domains widgets (Task 13) */

.svc-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--font-size-base); /* was 0.82rem @16px-assumed root */
  color: var(--color-text-base, #fff);
  padding: 0.2rem 0;
}

.svc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.svc-dot-active {
  background: var(--color-positive, #4caf50);
}

.svc-dot-inactive,
.svc-dot-failed {
  background: var(--color-negative, #f44336);
}

.svc-dot-unknown {
  background: #888;
}

.f2b-stat {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.f2b-n {
  font-size: var(--font-size-h1); /* was 1.4rem @16px-assumed root, this is the big fail2ban counter */
  font-weight: 600;
  color: var(--color-text-base, #fff);
}

.f2b-label {
  font-size: var(--font-size-h6); /* was 0.78rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
}

.f2b-meta {
  font-size: var(--font-size-h6); /* was 0.78rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
  line-height: 1.6;
}

.f2b-meta b {
  color: var(--color-text-base, #fff);
  font-weight: 600;
}

.db-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-base); /* was 0.82rem @16px-assumed root */
  padding: 0.2rem 0;
}

.db-k {
  color: var(--color-text-subdue, #9aa0a6);
}

.db-v {
  color: var(--color-text-base, #fff);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.timer-row {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-separator, rgba(255, 255, 255, 0.1));
}

.timer-row:last-child {
  border-bottom: none;
}

.timer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.timer-name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--font-size-base); /* was 0.82rem @16px-assumed root */
  font-weight: 600;
  color: var(--color-text-base, #fff);
}

.timer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.timer-dot-active {
  background: var(--color-positive, #4caf50);
}

.timer-dot-failed {
  background: var(--color-negative, #f44336);
}

.timer-dot-inactive,
.timer-dot-unknown {
  background: #888;
}

.timer-next {
  font-size: var(--font-size-h6); /* was 0.72rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
  flex-shrink: 0;
}

.timer-foot {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-h6); /* was 0.72rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
  margin-top: 0.2rem;
}

.cron-status-banner {
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: var(--font-size-base); /* was 0.82rem @16px-assumed root */
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.cron-status-ok {
  background: color-mix(in srgb, var(--color-positive, #4caf50) 15%, transparent);
  color: var(--color-positive, #4caf50);
}

.cron-status-failed {
  background: color-mix(in srgb, var(--color-negative, #f44336) 15%, transparent);
  color: var(--color-negative, #f44336);
}

.cron-status-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #888;
}

.cron-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-h6); /* was 0.78rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
  padding: 0.15rem 0;
}

.cron-detail-row b {
  color: var(--color-text-base, #fff);
  font-weight: 600;
}

/* Pterodactyl widget (Task 14) */

.ptero-summary {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-separator, rgba(255, 255, 255, 0.1));
}

.ptero-stat {
  font-size: var(--font-size-base); /* was 0.85rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
}

.ptero-stat b {
  color: var(--color-text-base, #fff);
}

.ptero-stat-ok b {
  color: var(--color-positive, #4caf50);
}

.ptero-stat-off b {
  color: #888;
}

/* .ptero-grid itself is the scrollable carousel now (shares .card-carousel
   with Docker's grid — see the shared rule above), so no separate
   .ptero-carousel-wrap sizing is needed. */
.ptero-card {
  scroll-snap-align: start;
  gap: 0.35rem;
  border: 1px solid color-mix(in srgb, #f97316 28%, transparent);
  background: color-mix(in srgb, #f97316 11%, transparent);
}

.ptero-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ptero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ptero-dot-running {
  background: var(--color-positive, #4caf50);
}

.ptero-dot-starting {
  background: #f5a623;
}

.ptero-dot-offline {
  background: #888;
}

.ptero-name {
  font-size: var(--font-size-base); /* was 0.82rem @16px-assumed root */
  font-weight: 600;
  color: var(--color-text-base, #fff);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.ptero-status-word {
  font-size: var(--font-size-h6); /* was 0.72rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ptero-res-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--font-size-h6); /* was 0.7rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
}

.ptero-res-row-mem {
  justify-content: space-between;
}

.ptero-res-label {
  width: 24px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.ptero-res-track {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: rgba(128, 128, 128, 0.2);
  overflow: hidden;
}

.ptero-res-fill {
  height: 100%;
  background: var(--color-primary, #4caf50);
}

.ptero-res-val {
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  width: 3.2rem;
  text-align: right;
}

.ptero-bottom {
  display: flex;
  justify-content: flex-end;
  font-size: var(--font-size-h6); /* was 0.72rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
}

/* Stremio widget (Task 14) */

.stremio-primary {
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-separator, rgba(255, 255, 255, 0.1));
}

.stremio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stremio-name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--font-size-h5); /* was 0.9rem @16px-assumed root */
  font-weight: 600;
  color: var(--color-text-base, #fff);
}

.stremio-badge {
  font-size: var(--font-size-h6); /* was 0.72rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
  font-variant-numeric: tabular-nums;
}

.stremio-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stremio-dot-ok {
  background: var(--color-positive, #4caf50);
}

.stremio-dot-down,
.stremio-dot-error {
  background: var(--color-negative, #f44336);
}

.stremio-addon-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stremio-addon-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--font-size-base); /* was 0.8rem @16px-assumed root */
}

.stremio-addon-name {
  color: var(--color-text-base, #fff);
  flex: 1;
}

.stremio-check-src {
  font-size: var(--font-size-h6); /* was 0.68rem @16px-assumed root */
  color: var(--color-text-subdue, #9aa0a6);
}
