/* ==========================================================================
   ui-states.css — Universal UI State Components
   Phase 13 — Ref: [UIUX] §5
   ========================================================================== */

/* --------------------------------------------------------------------------
   Toast / Snackbar container (top-right desktop, top-center mobile)
   -------------------------------------------------------------------------- */
.hedwig-toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
  pointer-events: none;
}

.hedwig-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--neutral-800);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
[data-theme="dark"] .hedwig-toast {
  background: #232c37;
  color: var(--text-primary);
}

.hedwig-toast.is-visible {
  transform: translateX(0);
  opacity: 1;
}

.hedwig-toast .fa-solid {
  font-size: var(--fs-lg);
}

.hedwig-toast-success { border-left: 4px solid var(--color-success); }
.hedwig-toast-success .fa-solid { color: var(--color-success); }
.hedwig-toast-error   { border-left: 4px solid var(--color-danger); }
.hedwig-toast-error .fa-solid   { color: var(--color-danger); }
.hedwig-toast-warning { border-left: 4px solid var(--color-warning); }
.hedwig-toast-warning .fa-solid { color: var(--color-warning); }
.hedwig-toast-info    { border-left: 4px solid var(--color-info); }
.hedwig-toast-info .fa-solid    { color: var(--color-info); }

@media (max-width: 480px) {
  .hedwig-toast-container {
    top: 8px;
    right: 8px;
    left: 8px;
    max-width: none;
  }
  .hedwig-toast {
    transform: translateY(-120%);
  }
  .hedwig-toast.is-visible {
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Skeleton loaders
   -------------------------------------------------------------------------- */
.hedwig-skeleton {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.hedwig-skeleton-line {
  background: linear-gradient(90deg, var(--neutral-200) 25%, var(--neutral-100) 50%, var(--neutral-200) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-pill);
  animation: hedwig-shimmer 1.5s ease-in-out infinite;
}

@keyframes hedwig-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hedwig-skeleton-line { animation: none; background: var(--neutral-200); }
}

.hedwig-skeleton-table .hedwig-skeleton-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--neutral-100);
}
.hedwig-skeleton-table .hedwig-skeleton-row:last-child {
  border-bottom: none;
}

.hedwig-skeleton-chart {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Universal state containers (Empty / Error / No-results)
   -------------------------------------------------------------------------- */
.hedwig-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  min-height: 200px;
}

.hedwig-state-icon {
  font-size: 48px;
  color: var(--neutral-300);
  margin-bottom: 16px;
  line-height: 1;
}

.hedwig-state-empty .hedwig-state-icon i { color: var(--neutral-300); }
.hedwig-state-error .hedwig-state-icon i { color: var(--color-danger); }
.hedwig-state-no-results .hedwig-state-icon i { color: var(--neutral-400); }

.hedwig-state-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.hedwig-state-message {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin: 0 0 20px;
  max-width: 360px;
}

.hedwig-state-cta,
.hedwig-state-retry,
.hedwig-state-clear-filters {
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Offline overlay
   -------------------------------------------------------------------------- */
.hedwig-offline-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.hedwig-offline-overlay.is-visible {
  opacity: 1;
}

.hedwig-offline-card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
}

.hedwig-offline-card .fa-wifi-slash {
  font-size: 48px;
  color: var(--color-warning);
  margin-bottom: 12px;
}

.hedwig-offline-card h3 {
  margin: 0 0 4px;
}

.hedwig-offline-card p {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin: 0 0 20px;
}

.hedwig-offline-spinner {
  margin-bottom: 8px;
}
.hedwig-offline-spinner .fa-spinner {
  font-size: var(--fs-lg);
  color: var(--brand-primary);
  animation: hedwig-spin 1s linear infinite;
}

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

.hedwig-offline-reconnect-text {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Slow network note
   -------------------------------------------------------------------------- */
.hedwig-slow-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-warning-bg);
  color: var(--color-warning);
  font-size: var(--fs-xs);
  margin-bottom: 12px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.hedwig-slow-note.is-dismissed {
  opacity: 0;
}

/* --------------------------------------------------------------------------
   Modals (Permission denied / Session expired)
   -------------------------------------------------------------------------- */
.hedwig-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, 0.5);
  backdrop-filter: blur(2px);
}

.hedwig-modal {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  width: calc(100% - 48px);
}

.hedwig-modal-icon {
  font-size: 40px;
  margin-bottom: 12px;
  line-height: 1;
}

.hedwig-modal-permission .hedwig-modal-icon i { color: var(--color-danger); }
.hedwig-modal-session .hedwig-modal-icon i { color: var(--color-warning); }

.hedwig-modal h3 {
  margin: 0 0 8px;
}

.hedwig-modal p {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin: 0 0 20px;
}

.hedwig-modal .btn {
  min-width: 120px;
}

/* --------------------------------------------------------------------------
   Dealer portal — header notification bell badge
   (shared across all dealer pages; see client/assets/js/dealer-notif.js)
   -------------------------------------------------------------------------- */
.hd-ctrl.hd-notifications { position: relative; }
.hd-notif-badge {
  position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 8px; background: #dc2626; color: #fff;
  font-size: 10px; font-weight: 700; align-items: center; justify-content: center; line-height: 16px;
}

/* --------------------------------------------------------------------------
   Product image watermark — tenant short name stamped on every product photo
   (catalog cards, product table thumbs, order picker thumbs, product detail).
   Styled like a document watermark: large, centered, diagonally rotated text
   at low opacity so the product photo stays the focus.
   -------------------------------------------------------------------------- */
.product-img-frame {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  line-height: 0;
  flex: 0 0 auto;
  overflow: hidden;
}
.product-img-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-28deg);
  z-index: 1;
  max-width: 96%;
  color: rgba(0, 0, 0, 0.13);
  background: transparent;
  font-size: clamp(22px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.35);
  pointer-events: none;
  user-select: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .product-img-watermark {
  color: rgba(255, 255, 255, 0.18);
}
/* Tiny thumbnails (admin list 40px, order picker 32–44px): a full-size stamp
   won't fit, so shrink it to a proportional, unobtrusive diagonal mark. */
.product-img-frame .product-img-watermark {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-shadow: none;
}
/* Product detail hero image — restore the full-size document stamp. */
.product-img-frame.detail-frame .product-img-watermark {
  font-size: clamp(22px, 4vw, 44px);
}
