/* Indicatori riutilizzabili per account e sincronizzazione. */

.sync-status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.sync-status-pill--local,
.sync-status-pill--warning,
.sync-status-pill--offline {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.11);
  border-color: rgba(245, 158, 11, 0.28);
}

.sync-status-pill--ready,
.sync-status-pill--success {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.27);
}

.sync-status-pill--pending,
.sync-status-pill--progress,
.sync-status-pill--future {
  color: var(--primary-ink);
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.sync-status-pill--error {
  color: var(--danger);
  background: rgba(185, 28, 28, 0.08);
  border-color: rgba(185, 28, 28, 0.25);
}

.sync-message {
  max-width: 690px;
  margin-top: var(--space-md);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.sync-message--error {
  color: var(--danger);
  background: rgba(185, 28, 28, 0.07);
  border-color: rgba(185, 28, 28, 0.23);
}

.sync-message--warning {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.24);
}

.sync-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.sync-dot--online {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.sync-dot--offline {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.sync-detail-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 0;
}

.sync-detail-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.sync-detail-list > div:first-child {
  padding-top: 0;
}

.sync-detail-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.sync-detail-list dt {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.sync-detail-list dd {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: right;
  overflow-wrap: anywhere;
}

@media (min-width: 700px) {
  .sync-detail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-xl);
  }

  .sync-detail-list > div:nth-last-child(2) {
    padding-bottom: 0;
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .sync-status-pill--progress::before {
    content: '';
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: sync-status-spin 0.8s linear infinite;
  }
}

@keyframes sync-status-spin {
  to { transform: rotate(360deg); }
}
