/* ============================================
 * COMMENT ATTACHMENTS STYLES
 * ============================================ */

/* ============================================
 * ATTACHMENT UPLOAD SECTION
 * ============================================ */

.attachment-upload-section {
  margin-top: var(--space-4);
  border-top: 1px solid var(--color-neutral-200);
  padding-top: var(--space-4);
}

/* Dropzone */
.attachment-upload-dropzone {
  border: 2px dashed var(--color-neutral-300);
  border-radius: 8px;
  background: var(--color-neutral-50);
  transition: all 0.2s ease;
}

.attachment-upload-dropzone:hover,
.dropzone--active {
  border-color: var(--color-primary-400);
  background: var(--color-primary-50);
}

.attachment-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  cursor: pointer;
  text-align: center;
  gap: var(--space-2);
}

.attachment-upload-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--color-primary-100);
  color: var(--color-primary-600);
  border-radius: 50%;
}

.attachment-upload-text {
  font-size: var(--text-sm);
  color: var(--color-neutral-600);
}

.attachment-upload-text strong {
  color: var(--color-primary-600);
}

.attachment-upload-hint {
  font-size: var(--text-xs);
  color: var(--color-neutral-400);
}

/* ============================================
 * ATTACHMENT PREVIEW (Uploading State)
 * ============================================ */

.attachment-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.attachment-preview-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-200);
  border-radius: 6px;
  position: relative;
  min-width: 200px;
  max-width: 300px;
}

.attachment-preview-item--uploading {
  opacity: 0.8;
}

.attachment-preview-item--uploaded {
  background: var(--color-success-50);
  border-color: var(--color-success-200);
}

.attachment-preview-item--error {
  background: var(--color-error-50);
  border-color: var(--color-error-200);
}

.attachment-preview-thumbnail {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  background: var(--color-neutral-200);
}

.attachment-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-file-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--icon-color, var(--color-neutral-400));
  position: relative;
}

.attachment-preview-ext {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--icon-color, var(--color-neutral-500));
  position: absolute;
  bottom: 2px;
}

.attachment-preview-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attachment-preview-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-neutral-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-preview-size {
  font-size: var(--text-xs);
  color: var(--color-neutral-400);
}

.attachment-preview-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-neutral-200);
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}

.attachment-preview-progress-bar {
  height: 100%;
  background: var(--color-primary-500);
  transition: width 0.2s ease;
}

.attachment-preview-remove {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--color-neutral-400);
  cursor: pointer;
  transition: all 0.15s ease;
}

.attachment-preview-remove:hover {
  background: var(--color-neutral-200);
  color: var(--color-error-500);
}

.attachment-preview-error-text {
  font-size: var(--text-xs);
  color: var(--color-error-600);
}

/* ============================================
 * ATTACHMENT ERROR
 * ============================================ */

.attachment-error {
  display: none;
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
  background: var(--color-error-50);
  border: 1px solid var(--color-error-200);
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--color-error-700);
}

.attachment-error--visible {
  display: block;
}

/* ============================================
 * ATTACHMENTS LIST SECTION (Displayed Attachments)
 * ============================================ */

.attachments-section {
  padding: var(--space-4);
  border-top: 1px solid var(--color-neutral-100);
}

.attachments-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-neutral-700);
  margin: 0 0 var(--space-3) 0;
}

.attachments-section-title svg {
  color: var(--color-neutral-400);
}

.attachments-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-1);
  background: var(--color-neutral-200);
  color: var(--color-neutral-600);
  border-radius: 10px;
  font-size: var(--text-xs);
  font-weight: 500;
}

.attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ============================================
 * ATTACHMENT ITEM (Displayed Attachment)
 * ============================================ */

.attachment-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-neutral-50);
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
  transition: all 0.15s ease;
  min-width: 200px;
  max-width: 300px;
}

.attachment-item:hover {
  background: var(--color-neutral-100);
  border-color: var(--color-neutral-300);
}

/* Thumbnail for images */
.attachment-thumbnail {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-neutral-200);
}

.attachment-thumbnail-link {
  display: block;
  width: 100%;
  height: 100%;
}

.attachment-thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.attachment-thumbnail-link:hover .attachment-thumbnail-img {
  transform: scale(1.05);
}

/* Icon for non-image files */
.attachment-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-neutral-100);
  border-radius: 6px;
  color: var(--color-neutral-400);
  position: relative;
}

.attachment-icon[data-extension="pdf"] {
  color: var(--color-error-500);
  background: var(--color-error-50);
}

.attachment-icon[data-extension="txt"],
.attachment-icon[data-extension="md"],
.attachment-icon[data-extension="json"] {
  color: var(--color-primary-500);
  background: var(--color-primary-50);
}

.attachment-icon[data-extension="zip"] {
  color: var(--color-warning-600);
  background: var(--color-warning-50);
}

.attachment-icon-ext {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Info section */
.attachment-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attachment-filename {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-neutral-800);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-filename:hover {
  color: var(--color-primary-600);
  text-decoration: underline;
}

.attachment-meta {
  font-size: var(--text-xs);
  color: var(--color-neutral-400);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.attachment-meta-separator {
  color: var(--color-neutral-300);
}

/* Remove button */
.attachment-remove-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--color-neutral-400);
  cursor: pointer;
  transition: all 0.15s ease;
}

.attachment-remove-btn:hover {
  background: var(--color-error-50);
  border-color: var(--color-error-200);
  color: var(--color-error-500);
}

/* ============================================
 * RESPONSIVE ADJUSTMENTS
 * ============================================ */

@media (width <= 768px) {
  .attachment-upload-dropzone {
    padding: var(--space-3);
  }

  .attachment-upload-label {
    padding: var(--space-4) var(--space-3);
  }

  .attachment-preview-item,
  .attachment-item {
    min-width: 100%;
    max-width: 100%;
  }

  .attachments-list {
    flex-direction: column;
  }
}

/* ============================================
 * VISUALLY HIDDEN UTILITY
 * ============================================ */

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
