/* Atlas Day 4.9.8: secure attachments, realtime transport and hold-to-record. */

.atlas-attach-input {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.neo-chat .compose-tools .atlas-attach-button {
  align-items: center;
  border-color: rgba(96, 239, 255, .34);
  border-radius: 14px;
  display: inline-flex;
  font-size: 18px;
  height: 44px;
  justify-content: center;
  min-width: 44px;
  padding: 0;
}

.neo-chat .compose-tools .atlas-icon-tool {
  align-items: center;
  border-radius: 50%;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  min-width: 44px;
  padding: 0;
  width: 44px;
}

.neo-chat .compose-tools .atlas-icon-tool svg {
  fill: none;
  height: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 21px;
}

.neo-chat .compose-tools .atlas-icon-voice,
.neo-chat .compose-tools .atlas-icon-video {
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.neo-chat .compose-tools .atlas-hold-arming,
.neo-chat .compose-tools .atlas-hold-recording,
.neo-chat .compose-tools .atlas-hold-sending {
  border-color: #60efff;
  box-shadow: 0 0 0 4px rgba(96, 239, 255, .14), 0 0 18px rgba(96, 239, 255, .34);
}

.neo-chat .compose-tools .atlas-hold-recording {
  animation: atlas-hold-pulse .85s ease-in-out infinite alternate;
  background: rgba(239, 68, 68, .2);
  border-color: #ff6b6b;
  color: #fff;
}

.neo-chat .compose-tools .atlas-hold-cancel {
  animation: none;
  background: rgba(100, 116, 139, .32);
  border-color: #94a3b8;
  box-shadow: none;
}

.neo-chat .compose-tools .atlas-hold-sending {
  cursor: progress;
  opacity: .7;
}

@keyframes atlas-hold-pulse {
  from { transform: scale(.96); }
  to { transform: scale(1.06); }
}

.atlas-attachment-queue {
  display: flex;
  gap: 8px;
  margin: 8px 12px 10px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.atlas-attach-item {
  align-items: center;
  background: rgba(15, 17, 26, .62);
  border: 1px solid rgba(96, 239, 255, .26);
  border-radius: 14px;
  color: #f6f8ff;
  display: grid;
  flex: 0 0 min(310px, 82vw);
  gap: 8px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  min-height: 62px;
  padding: 9px;
  position: relative;
}

.atlas-attach-thumb {
  align-items: center;
  background: linear-gradient(135deg, rgba(65, 88, 208, .55), rgba(96, 239, 255, .22));
  border-radius: 11px;
  color: #dffbff;
  display: grid;
  font-size: 10px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  overflow: hidden;
  width: 42px;
  grid-row: 1 / span 2;
}

.atlas-attach-thumb img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.atlas-attach-info {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.atlas-attach-info strong,
.atlas-attach-info small,
.atlas-attach-status {
  display: block;
}

.atlas-attach-info strong {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-attach-info small,
.atlas-attach-status {
  color: #99a6c3;
  font-size: 9px;
  margin-top: 3px;
}

.atlas-attach-progress {
  background: rgba(255, 255, 255, .1);
  border-radius: 999px;
  bottom: 7px;
  height: 4px;
  left: 59px;
  overflow: hidden;
  position: absolute;
  right: 96px;
}

.atlas-attach-progress i {
  background: linear-gradient(90deg, #00ff87, #60efff);
  border-radius: inherit;
  display: block;
  height: 100%;
  transition: width .18s ease;
  width: 0;
}

.atlas-attach-buttons {
  align-items: center;
  display: flex;
  gap: 4px;
  grid-column: 3;
  grid-row: 1 / span 2;
}

.atlas-attach-status {
  grid-column: 2;
  grid-row: 2;
}

.atlas-attach-remove,
.atlas-attach-retry {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  color: #fff;
  height: 32px;
  line-height: 1;
  padding: 0;
  width: 32px;
}

.atlas-attach-retry {
  color: #8af4ff;
}

.atlas-attach-retry[hidden] {
  display: none;
}

.atlas-attach-item[data-status="error"] {
  border-color: rgba(239, 68, 68, .52);
}

.atlas-attach-item[data-status="error"] .atlas-attach-status {
  color: #ffb1b1;
}

.neo-chat.atlas-drop-active .neo-chat-main {
  outline: 2px dashed rgba(96, 239, 255, .72);
  outline-offset: -8px;
}

.atlas-file-card {
  display: grid;
  gap: 7px;
  margin-top: 7px;
  max-width: min(360px, 100%);
}

.atlas-file-image {
  border-radius: 12px;
  display: block;
  max-height: 240px;
  overflow: hidden;
}

.atlas-file-image img {
  display: block;
  height: 100%;
  max-height: 240px;
  object-fit: cover;
  width: 100%;
}

.atlas-file-document {
  align-items: center;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(96, 239, 255, .22);
  border-radius: 12px;
  color: inherit;
  display: grid;
  gap: 4px 10px;
  grid-template-columns: 42px minmax(0, 1fr);
  min-height: 58px;
  padding: 9px;
  text-decoration: none;
}

.atlas-file-document span {
  align-items: center;
  background: linear-gradient(135deg, #4158d0, #60efff);
  border-radius: 10px;
  color: #fff;
  display: grid;
  font-size: 9px;
  font-weight: 900;
  grid-row: span 2;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.atlas-file-document strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-file-document small {
  color: #9ca7bf;
  font-size: 9px;
}

.atlas-file-video-player {
  aspect-ratio: 16 / 9;
  background: #0f111a;
  border-radius: 12px;
  display: block;
  max-height: 260px;
  object-fit: contain;
  width: min(360px, 100%);
}

.atlas-regular-video-message .video-circle-shell {
  display: none;
}

.atlas-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.atlas-file-actions a,
.atlas-file-actions button {
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(96, 239, 255, .24);
  border-radius: 999px;
  color: #d8e8ff;
  font-size: 9px;
  font-weight: 850;
  min-height: 36px;
  padding: 9px 11px;
  text-decoration: none;
}

.atlas-file-actions button {
  cursor: pointer;
}

.atlas-toast-host {
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  left: 50%;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%);
  z-index: 7000;
}

.atlas-toast {
  background: rgba(15, 17, 26, .94);
  border: 1px solid rgba(96, 239, 255, .28);
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
  color: #fff;
  font-size: 12px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
}

.atlas-toast-error {
  border-color: rgba(239, 68, 68, .5);
}

.atlas-toast-success {
  border-color: rgba(16, 185, 129, .55);
}

@media (width <= 760px) {
  .neo-chat .compose-tools .atlas-attach-button {
    height: 44px;
    min-width: 44px;
  }

  .atlas-attachment-queue {
    margin-left: 8px;
    margin-right: 8px;
  }

  .atlas-file-card {
    max-width: 100%;
  }

  .atlas-file-image,
  .atlas-file-image img {
    max-height: 210px;
  }

  .atlas-attach-remove,
  .atlas-attach-retry,
  .atlas-file-actions a,
  .atlas-file-actions button {
    min-height: 44px;
  }

  .atlas-attach-remove,
  .atlas-attach-retry {
    width: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-attach-progress i,
  .neo-chat .compose-tools .atlas-hold-recording {
    animation: none;
    transition: none;
  }
}
