/* Realtime chat additions. Loaded after application.css. */

.chat-audio-player {
  display: flex;
  width: min(350px, 68vw);
  min-height: 50px;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(64, 34, 94, 0.11);
  border-radius: 15px;
}

.chat-message--user .chat-audio-player {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.22);
}

.chat-audio-player audio {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.chat-audio-player__play,
.chat-audio-player__rate {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.chat-audio-player__play {
  width: 35px;
  height: 35px;
  color: #fff;
  background: linear-gradient(145deg, var(--orange), var(--pink));
  border-radius: 12px;
  box-shadow: 0 5px 13px rgba(225, 46, 102, 0.2);
  font-size: 13px;
}

.chat-audio-player__play:hover,
.chat-audio-player__rate:hover {
  filter: saturate(1.12);
}

.chat-audio-player__play:focus-visible,
.chat-audio-player__rate:focus-visible,
.chat-audio-player__seek:focus-visible {
  outline: 3px solid rgba(111, 43, 208, 0.27);
  outline-offset: 2px;
}

.chat-audio-player__body {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 3px;
}

.chat-audio-player__seek {
  width: 100%;
  min-width: 60px;
  height: 18px;
  margin: 0;
  accent-color: var(--pink);
  cursor: pointer;
}

.chat-audio-player__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.chat-message--user .chat-audio-player__meta {
  color: rgba(255, 255, 255, 0.72);
}

.chat-audio-player__rate {
  min-width: 34px;
  min-height: 28px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
}

.chat-audio-player__error {
  max-width: 120px;
  color: var(--danger);
  font-size: 9px;
  line-height: 1.2;
}

.chat-message--user .chat-audio-player__error {
  color: #ffe0e7;
}

.chat-attachment-preview .chat-audio-player {
  width: min(290px, 58vw);
  min-height: 44px;
  padding: 5px 7px;
}

.chat-attachment-preview .chat-audio-player__play {
  width: 31px;
  height: 31px;
  border-radius: 10px;
}

.chat-new-messages {
  position: absolute;
  right: 50%;
  bottom: 88px;
  z-index: 5;
  min-height: 35px;
  padding: 0 13px;
  color: #fff;
  background: linear-gradient(145deg, var(--purple), var(--pink));
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 780;
  box-shadow: 0 8px 23px rgba(98, 39, 129, 0.25);
  transform: translateX(50%);
}

.chat-main {
  position: relative;
}

/* Give the desktop workspace enough room for the ledger and workout cards
   without shrinking the conversation at laptop/mobile breakpoints. */
@media (min-width: 1280px) {
  .chat-app {
    width: min(1500px, calc(100% - 28px));
    grid-template-columns: minmax(0, 1fr) 430px;
  }

  .chat-toast {
    right: 450px;
  }

  .chat-workspace__content {
    padding-right: 24px;
    padding-left: 24px;
  }

  .workspace-tabs {
    margin-right: -24px;
    margin-left: -24px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .workspace-tab {
    font-size: 11px;
  }

  .workspace-section-heading h2 {
    font-size: 23px;
  }

  .workspace-eyebrow {
    font-size: 10px;
  }

  .workspace-list-heading h3 {
    font-size: 14px;
  }

  .meal-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    padding-right: 12px;
    padding-left: 12px;
  }

  .meal-row strong,
  .meal-row b {
    font-size: 12px;
  }

  .meal-row span,
  .workspace-intro,
  .memory-row p {
    font-size: 12px;
  }
}

@media (min-width: 1440px) {
  .chat-app {
    grid-template-columns: minmax(0, 1fr) 460px;
  }

  .chat-toast {
    right: 480px;
  }
}

@media (min-width: 1520px) {
  .chat-app {
    grid-template-columns: minmax(0, 1fr) 470px;
  }

  .chat-toast {
    right: 490px;
  }
}

.chat-new-messages:hover {
  filter: saturate(1.1);
  transform: translateX(50%) translateY(-1px);
}

@media (max-width: 640px) {
  .chat-audio-player {
    width: min(320px, 78vw);
  }

  .chat-new-messages {
    bottom: 80px;
  }
}

@media (max-width: 390px) {
  .chat-audio-player {
    width: min(290px, 80vw);
  }

  .chat-audio-player__error {
    display: none;
  }
}
