/**
 * CNM Utility Classes
 * Helper premium per componenti specifici del gestionale
 */

/* ─── Glass Panel (frosted glass con refrazione) ─── */
.cnm-glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 4px 6px -1px rgba(15, 23, 42, 0.04);
}
.cnm-glass-dark {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ─── KPI / Numeri cockpit ─── */
.cnm-kpi {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.cnm-kpi-lg {
  font-size: 2.25rem;
}
.cnm-kpi-md {
  font-size: 1.5rem;
}
.cnm-kpi-sm {
  font-size: 1.125rem;
}
.cnm-kpi-label {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cnm-text-muted);
}

/* ─── Hairline borders ─── */
.cnm-hairline-top {
  border-top: 1px solid var(--cnm-border);
}
.cnm-hairline-bottom {
  border-bottom: 1px solid var(--cnm-border);
}
.cnm-hairline-left {
  border-left: 1px solid var(--cnm-border);
}
.cnm-hairline-right {
  border-right: 1px solid var(--cnm-border);
}

/* ─── Status Badges (WCAG AA compliant backgrounds + text) ─── */
.cnm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35em 0.65em;
  border-radius: var(--radius-sm);
  line-height: 1;
  white-space: nowrap;
}
.cnm-badge-success {
  background-color: #dcfce7;
  color: #14532d;
}
.cnm-badge-danger {
  background-color: #fee2e2;
  color: #7f1d1d;
}
.cnm-badge-warning {
  background-color: #fef3c7;
  color: #78350f;
}
.cnm-badge-info {
  background-color: #dbeafe;
  color: #1e3a8a;
}
.cnm-badge-neutral {
  background-color: #f1f5f9;
  color: #475569;
}

/* Outline badges */
.cnm-badge-outline-success {
  background-color: transparent;
  border: 1px solid #86efac;
  color: #14532d;
}
.cnm-badge-outline-danger {
  background-color: transparent;
  border: 1px solid #fca5a5;
  color: #7f1d1d;
}

/* ─── Avatar / Initials ─── */
.cnm-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-full);
  background-color: #e2e8f0;
  color: var(--cnm-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
}
.cnm-avatar-sm {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.75rem;
}
.cnm-avatar-lg {
  width: 3rem;
  height: 3rem;
  font-size: 1.125rem;
}

/* ─── Sidebar nav link active state ─── */
.cnm-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: all 0.15s ease;
  text-decoration: none;
}
.cnm-nav-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}
.cnm-nav-link.active {
  background-color: rgba(234, 88, 12, 0.15);
  color: #fb923c;
  font-weight: 600;
}
.cnm-nav-link.active .bi {
  color: #fb923c;
}

/* ─── Topbar ─── */
.cnm-topbar {
  background-color: var(--cnm-surface);
  border-bottom: 1px solid var(--cnm-border);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* ─── Empty state ─── */
.cnm-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--cnm-text-muted);
}
.cnm-empty .bi {
  font-size: 3rem;
  color: var(--cnm-border-strong);
  margin-bottom: var(--space-md);
}
.cnm-empty h5 {
  color: var(--cnm-text-secondary);
  font-size: 1rem;
}

/* ─── Section header ─── */
.cnm-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--cnm-border);
}
.cnm-section-header h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

/* ─── Touch target (operaio) ─── */
.cnm-touch-target {
  min-height: 56px;
  min-width: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ─── Focus visible ring universal ─── */
*:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* ─── Smooth transitions ─── */
.cnm-transition {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Table actions ─── */
.cnm-table-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.cnm-table-actions .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
}

/* ─── PIN Display ─── */
.cnm-pin-display {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: 0.75rem;
  color: var(--cnm-text);
  min-height: 3rem;
  text-align: center;
}

/* ─── Operaio bottom nav active ─── */
.cnm-bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.6875rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.5rem;
  min-width: 56px;
  transition: color 0.15s ease;
}
.cnm-bottom-nav-link .bi {
  font-size: 1.25rem;
}
.cnm-bottom-nav-link:hover,
.cnm-bottom-nav-link:focus {
  color: #ffffff;
}
.cnm-bottom-nav-link.active {
  color: #fb923c;
}
