.call-banner {
  background: var(--color-surface, oklch(0.97 0 0));
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px oklch(0 0 0 / 0.15);
  inset-block-start: var(--block-space);
  inset-inline-end: calc(var(--sidebar-width) + var(--inline-space));
  padding: 0.5em 1em;
  position: fixed;
  z-index: 3;
}

.call-banner__indicator {
  background: oklch(0.65 0.2 145);
  block-size: 0.5em;
  border-radius: 50%;
  inline-size: 0.5em;
  animation: call-pulse 2s ease-in-out infinite;
}

@keyframes call-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Fullscreen overlay like Teams */
.call-container {
  background: oklch(0.12 0 0);
  display: flex;
  flex-direction: column;
  block-size: 100dvh;
  inset: 0;
  overflow: hidden;
  position: fixed;
  z-index: 10;
}

/* Grid: remote participants fill the space */
.call-grid {
  display: grid;
  flex: 1 1 0;
  gap: 0.5rem;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
  min-block-size: 0;
  overflow: hidden;
  padding: 0.5rem;
  position: relative;
}

/* Screen share: takes main area, participants shrink to bottom strip */
.call-screen-share {
  grid-column: 1 / -1;
  position: relative;
  width: 100%;

  video {
    border-radius: 0.5rem;
    height: 100%;
    object-fit: contain;
    width: 100%;
  }
}

.call-screen-share__bar {
  align-items: center;
  background: oklch(0.15 0 0 / 0.85);
  backdrop-filter: blur(10px);
  border-radius: 0.75rem;
  color: white;
  display: flex;
  font-size: 0.85rem;
  gap: 0.6rem;
  left: 50%;
  padding: 0.5rem 1rem;
  position: absolute;
  top: 1rem;
  transform: translateX(-50%);
  z-index: 5;
}

.call-screen-share__dot {
  animation: call-pulse 2s ease-in-out infinite;
  background: oklch(0.65 0.25 25);
  block-size: 0.6rem;
  border-radius: 50%;
  flex-shrink: 0;
  inline-size: 0.6rem;
}

.call-screen-share__stop {
  background: oklch(0.55 0.25 25);
  border: none;
  border-radius: 0.4rem;
  color: white;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
}

.call-screen-share__stop:hover {
  background: oklch(0.45 0.25 25);
}

.call-screen-share__minimize {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.6;
  padding: 0;
}

.call-screen-share__minimize:hover {
  opacity: 1;
}

.call-btn--recording {
  position: relative;
}

.call-btn--recording::after {
  animation: call-pulse 1.5s ease-in-out infinite;
  background: oklch(0.55 0.25 25);
  block-size: 0.5rem;
  border-radius: 50%;
  content: "";
  inline-size: 0.5rem;
  position: absolute;
  right: -0.1rem;
  top: -0.1rem;
}

.call-grid--screen-share {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
}

.call-grid--screen-share .call-tile:not(.call-tile--local) {
  height: auto;
  max-height: 120px;
  width: auto;
}

/* Grid columns managed by JS via _updateGridLayout() */

/* Remote tiles: fill the grid */
.call-tile {
  background: oklch(0.18 0 0);
  border-radius: 0.5rem;
  min-block-size: 0;
  overflow: hidden;
  position: relative;
  width: 100%;
  height: 100%;

  video {
    block-size: 100%;
    inline-size: 100%;
    object-fit: cover;
  }

  audio {
    display: none;
  }
}

/* Local tile: small picture-in-picture in bottom right */
.call-tile--local {
  aspect-ratio: 16 / 9;
  border: 2px solid oklch(1 0 0 / 0.2);
  border-radius: 0.5rem;
  block-size: auto;
  box-shadow: 0 2px 12px oklch(0 0 0 / 0.5);
  inset-block-end: 5rem;
  inset-inline-end: 1.5rem;
  inline-size: 20rem;
  max-inline-size: 25vw;
  position: absolute;
  width: auto;
  z-index: 2;
}

