/* ------------------------------------------------------------------------------
 *
 *  # WiFinCloud UI
 *
 *  Design tokens and small shared components layered on top of Limitless.
 *  Loaded globally after colors.css. Every class is prefixed `wfc-`, so nothing
 *  here changes existing pages until a view opts in.
 *  Usage and rules: docs/design/baseline.md
 *
 * ---------------------------------------------------------------------------- */

:root {
  /* Brand: Limitless teal, as used by the panel's highlighted nav and toolbars */
  --wfc-primary: #26a69a;
  --wfc-primary-strong: #00897b;
  --wfc-primary-soft: #e0f2f1;

  /* Neutrals */
  --wfc-text: #1e293b;
  --wfc-text-secondary: #475569;
  /* #64748b keeps 4.8:1 contrast on white; lighter greys were hard to read */
  --wfc-muted: #64748b;
  --wfc-border: #e2e8f0;
  --wfc-divider: #f1f5f9;
  --wfc-surface: #ffffff;
  --wfc-surface-soft: #f8fafc;

  /* Status */
  --wfc-success: #16a34a;
  --wfc-success-soft: #ecfdf5;
  --wfc-danger: #dc2626;
  --wfc-danger-soft: #fef2f2;
  --wfc-warning: #d97706;
  --wfc-warning-soft: #fffbeb;
  --wfc-info: #2563eb;
  --wfc-info-soft: #eff6ff;
  --wfc-neutral: #64748b;

  /* Type scale (Roboto, 13px base like the rest of the panel) */
  --wfc-fs-xs: 11px;
  --wfc-fs-sm: 12px;
  --wfc-fs-base: 13px;
  --wfc-fs-md: 15px;
  --wfc-fs-lg: 18px;
  --wfc-fs-xl: 26px;

  /* Spacing: 4px steps */
  --wfc-space-1: 4px;
  --wfc-space-2: 8px;
  --wfc-space-3: 12px;
  --wfc-space-4: 16px;
  --wfc-space-5: 20px;
  --wfc-space-6: 24px;

  --wfc-radius-sm: 4px;
  --wfc-radius: 8px;
  --wfc-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
}

/* Label: the small uppercase caption used above values and sections */
.wfc-label {
  color: var(--wfc-muted);
  font-size: var(--wfc-fs-xs);
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
}

/* Identifiers such as MAC addresses: same font, fixed-width digits */
.wfc-mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* Badge: status pills. Soft background, strong text. */
.wfc-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--wfc-space-1);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--wfc-surface-soft);
  color: var(--wfc-neutral);
  font-size: var(--wfc-fs-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.wfc-badge--success { background: var(--wfc-success-soft); color: var(--wfc-success); }
.wfc-badge--danger { background: var(--wfc-danger-soft); color: var(--wfc-danger); }
.wfc-badge--warning { background: var(--wfc-warning-soft); color: var(--wfc-warning); }
.wfc-badge--info { background: var(--wfc-info-soft); color: var(--wfc-info); }
.wfc-badge--primary { background: var(--wfc-primary-soft); color: var(--wfc-primary-strong); }

/* Avatar: initials on brand-soft */
.wfc-avatar {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--wfc-primary-soft);
  color: var(--wfc-primary-strong);
  font-size: var(--wfc-fs-md);
  font-weight: 700;
}

/* Stat strip: a row of equal cells, label over value */
.wfc-stats {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  border: 1px solid var(--wfc-border);
  border-radius: var(--wfc-radius-sm);
  background: var(--wfc-surface);
  text-align: center;
}

.wfc-stat {
  min-width: 0;
  padding: var(--wfc-space-3) var(--wfc-space-4);
}

.wfc-stat + .wfc-stat { border-left: 1px solid var(--wfc-border); }

.wfc-stat-value {
  margin-bottom: 2px;
  overflow: hidden;
  color: var(--wfc-text);
  font-size: var(--wfc-fs-md);
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Field list: label / value pairs in a two-column grid */
.wfc-fields {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--wfc-space-2) var(--wfc-space-4);
  margin: 0;
}

