/* Loaded right after chat.css (index.html keeps this order, so the cascade is unchanged). */
/* Files shared in messages and the files tab of a channel */

.chat-file-badge {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.chat-file-badge[data-category="pdf"] {
  background: rgba(180, 35, 24, 0.1);
  color: var(--red);
}

.chat-file-badge[data-category="archive"] {
  background: rgba(140, 87, 0, 0.12);
  color: var(--amber);
}

.chat-file-badge[data-category="document"] {
  background: rgba(36, 95, 190, 0.1);
  color: var(--blue);
}

.chat-file-badge[data-category="image"],
.chat-file-badge[data-category="video"],
.chat-file-badge[data-category="audio"] {
  background: rgba(111, 66, 165, 0.1);
  color: var(--purple);
}

.chat-files {
  display: grid;
  gap: 6px;
  max-width: 460px;
  margin-top: 6px;
}

.chat-file-card {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
}

.chat-file-preview {
  flex: none;
  line-height: 0;
}

.chat-file-preview img {
  width: 56px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  object-fit: cover;
  object-position: top;
}

.chat-file-meta {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.chat-file-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-file-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-file-actions {
  display: flex;
  flex: none;
  gap: 10px;
  align-items: center;
}

.chat-file-link {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.chat-file-link:hover {
  text-decoration: underline;
}

.chat-files-tab {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 0;
  padding: 14px 18px;
  overflow-y: auto;
}

.chat-files-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-files-filter {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-solid);
}

.chat-files-status {
  margin: 0;
  color: var(--muted);
}

.chat-files-status:empty {
  display: none;
}

.chat-files-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-files-more {
  justify-self: start;
}

@media (max-width: 640px) {
  .chat-file-card {
    flex-wrap: wrap;
  }

  .chat-file-actions {
    justify-content: flex-end;
    width: 100%;
  }
}

/* Phones (<html data-chat-layout="phone">, mobile_shell.js): 44 px targets on file cards and on the
   remove button of an attachment in the composer, readable details. */
html[data-chat-layout="phone"] .chat-file-actions {
  gap: 4px;
}

html[data-chat-layout="phone"] .chat-file-link {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 15px;
}

html[data-chat-layout="phone"] .chat-file-detail {
  font-size: 13px;
}

/* The remove button sits in the attachment's row instead of on its corner (a 44 px target there
   would cover the neighbour). */
html[data-chat-layout="phone"] .chat-attachment {
  padding-right: 0;
}

html[data-chat-layout="phone"] .chat-attachment button {
  position: static;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted-bright);
  font-size: 22px;
}