/* Avatar visibility and styles controlled via inline JS */

.call-tile__name {
  background: oklch(0 0 0 / 0.6);
  border-radius: 0.25rem;
  color: white;
  font-size: 1.2rem;
  inset-block-end: 1.5rem;
  inset-inline-start: 1.5rem;
  padding: 0.4em 1em;
  position: absolute;
}

.call-tile--local .call-tile__name {
  font-size: 1rem;
  inset-block-end: 0.5rem;
  inset-inline-start: 0.5rem;
  padding: 0.25em 0.6em;
}

.call-chat-sidebar {
  background: white;
  border-inline-start: 1px solid oklch(0.3 0 0);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: fixed;
  right: 0;
  top: 0;
  width: 380px;
  z-index: 5;
}

.call-chat-sidebar__header {
  align-items: center;
  background: oklch(0.95 0 0);
  border-block-end: 1px solid oklch(0.85 0 0);
  color: oklch(0.2 0 0);
  display: flex;
  flex-shrink: 0;
  font-size: 1rem;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

.call-chat-sidebar__close {
  background: none;
  border: none;
  color: oklch(0.4 0 0);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
}

.call-chat-sidebar__iframe {
  border: none;
  flex: 1;
  width: 100%;
}

@media (max-width: 768px) {
  .call-chat-sidebar {
    width: 100%;
  }
}

.call-settings {
  background: oklch(0.18 0 0 / 0.9);
  backdrop-filter: blur(10px);
  border-radius: 0.75rem;
  bottom: 5rem;
  color: white;
  left: 50%;
  max-width: 320px;
  position: absolute;
  transform: translateX(-50%);
  width: 90%;
  z-index: 4;
}

.call-settings__inner {
  padding: 1.25rem;
}

.call-settings__header {
  align-items: center;
  display: flex;
  font-size: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.call-settings__close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
}

.call-settings__label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  margin-top: 0.75rem;
  opacity: 0.7;
}

.call-settings__select {
  border: none;
  width: 100%;
}

.call-settings .ts-wrapper {
  border: none;
}

.call-settings .ts-wrapper input,
.call-settings .ts-wrapper .ts-control > input {
  display: none !important;
}

.call-settings .ts-wrapper.dropdown-active .ts-control {
  background: oklch(0.25 0 0);
  color: white;
}

/* Tom Select dark theme override */
.call-settings .ts-wrapper .ts-control {
  background: oklch(0.25 0 0) !important;
  border: 1px solid oklch(0.35 0 0);
  border-radius: 0.4rem;
  color: white !important;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.5rem;
}

.call-settings .ts-wrapper .ts-control .item {
  color: white;
}

.call-settings .ts-wrapper .ts-dropdown {
  background: oklch(0.22 0 0);
  border: 1px solid oklch(0.35 0 0);
  color: white;
}

.call-settings .ts-wrapper .ts-dropdown .option {
  color: white;
}

.call-settings .ts-wrapper .ts-dropdown .active {
  background: oklch(0.35 0 0);
}

.call-settings .ts-wrapper .ts-dropdown .option:hover {
  background: oklch(0.3 0 0);
}

.call-controls {
  align-items: center;
  background: oklch(0.18 0 0 / 0.85);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  display: flex;
  gap: 0.75rem;
  inset-block-end: 1.5rem;
  inset-inline-start: 50%;
  justify-content: center;
  opacity: 0;
  padding: 0.75em 1.5em;
  position: absolute;
  transform: translateX(-50%);
  transition: opacity 0.3s ease;
  z-index: 3;
}

.call-container:hover .call-controls,
.call-container--controls-visible .call-controls {
  opacity: 1;
}

.call-btn {
  align-items: center;
  aspect-ratio: 1;
  background: oklch(0.3 0 0);
  block-size: 3.2em;
  border: 1px solid oklch(0.35 0 0);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 0;
}

.call-btn:hover {
  background: oklch(0.4 0 0);
}

.call-btn.btn--active {
  background: white;
  border-color: white;
  color: oklch(0.15 0 0);
}

