/* Global realtime layer: sidebar bell, notification panel, toasts */

.admin-ui [data-admin-badge][hidden],
.admin-ui [data-alv-bell-badge][hidden],
.admin-ui .alv-tab__count[hidden],
.admin-ui .alv-panel[hidden] {
  display: none !important;
}

.admin-ui .admin-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-ui .admin-sidebar-brand-link {
  flex: 1 1 auto;
}

/* ---------- bell ---------- */

.admin-ui .alv-bell {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.admin-ui .alv-bell:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.admin-ui .alv-bell i {
  display: flex;
  font-size: 17px;
  line-height: 1;
}

.admin-ui .alv-bell.has-new i {
  animation: alv-ring 2.4s ease-in-out infinite;
  transform-origin: 50% 2px;
}

.admin-ui .alv-bell__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #0c1018;
}

@keyframes alv-ring {
  0%, 60%, 100% { transform: rotate(0); }
  64% { transform: rotate(14deg); }
  70% { transform: rotate(-12deg); }
  76% { transform: rotate(8deg); }
  82% { transform: rotate(-5deg); }
  88% { transform: rotate(2deg); }
}

/* ---------- panel ---------- */

.admin-ui .alv-panel {
  position: fixed;
  z-index: 1000001;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 24px 48px -16px rgba(15, 23, 42, 0.28), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  opacity: 0;
  transform: translateX(-6px) scale(0.985);
  transform-origin: top left;
  transition: opacity 0.16s ease, transform 0.16s ease;
  font-size: 13px;
  color: #0f172a;
}

.admin-ui .alv-panel.is-open {
  opacity: 1;
  transform: none;
}

.admin-ui .alv-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 12px 10px 16px;
}

.admin-ui .alv-panel__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.admin-ui .alv-panel__actions {
  display: flex;
  gap: 4px;
}

.admin-ui .alv-icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.admin-ui .alv-icon-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.admin-ui .alv-icon-btn.is-off {
  color: #ef4444;
}

.admin-ui .alv-icon-btn i {
  display: flex;
  font-size: 15px;
}

.admin-ui .alv-tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px 10px;
  border-bottom: 1px solid #f1f5f9;
}

.admin-ui .alv-tab {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  color: #64748b;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.admin-ui .alv-tab:hover {
  background: #f8fafc;
  color: #0f172a;
}

.admin-ui .alv-tab.is-active {
  background: #f5f3ff;
  color: #7c3aed;
}

.admin-ui .alv-tab__count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #7c3aed;
  color: #fff;
  font-size: 10.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-ui .alv-list {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
}

.admin-ui .alv-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}

.admin-ui .alv-item:hover {
  background: #f8fafc;
}

.admin-ui .alv-item.is-new {
  background: #faf8ff;
}

.admin-ui .alv-item.is-new::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: #7c3aed;
}

.admin-ui .alv-item__lead {
  flex: 0 0 auto;
}

.admin-ui .alv-item__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-ui .alv-item__top,
.admin-ui .alv-item__row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.admin-ui .alv-item__title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 650;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-ui .alv-item__time {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: #94a3b8;
}

.admin-ui .alv-item.is-new .alv-item__time {
  color: #7c3aed;
  font-weight: 600;
}

.admin-ui .alv-item__sub {
  font-size: 11.5px;
  color: #7c3aed;
  font-weight: 600;
}

.admin-ui .alv-item__text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-ui .alv-item__unread {
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #7c3aed;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-ui .alv-status {
  align-self: flex-start;
  margin-top: 3px;
  height: 20px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  color: #475569;
}

.admin-ui .alv-status--processing,
.admin-ui .alv-status--pending,
.admin-ui .alv-status--new {
  background: #eff6ff;
  color: #2563eb;
}

.admin-ui .alv-status--confirmed,
.admin-ui .alv-status--cooking,
.admin-ui .alv-status--ready,
.admin-ui .alv-status--in_progress,
.admin-ui .alv-status--shipped,
.admin-ui .alv-status--on_the_way,
.admin-ui .alv-status--delivering {
  background: #fff7ed;
  color: #c2410c;
}

