/* ==============================================
   COMPONENTS — Buttons, forms, state indicators,
   badges, status labels, animations.
   Loaded by every page.
   ============================================== */

.info {
  color: var(--text-muted);
}

.success {
  color: var(--success-text);
}

.warning {
  color: var(--warning-text);
}

.error {
  color: var(--error-text);
}

.hidden {
  display: none !important;
}

.alert-error {
  margin: 0 0 12px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fef2f2;
  color: #b91c1c;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.inline-state {
  border-radius: 12px;
  border: 1px solid #dbe7f6;
  background: #f8fbff;
  color: #2a3f5a;
  padding: 12px 14px;
}

.inline-state h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.inline-state p {
  margin: 0;
  font-size: 0.9rem;
}

.loading-state {
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.9rem;
  display: none;
}

.loading-state.is-visible,
.inline-state.loading-state {
  display: block;
}

.z-loading-state,
.z-error-state,
.z-empty-state {
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #f9fafb;
  font-size: 0.9rem;
}

.z-loading-state {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.z-loading-state p,
.z-error-state p,
.z-empty-state p {
  margin: 0;
}

/* Loading spinner — used by uiStates.js showLoading() */
@keyframes z-spin {
  to {
    transform: rotate(360deg);
  }
}

.z-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: z-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.z-error-state {
  border-color: rgba(220, 38, 38, 0.15);
  background: #fef2f2;
}

.z-error-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.z-error-message {
  margin: 0;
  font-size: 0.85rem;
}

.z-empty-state {
  text-align: center;
  color: #6b7280;
}

.z-beta-banner {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.9rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(217, 119, 6, 0.22);
  background: #fffbeb;
  color: #7c4a03;
  font-size: 0.85rem;
}

.z-beta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.06rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid rgba(217, 119, 6, 0.25);
  white-space: nowrap;
}

.z-beta-text {
  min-width: 0;
}

.z-demo-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid rgba(217, 119, 6, 0.25);
  white-space: nowrap;
}

body.page-admin [data-admin-main-state],
body.page-seller [data-seller-dashboard-state],
body.page-seller [data-seller-form-error] {
  margin-bottom: 0.75rem;
}

body.page-shop [data-checkout-error] .z-error-state {
  margin-top: 0.25rem;
}

/* === Keyframe Animations === */
@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-pop {
  from {
    opacity: 0.7;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* === Global UI Consistency Pass === */
.page-status {
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 8px;
  min-height: 1.2em;
}

.page-status--error {
  color: #b91c1c;
}

/* Global UI consistency pass */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-outline {
  border-color: var(--line-soft);
  background-color: #ffffff;
  color: var(--text-main);
}

body.page-shop .add-to-cart-button {
  background-color: var(--color-primary);
  color: #ffffff;
  border-color: transparent;
  border-radius: 999px;
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  transform: translateY(-1px);
  filter: none;
}

body.page-shop .add-to-cart-button:hover {
  background-color: var(--color-primary-dark);
}

.btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-text-main);
  border-color: #d1d5db;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background-color: #e5e7eb;
  color: var(--color-text-main);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

body.page-shop .product-card,
body.page-order-details .order-details-card,
body.page-seller .seller-dashboard-card,
body.page-admin .admin-dashboard-card,
body.page-admin #admin-dashboard-root .admin-dashboard-card,
body.page-product-detail .product-detail-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

body.page-orders .orders-layout,
body.page-profile .profile-card,
body.page-payment-status .payment-status-card,
body.page-payment-status .order-confirmation-card,
body.page-seller .seller-shell,
body.page-admin .admin-shell,
body.page-admin .admin-auth-shell {
  background: var(--color-surface);
  border: 1px solid #dbe6f1;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

body.page-seller .seller-orders-table-wrap,
body.page-seller .seller-ledger-table-wrap,
body.page-admin .table-wrap,
body.page-admin .seller-detail-table-wrap,
body.page-admin #admin-dashboard-root .admin-orders-table-wrapper {
  border: 1px solid #dbe6f1;
  border-radius: var(--radius-md);
  background: #ffffff;
}

body.page-shop .product-card {
  padding: 16px 16px 12px;
}

body.page-order-details .order-details-card,
body.page-product-detail .product-detail-card,
body.page-seller .seller-dashboard-card,
body.page-admin .admin-dashboard-card,
body.page-admin #admin-dashboard-root .admin-dashboard-card {
  padding: 20px 20px 24px;
}