.wfc-fields dt,
.wfc-fields dd {
  margin: 0;
}

.wfc-fields dt {
  color: var(--wfc-muted);
  font-size: var(--wfc-fs-sm);
  font-weight: 400;
  line-height: 20px;
}

.wfc-fields dd {
  min-width: 0;
  color: var(--wfc-text);
  font-size: var(--wfc-fs-base);
  line-height: 20px;
  word-break: break-word;
}

.wfc-fields dd .wfc-badge { margin-left: var(--wfc-space-2); vertical-align: 1px; }

/* Section: titled block with a divider above */
.wfc-section { padding: var(--wfc-space-4) var(--wfc-space-6); }
.wfc-section + .wfc-section { border-top: 1px solid var(--wfc-divider); }

.wfc-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--wfc-space-2);
  margin-bottom: var(--wfc-space-3);
}

.wfc-section-meta { color: var(--wfc-muted); font-size: var(--wfc-fs-sm); }

/* List rows: icon, main text with a muted second line, right-aligned meta */
.wfc-list { margin: 0; padding: 0; list-style: none; }

.wfc-list-item {
  display: flex;
  align-items: center;
  gap: var(--wfc-space-3);
  padding: var(--wfc-space-2) 0;
}

.wfc-list-item + .wfc-list-item { border-top: 1px solid var(--wfc-divider); }

.wfc-list-icon {
  display: inline-flex;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--wfc-radius);
  background: var(--wfc-surface-soft);
  color: var(--wfc-neutral);
  font-size: 14px;
}

.wfc-list-body { flex: 1; min-width: 0; }

.wfc-list-title {
  color: var(--wfc-text);
  font-size: var(--wfc-fs-base);
  font-weight: 500;
  line-height: 1.4;
}

.wfc-list-sub {
  color: var(--wfc-muted);
  font-size: var(--wfc-fs-sm);
  line-height: 1.4;
}

.wfc-list-meta {
  flex: 0 0 auto;
  color: var(--wfc-text-secondary);
  font-size: var(--wfc-fs-sm);
  text-align: right;
}

.wfc-empty {
  padding: var(--wfc-space-4) 0;
  color: var(--wfc-muted);
  font-size: var(--wfc-fs-base);
  text-align: center;
}

/* Buttons: quiet destructive action, for use beside btn-default */
.btn.wfc-btn-danger-quiet {
  border-color: var(--wfc-border);
  background: var(--wfc-surface);
  color: var(--wfc-danger);
}

.btn.wfc-btn-danger-quiet:hover,
.btn.wfc-btn-danger-quiet:focus {
  border-color: #fecaca;
  background: var(--wfc-danger-soft);
  color: var(--wfc-danger);
}

@media (max-width: 640px) {
  .wfc-section { padding: var(--wfc-space-3) var(--wfc-space-4); }
  .wfc-fields { grid-template-columns: 1fr; gap: 0; }
  .wfc-fields dd { margin-bottom: var(--wfc-space-2); }
  .wfc-stat { padding: var(--wfc-space-2) var(--wfc-space-3); }
  .wfc-stat-value { font-size: var(--wfc-fs-base); white-space: normal; }
  .wfc-list-item { flex-wrap: wrap; }
  .wfc-list-meta { flex-basis: 100%; text-align: left; }
  .wfc-list-icon ~ .wfc-list-meta { padding-left: 44px; }
}

/* Panel shell: the phone-width navbar menu (#navbar-mobile, Bootstrap collapse below 768px).
   Align every row to the same 20px gutter as the user row. */
@media (max-width: 767px) {
  #navbar-mobile .navbar-text {
    margin: 0;
    padding: var(--wfc-space-3) 20px;
    text-align: left;
  }

  #navbar-mobile .dropdown-domain-selection {
    padding: var(--wfc-space-3) 20px;
    border-top: 1px solid var(--wfc-border);
  }

  #navbar-mobile .dropdown-domain-selection .select2-container {
    width: 100% !important;
  }
}
