/* ========================================================================== */
/* Attachment Card Styles                                                     */
/* ========================================================================== */

.attachment-card {
  display: block;
  margin: 8px 0;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.attachment-card:hover {
  transform: translateY(-1px);
}

.attachment-image {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 280px;
}

.attachment-image:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.attachment-img {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  cursor: pointer;
  filter: brightness(var(--xbot-img-brightness, 1));
  transition: filter 0.2s ease;
}

.attachment-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.15);
}

.attachment-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  text-decoration: none;
  color: white;
  transition: background 0.15s ease;
  max-width: 280px;
}

.attachment-file:hover {
  background: rgba(255, 255, 255, 0.18);
}

.attachment-file-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.attachment-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.8);
}

.attachment-file-info .truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-file-info span:last-child {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}


/* ---- Media attachment wrapper ---- */
.attachment-media {
  background: transparent;
  border: none;
  padding: 0;
  max-width: 400px;
}
/* ---- Light theme overrides ---- */
[data-theme="light"] .attachment-image {
  background: rgba(0, 0, 0, 0.04);
  border-color: #d1cdc7;
}
[data-theme="light"] .attachment-image:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .attachment-meta {
  color: #78716c;
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .attachment-file {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}
[data-theme="light"] .attachment-file:hover {
  background: #e2e8f0;
}
[data-theme="light"] .attachment-file-icon {
  background: #e2e8f0;
}

/* ---- Image Preview Lightbox ---- */

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  animation: image-preview-fade-in 0.2s ease-out;
}

.image-preview-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  cursor: default;
  filter: brightness(var(--xbot-img-brightness, 1));
  transition: filter 0.2s ease;
}

.image-preview-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

@keyframes image-preview-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