.text-muted {
  color: var(--color-text-muted);
}

small,
.text-small {
  font-size: 0.85rem;
}

.page-header p,
.seller-dashboard-header p,
.admin-dashboard-header p,
.order-meta,
.seller-orders-header p,
.admin-orders-header p {
  color: var(--color-text-muted);
}

.status-badge,
body.page-orders .status-badge,
body.page-order-details .status-badge,
body.page-seller .status-badge,
body.page-admin #admin-dashboard-root .status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.status-pending,
body.page-orders .status-pending,
body.page-order-details .status-pending,
body.page-seller .status-pending,
body.page-admin #admin-dashboard-root .status-pending {
  background-color: #fef3c7;
  color: #92400e;
}

.status-paid,
body.page-orders .status-paid,
body.page-order-details .status-paid,
body.page-seller .status-paid,
body.page-admin #admin-dashboard-root .status-paid {
  background-color: #e0f2fe;
  color: #1d4ed8;
}

.status-shipped,
body.page-orders .status-shipped,
body.page-order-details .status-shipped,
body.page-seller .status-shipped,
body.page-admin #admin-dashboard-root .status-shipped {
  background-color: #e0f2fe;
  color: #0369a1;
}

.status-delivered,
body.page-orders .status-delivered,
body.page-order-details .status-delivered,
body.page-seller .status-delivered,
body.page-admin #admin-dashboard-root .status-delivered {
  background-color: #dcfce7;
  color: #166534;
}

.status-refunded,
body.page-orders .status-refunded,
body.page-order-details .status-refunded,
body.page-seller .status-refunded,
body.page-admin #admin-dashboard-root .status-refunded {
  background-color: #fff7ed;
  color: #9a3412;
}

.status-cancelled,
body.page-orders .status-cancelled,
body.page-order-details .status-cancelled,
body.page-seller .status-cancelled,
body.page-admin #admin-dashboard-root .status-cancelled {
  background-color: #fee2e2;
  color: #b91c1c;
}

.status-default,
.status-unknown,
body.page-orders .status-default,
body.page-orders .status-unknown,
body.page-order-details .status-default,
body.page-order-details .status-unknown,
body.page-seller .status-default,
body.page-seller .status-unknown,
body.page-admin #admin-dashboard-root .status-default,
body.page-admin #admin-dashboard-root .status-unknown {
  background-color: #e5e7eb;
  color: #374151;
}

.dashboard-notification-shell {
  position: relative;
}

.dashboard-notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-notification-count {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.dashboard-notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid #dce7f2;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  z-index: 40;
}

.dashboard-notification-panel[hidden] {
  display: none;
}

.dashboard-notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.dashboard-notification-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.dashboard-notification-entry {
  border: 1px solid #dce7f2;
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px;
}

.dashboard-notification-entry.is-actionable {
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.dashboard-notification-entry.is-actionable:hover,
.dashboard-notification-entry.is-actionable:focus-visible {
  border-color: #9cb7d8;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.dashboard-notification-entry.is-unread {
  border-color: #9ec5a8;
  background: #effaf4;
}

.dashboard-notification-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.dashboard-notification-time {
  color: #64748b;
  font-size: 12px;
}

.dashboard-notification-message {
  margin: 0;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.5;
}

.dashboard-notification-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.dashboard-notification-empty {
  margin: 0;
  border: 1px dashed #dce7f2;
  border-radius: 12px;
  padding: 12px;
  color: #64748b;
  font-size: 13px;
}

.btn-primary.btn-small,
.btn-secondary.btn-small,
.btn-ghost.btn-small,
.btn-outline.btn-small {
  min-height: 32px;
  padding: 0 14px;
  font-size: 0.85rem;
}
