/*
 * SFL global compact status badges v1
 * Presentation only: preserves badge text, colours, actions and data attributes.
 * Product shoe-size strips, image size labels, notification counters and title icons
 * remain unchanged because they are functional labels rather than status badges.
 */

/* Bootstrap status badges used throughout the authenticated CRM. */
body.sfl-crm .badge {
  padding: .2em .48em !important;
  font-size: clamp(9px, .64em, 10px) !important;
  line-height: 1.08 !important;
  letter-spacing: 0 !important;
  box-shadow: none;
}

/* Authentication/security screens that use the shared auth layout. */
.auth-shell .badge {
  padding: .2em .48em !important;
  font-size: clamp(9px, .64em, 10px) !important;
  line-height: 1.08 !important;
  letter-spacing: 0 !important;
  box-shadow: none;
}

.login-card-badge {
  padding: 4px 8px !important;
  margin-bottom: 9px !important;
  font-size: .66rem !important;
  line-height: 1.05 !important;
}

/* Shared custom status pills. */
body.sfl-crm .global-search-badge,
body.sfl-crm .supplier-mini-badge,
body.sfl-crm .supplier-risk-badge,
body.sfl-crm .badge-soft,
body.sfl-crm .staff-preview-badge {
  min-height: 0 !important;
  padding: 1px 5px !important;
  font-size: .6rem !important;
  line-height: 1.1 !important;
  box-shadow: none !important;
}

/* Small country marker inside the missing/international contact warning. */
body.sfl-crm .sfl-contact-warning {
  gap: 3px !important;
  padding: 1px 4px !important;
}

body.sfl-crm .sfl-contact-warning-badge {
  padding: 1px 4px !important;
  font-size: .56rem !important;
  line-height: 1 !important;
}

/* The Supplier View UPDATED control is a status badge with a history action. */
body.sfl-crm .supplier-view-page .supplier-updated-button {
  min-width: 0 !important;
  padding: 2px 6px !important;
  font-size: .59rem !important;
  line-height: 1.05 !important;
  letter-spacing: .025em !important;
  box-shadow: none !important;
}

/* Future-order badges are the largest repeated status group in order tables. */
body.sfl-crm .sfl-future-badges {
  gap: 3px !important;
}

body.sfl-crm .sfl-future-badges-dashboard {
  margin: 5px 0 3px !important;
}

body.sfl-crm .sfl-future-badge {
  min-height: 17px !important;
  padding: 2px 5px !important;
  border-width: 1px !important;
  font-size: .59rem !important;
  line-height: 1.05 !important;
  letter-spacing: .015em !important;
  box-shadow: none !important;
}

body.sfl-crm table .sfl-future-badges,
body.sfl-crm .table .sfl-future-badges {
  min-width: 0 !important;
}

/* Preserve pulse meaning while removing the oversized glow. */
@keyframes sflCompactFutureBadgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 187, 0, .12); }
  50% { transform: scale(1.015); box-shadow: 0 0 0 2px rgba(255, 187, 0, .2); }
}

body.sfl-crm .sfl-future-badge-pulse {
  animation-name: sflCompactFutureBadgePulse !important;
}

/* Order-state explanation badges. */
body.sfl-crm .sfl-cancelled-by-badge {
  margin-top: 3px !important;
  padding: 1px 5px !important;
  font-size: .56rem !important;
  line-height: 1.1 !important;
  box-shadow: none !important;
}

body.sfl-crm .sfl-partial-delivery-badge {
  padding: 2px 5px !important;
  font-size: .59rem !important;
  line-height: 1.08 !important;
  box-shadow: none;
}

body.sfl-crm .sfl-online-payment-tag {
  min-height: 16px !important;
  padding: 1px 5px !important;
  font-size: .57rem !important;
  line-height: 1 !important;
}

/* Temporary courier-export marker shown in AWB and Pending Dispatch. */
body.sfl-crm .sfl-queue-export-badge {
  min-height: 17px !important;
  gap: 3px !important;
  padding: 1px 2px 1px 5px !important;
  font-size: 9px !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

/* Text overdue marker; traffic-light dots keep their original dimensions. */
body.sfl-crm .sfl-pd-pending-table .sfl-pd-age-has-text,
body.sfl-crm .sfl-queue-helper-table .sfl-pd-age-has-text {
  width: auto !important;
  min-width: 0 !important;
  height: 18px !important;
  padding: 0 5px !important;
}

body.sfl-crm .sfl-pd-pending-table .sfl-pd-age-text,
body.sfl-crm .sfl-queue-helper-table .sfl-pd-age-text {
  font-size: 9px !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

@keyframes sflCompactOverdueBadgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 1px 3px rgba(128, 0, 32, .18); filter: brightness(1); }
  50% { transform: scale(1.02); box-shadow: 0 2px 5px rgba(220, 38, 38, .24); filter: brightness(1.05); }
}

body.sfl-crm .sfl-queue-helper-table .sfl-pd-age-has-text {
  animation-name: sflCompactOverdueBadgePulse !important;
}

@keyframes sflCompactSupplierUpdatedPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 1px 3px rgba(128, 0, 32, .16); }
  50% { transform: scale(1.015); box-shadow: 0 2px 5px rgba(245, 130, 32, .22); }
}

@keyframes sflCompactPartialBadgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 35, 24, .1); }
  50% { box-shadow: 0 0 0 2px rgba(180, 35, 24, .18); }
}

@keyframes sflCompactOnlinePaymentPulse {
  0%, 100% { transform: translateZ(0) scale(1); box-shadow: 0 0 0 0 rgba(255, 190, 0, .3); }
  50% { transform: translateZ(0) scale(1.01); box-shadow: 0 0 0 2px rgba(255, 190, 0, 0); }
}

body.sfl-crm .supplier-view-page .supplier-updated-button {
  animation-name: sflCompactSupplierUpdatedPulse !important;
}

body.sfl-crm .supplier-view-page .supplier-update-indicator.is-settled .supplier-updated-button {
  animation: none !important;
}

body.sfl-crm .sfl-partial-delivery-badge.is-cost-pending {
  animation-name: sflCompactPartialBadgePulse !important;
}

body.sfl-crm .sfl-online-payment-tag {
  animation-name: sflCompactOnlinePaymentPulse !important;
}

@media (prefers-reduced-motion: reduce) {
  body.sfl-crm .sfl-future-badge-pulse,
  body.sfl-crm .sfl-queue-helper-table .sfl-pd-age-has-text,
  body.sfl-crm .supplier-view-page .supplier-updated-button,
  body.sfl-crm .sfl-partial-delivery-badge.is-cost-pending,
  body.sfl-crm .sfl-online-payment-tag {
    animation: none !important;
  }
}