.call-btn--leave {
  background: oklch(0.55 0.25 25);
  border-color: oklch(0.55 0.25 25);
}

.call-btn--leave:hover {
  background: oklch(0.45 0.25 25);
}

.call-btn .icon-on,
.call-btn .icon-off {
  display: inline-flex;
  align-items: center;
}

/* Chat embed (inside call sidebar iframe) */
.chat-embed {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
  height: 100dvh;
  overflow: hidden;
  background: #fafafa;
}

.chat-embed__container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
}

.chat-embed__messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.chat-embed__msg {
  margin-bottom: 0.75rem;
  max-width: 85%;
}

.chat-embed__msg--me {
  margin-left: auto;
  text-align: right;
}

.chat-embed__meta {
  margin-bottom: 0.15rem;
}

.chat-embed__author {
  font-weight: 600;
  font-size: 0.8rem;
  color: #333;
}

.chat-embed__time {
  color: #aaa;
  font-size: 0.7rem;
  margin-left: 0.3rem;
}

.chat-embed__bubble {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 1rem 1rem 1rem 0.25rem;
  display: inline-block;
  font-size: 0.88rem;
  line-height: 1.4;
  padding: 0.5rem 0.85rem;
  text-align: left;
  word-break: break-word;
}

.chat-embed__msg--me .chat-embed__bubble {
  background: oklch(0.25 0 0);
  border-color: oklch(0.25 0 0);
  border-radius: 1rem 1rem 0.25rem 1rem;
  color: white;
}

.chat-embed__composer {
  background: white;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
  padding: 0.5rem;
}

.chat-embed__input-row {
  align-items: center;
  display: flex;
  gap: 0.4rem;
}

.chat-embed__input {
  border: 1px solid #ddd;
  border-radius: 1.5rem;
  flex: 1;
  font-size: 0.88rem;
  outline: none;
  padding: 0.55rem 1rem;
}

.chat-embed__input:focus {
  border-color: #888;
}

.chat-embed__drop-zone {
  align-items: center;
  background: oklch(0.95 0.05 220 / 0.9);
  border: 2px dashed oklch(0.6 0.1 220);
  border-radius: 0.5rem;
  color: oklch(0.4 0.1 220);
  display: flex;
  font-size: 0.9rem;
  font-weight: 600;
  inset: 0;
  justify-content: center;
  position: absolute;
  z-index: 10;
}

.chat-embed__file-btn {
  align-items: center;
  color: #666;
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  padding: 0.3rem;
}

.chat-embed__file-btn:hover {
  color: #333;
}

.chat-embed__file-input {
  clip: rect(0, 0, 0, 0);
  height: 1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.chat-embed__file-preview {
  color: #666;
  display: none;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.chat-embed__attachment {
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.chat-embed__image {
  border-radius: 0.5rem;
  display: block;
  max-width: 100%;
}

.chat-embed__video {
  border-radius: 0.5rem;
  display: block;
  max-width: 100%;
}

.chat-embed__file-info {
  align-items: center;
  display: flex;
  font-size: 0.75rem;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.chat-embed__file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-embed__file-size {
  color: #999;
  flex-shrink: 0;
}

.chat-embed__download {
  align-items: center;
  background: oklch(0.9 0 0);
  border-radius: 50%;
  color: #333;
  display: inline-flex;
  flex-shrink: 0;
  justify-content: center;
  padding: 0.25rem;
}

.chat-embed__download:hover {
  background: oklch(0.8 0 0);
}

.chat-embed__msg--me .chat-embed__download {
  background: oklch(0.4 0 0);
  color: white;
}

.chat-embed__msg--me .chat-embed__file-size {
  color: oklch(0.7 0 0);
}

.chat-embed__send {
  align-items: center;
  aspect-ratio: 1;
  background: oklch(0.25 0 0);
  block-size: 2.4rem;
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  font-size: 1.3rem;
  justify-content: center;
  line-height: 1;
}
