/* LQM Toast — Hệ thống thông báo thống nhất */
:root {
  --lqm-toast-success: #00ff88;
  --lqm-toast-error: #ff3366;
  --lqm-toast-warning: #ffcc00;
  --lqm-toast-info: #00eaff;
  --lqm-toast-bg: rgba(14, 14, 24, 0.96);
  --lqm-toast-border: rgba(255, 255, 255, 0.08);
  --lqm-toast-font: 'Be Vietnam Pro', system-ui, sans-serif;
}

.lqm-toast-root {
  position: fixed;
  top: 82px;
  right: 16px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 32px));
}

.lqm-live-root {
  position: fixed;
  bottom: 24px;
  left: 16px;
  z-index: 99998;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 32px));
}

.lqm-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 16px;
  background: var(--lqm-toast-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--lqm-toast-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  font-family: var(--lqm-toast-font);
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateX(110%);
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.lqm-toast--exit {
  opacity: 0;
  transform: translateX(110%) scale(0.95);
}

.lqm-toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
  background: var(--lqm-toast-accent, var(--lqm-toast-info));
}

.lqm-toast--success { --lqm-toast-accent: var(--lqm-toast-success); }
.lqm-toast--error   { --lqm-toast-accent: var(--lqm-toast-error); }
.lqm-toast--warning { --lqm-toast-accent: var(--lqm-toast-warning); }
.lqm-toast--info    { --lqm-toast-accent: var(--lqm-toast-info); }

.lqm-toast__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--lqm-toast-accent) 18%, transparent);
  color: var(--lqm-toast-accent);
  font-size: 18px;
}

.lqm-toast__icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.lqm-toast__body {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.lqm-toast__title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
  color: #fff;
}

.lqm-toast__msg {
  color: rgba(255, 255, 255, 0.82);
  word-break: break-word;
}

.lqm-toast__close {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #888;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: 0.2s;
  margin: -2px -4px 0 0;
}

.lqm-toast__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.lqm-toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--lqm-toast-accent);
  border-radius: 0 0 14px 14px;
  opacity: 0.7;
  animation: lqmToastProgress linear forwards;
}

@keyframes lqmToastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* Live activity toast */
.lqm-live {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--lqm-toast-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--lqm-toast-border);
  border-left: 3px solid var(--lqm-toast-info);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  font-family: var(--lqm-toast-font);
  font-size: 12px;
  color: #ddd;
  opacity: 0;
  transform: translateX(-120%);
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1), transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.lqm-live--visible {
  opacity: 1;
  transform: translateX(0);
}

.lqm-live--exit {
  opacity: 0;
  transform: translateY(12px);
}

.lqm-live__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(0, 234, 255, 0.35);
  flex-shrink: 0;
}

.lqm-live__content {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.lqm-live__content b {
  color: var(--lqm-toast-info);
  font-weight: 700;
}

.lqm-live__content span {
  color: var(--lqm-toast-warning);
  font-weight: 600;
}

/* Mobile: thông báo hiện phía TRÊN (không đè bottom nav) */
@media (max-width: 768px) {
  .lqm-toast-root {
    top: calc(12px + env(safe-area-inset-top, 0px));
    bottom: auto;
    right: 12px;
    left: 12px;
    max-width: none;
    flex-direction: column;
    align-items: stretch;
  }
  .lqm-toast {
    transform: translateY(-120%);
    width: 100%;
    box-sizing: border-box;
  }
  .lqm-toast--visible { transform: translateY(0); }
  .lqm-toast--exit { transform: translateY(-120%) scale(0.96); }

  /* Live feed: dưới vùng toast một chút, vẫn phía trên màn hình */
  .lqm-live-root {
    top: calc(78px + env(safe-area-inset-top, 0px));
    bottom: auto;
    left: 12px;
    right: 12px;
    max-width: none;
    flex-direction: column;
    align-items: stretch;
  }
  .lqm-live {
    transform: translateY(-120%);
    width: 100%;
    box-sizing: border-box;
  }
  .lqm-live--visible { transform: translateY(0); }
  .lqm-live--exit { transform: translateY(-120%); }
}