.chat-workspace-panel {
  margin: 12px 6px 6px;
}

.chat-workspace-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0 0 8px 2px;
  text-align: left;
}

.chat-workspace-head strong {
  color: #172341;
  font:
    800 11px/1.2 system-ui,
    sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-workspace-list {
  display: grid;
  gap: 4px;
}

.chat-workspace-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px;
  align-items: center;
}

.chat-workspace-link {
  min-width: 0;
  display: block;
  padding: 5px 4px 5px 2px;
  border-radius: 9px;
  color: #273449;
  text-align: left;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.chat-workspace-link:hover {
  background: #f1f5f9;
  text-decoration: none;
}

.chat-workspace-link span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font:
    650 12px/1.25 system-ui,
    sans-serif;
}

.chat-workspace-item.is-renaming .chat-workspace-link {
  display: none;
}

.chat-workspace-rename-input {
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #93c5fd;
  border-radius: 9px;
  background: #fff;
  color: #273449;
  font:
    650 12px/1.25 system-ui,
    sans-serif;
}

.chat-workspace-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.chat-workspace-remove,
.chat-workspace-share {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.chat-workspace-remove .material-icons,
.chat-workspace-share .material-icons {
  font-size: 16px;
  line-height: 24px;
}

@media (hover: hover) and (pointer: fine) {
  .chat-workspace-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-workspace-actions {
    position: absolute;
    top: 50%;
    right: 0;
    z-index: 1;
    transform: translateY(-50%);
    padding-left: 14px;
    background: linear-gradient(90deg, rgba(250, 250, 250, 0), #fafafa 36%);
    opacity: 0;
    pointer-events: none;
  }

  .chat-workspace-item:hover .chat-workspace-actions,
  .chat-workspace-item:focus-within .chat-workspace-actions {
    opacity: 1;
    pointer-events: auto;
  }

  .chat-workspace-item:hover .chat-workspace-link,
  .chat-workspace-item:focus-within .chat-workspace-link {
    padding-right: 52px;
  }
}

.chat-workspace-share:hover {
  background: #eff6ff;
  color: #2563eb;
}

.chat-workspace-remove:hover {
  background: #fff1f2;
  color: #be123c;
}

.chat-workspace-remove:disabled {
  cursor: wait;
  opacity: 0.45;
}

.chat-workspace-more {
  display: block;
  width: 100%;
  height: 26px;
  margin-top: 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font: 700 16px/1 system-ui, sans-serif;
}

.chat-workspace-more:hover,
.chat-workspace-more:focus-visible {
  background: #f1f5f9;
  color: #172341;
}

.chat-workspace-more[hidden] {
  display: none;
}

.chat-main-content {
  position: relative;
}

.anonymous-chat-button {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 20;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #64748b;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #475569;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.anonymous-chat-button:hover,
.anonymous-chat-button:focus-visible {
  border-color: #0f172a;
  color: #0f172a;
  background: #fff;
}

.chat-workspace-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10000;
  transform: translateX(-50%);
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.96);
  color: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.3);
  font:
    600 13px/1.2 system-ui,
    sans-serif;
}

.chat-message-hidden-local {
  display: none !important;
}

.chat-hide-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(520px, calc(100vw - 32px));
  transform: translate(-50%, 12px);
  padding: 10px 10px 10px 18px;
  border-radius: 999px;
  background: linear-gradient(145deg, #ff9e43 0%, #f46f5b 45%, #d94b86 100%);
  color: #fff;
  box-shadow:
    0 18px 44px rgba(217, 75, 134, 0.34),
    0 4px 14px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font:
    600 13.5px/1.25 'Roboto', system-ui, sans-serif;
  letter-spacing: 0.01em;
}

.chat-hide-toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.chat-hide-toast--error {
  background: linear-gradient(145deg, #f0616a 0%, #c0335f 100%);
}

.chat-hide-toast__label {
  flex: 1 1 auto;
  padding: 4px 0;
  text-shadow: 0 1px 2px rgba(120, 30, 70, 0.28);
}

.chat-hide-toast__undo,
.chat-hide-toast button {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.96);
  color: #c33c72;
  cursor: pointer;
  line-height: 34px;
  font-weight: 750;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(120, 30, 70, 0.24);
}

.chat-hide-toast__undo:hover,
.chat-hide-toast button:hover {
  background: #fff;
  color: #a92c5d;
}

.message-action-button--delete-everyone {
  color: #d94b86;
}

.message-action-button--remove-from-room {
  color: #ff7a3d;
}

@media (prefers-reduced-motion: reduce) {
  .chat-hide-toast {
    transition: none;
  }
}

@media (max-width: 640px) {
  .chat-hide-toast {
    bottom: 82px;
    width: calc(100vw - 32px);
    box-sizing: border-box;
    border-radius: 16px;
  }

  .anonymous-chat-button {
    top: 12px;
    right: 12px;
  }

  .chat-workspace-toast {
    bottom: 82px;
  }
}

@media (max-width: 1024px) {
  .chat-workspace-panel {
    margin-top: 72px;
  }
}

/* Chat image → H3 video play overlay */
.chat-i2v {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 10px 0 0;
}
.chat-i2v__media {
  position: relative;
  display: inline-block;
  max-width: 100%;
}
.chat-i2v__image {
  display: block;
  max-width: 100%;
  border-radius: 8px;
}
.chat-i2v__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
}
.chat-i2v__play:hover {
  background: rgba(15, 23, 42, 0.88);
}
.chat-i2v__play .material-icons {
  font-size: 32px;
  line-height: 1;
}
.chat-i2v__status {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 650;
  color: #475569;
}
.chat-i2v__status--loading::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid #94a3b8;
  border-top-color: #0f766e;
  border-radius: 50%;
  animation: chat-i2v-spin 0.8s linear infinite;
  vertical-align: -1px;
}
.chat-i2v__status--error {
  color: #b91c1c;
}
.chat-i2v__video-slot {
  margin-top: 8px;
}
.chat-i2v__video {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  background: #0f172a;
}
.chat-i2v__actions {
  margin-top: 6px;
}
.chat-i2v__download {
  font-size: 13px;
  font-weight: 700;
  color: #0f766e;
  text-decoration: none;
}
.chat-i2v__download:hover {
  text-decoration: underline;
}
.chat-i2v--ready .chat-i2v__play {
  display: none;
}
@keyframes chat-i2v-spin {
  to { transform: rotate(360deg); }
}