.admin-ui .alv-status--completed,
.admin-ui .alv-status--delivered {
  background: #f0fdf4;
  color: #15803d;
}

.admin-ui .alv-status--cancelled,
.admin-ui .alv-status--canceled,
.admin-ui .alv-status--failed {
  background: #fef2f2;
  color: #dc2626;
}

.admin-ui .alv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 12px;
  color: #94a3b8;
  font-size: 12.5px;
}

.admin-ui .alv-empty i {
  font-size: 22px;
  display: flex;
}

.admin-ui .alv-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ede9fe;
  border-top-color: #7c3aed;
  animation: alv-spin 0.8s linear infinite;
}

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

.admin-ui .alv-panel__foot {
  padding: 9px 16px;
  border-top: 1px solid #f1f5f9;
  background: #fcfcfd;
}

.admin-ui .alv-conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: #94a3b8;
}

.admin-ui .alv-conn i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
}

.admin-ui .alv-conn.is-on i {
  background: #22c55e;
}

/* ---------- avatars ---------- */

.admin-ui .alv-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}

.admin-ui .alv-avatar i {
  display: flex;
  font-size: 16px;
}

.admin-ui .alv-avatar--order {
  background: #ede9fe;
  color: #7c3aed;
}

/* ---------- toasts ---------- */

.admin-ui .alv-toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000002;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.admin-ui .alv-toast {
  pointer-events: auto;
  position: relative;
  width: 360px;
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 10px 12px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 18px 40px -14px rgba(15, 23, 42, 0.3), 0 3px 10px -3px rgba(15, 23, 42, 0.08);
  color: #0f172a;
  text-decoration: none;
  overflow: hidden;
  opacity: 0;
  transform: translateX(28px);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  cursor: pointer;
}

.admin-ui .alv-toast.is-in {
  opacity: 1;
  transform: none;
}

.admin-ui .alv-toast.is-leaving {
  opacity: 0;
  transform: translateX(28px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.admin-ui .alv-toast:hover {
  border-color: #ddd6fe;
}

.admin-ui .alv-toast__lead {
  flex: 0 0 auto;
}

.admin-ui .alv-toast__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f5f3ff;
  color: #7c3aed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-ui .alv-toast__body {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-ui .alv-toast__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-ui .alv-toast__label {
  min-width: 0;
  font-size: 11.5px;
  font-weight: 650;
  color: #7c3aed;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-ui .alv-toast--order .alv-toast__label {
  color: #16a34a;
}

.admin-ui .alv-toast__time {
  flex: 0 0 auto;
  font-size: 11px;
  color: #94a3b8;
}

.admin-ui .alv-toast__title {
  margin-top: 1px;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-ui .alv-toast__text {
  margin-top: 2px;
  font-size: 12.5px;
  color: #475569;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.admin-ui .alv-toast__close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  margin: -2px -2px 0 0;
  border-radius: 6px;
  background: transparent;
  border: 0;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-ui .alv-toast__close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.admin-ui .alv-toast__close i {
  display: flex;
  font-size: 16px;
}

.admin-ui .alv-toast__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: #7c3aed;
  opacity: 0.55;
  transform-origin: left center;
  transform: scaleX(1);
}

.admin-ui .alv-toast--order .alv-toast__bar {
  background: #16a34a;
}

/* ---------- live list rows ---------- */

.admin-ui .alv-row-new > td {
  animation: alv-row-flash 3s ease-out;
}

@keyframes alv-row-flash {
  0%, 30% { background-color: #f3efff; }
  100% { background-color: transparent; }
}

@media (max-width: 640px) {
  .admin-ui .alv-toasts {
    left: 12px;
    right: 12px;
    bottom: 12px;
    align-items: stretch;
  }

  .admin-ui .alv-toast {
    width: auto;
    max-width: none;
  }
}
