/* ================================================================
   FILE UPLOAD — Drop Area
   ================================================================ */

.file-upload-wrapper {
  margin-top: 8px;
  width: 100%;
  max-width: 440px;
}

.file-upload-drop-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed #d1d1d1;
  border-radius: 10px;
  padding: 18px 16px;
  cursor: pointer;
  background: white;
  min-height: 80px;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.file-upload-drop-area:hover,
.file-upload-drop-area:focus {
  border-color: #29abe2;
  background: rgba(41, 171, 226, 0.04);
  outline: none;
}

.file-upload-icon {
  font-size: 26px;
  color: #2a3647;
  pointer-events: none;
}

.file-upload-label {
  font-size: 16px;
  color: #2a3647;
  font-weight: 500;
  pointer-events: none;
}

.file-upload-hint {
  font-size: 14px;
  color: #a8a8a8;
  pointer-events: none;
}

.file-upload-error {
  color: red;
  font-size: 14px;
  margin-top: 4px;
  min-height: 20px;
  visibility: hidden;
}

/* ================================================================
   FILE UPLOAD — Preview List
   ================================================================ */

.file-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  max-height: 160px;
  overflow-y: auto;
  padding-right: 2px;
  padding-bottom: 2px;
}

.file-preview-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f6f7f8;
  border-radius: 8px;
  padding: 4px 8px;
}

.preview-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  border: 1px solid #e0e0e0;
}

.preview-thumb:focus {
  outline: 2px solid #29abe2;
  outline-offset: 2px;
}

.preview-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.preview-name {
  font-size: clamp(14px, 1.4vw, 16px);
  color: #2a3647;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-size {
  font-size: 14px;
  color: #a8a8a8;
}

.preview-remove {
  background: none;
  border: none;
  font-size: 22px;
  color: #a8a8a8;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.preview-remove:hover {
  color: #ff3d00;
}

.preview-remove:focus {
  outline: 2px solid #29abe2;
  border-radius: 4px;
}

/* ================================================================
   TASK DETAIL — Attachment Section
   ================================================================ */

.task-detail-attachments {
  margin-top: 16px;
  margin-bottom: 8px;
}

.task-detail-attachments-title {
  font-size: 16px;
  font-weight: 700;
  color: #2a3647;
  display: block;
  margin-bottom: 10px;
}

.attachment-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.attachment-detail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100px;
}

.attachment-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #d1d1d1;
  transition: border-color 0.2s;
}

.attachment-thumb:hover {
  border-color: #29abe2;
}

.attachment-thumb:focus {
  outline: 2px solid #29abe2;
  outline-offset: 2px;
}

.attachment-detail-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  text-align: center;
}

.attachment-name {
  font-size: 14px;
  color: #2a3647;
  font-weight: 500;
  word-break: break-word;
  text-align: center;
  line-height: 1.2;
}

.attachment-size {
  font-size: 14px;
  color: #a8a8a8;
}

.attachment-download-btn {
  font-size: 14px;
  background: none;
  border: 1px solid #d1d1d1;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: #2a3647;
  width: 100%;
  margin-top: auto;
  transition: border-color 0.2s, color 0.2s;
}

.attachment-download-btn:hover,
.attachment-download-btn:focus {
  border-color: #29abe2;
  color: #29abe2;
  outline: none;
}

/* ================================================================
   IMAGE VIEWER — Overlay & Modal
   ================================================================ */

.image-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-overlay.d-none {
  display: none;
}

.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.image-viewer-modal {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  background: #1c1c1c;
  border-radius: 12px;
  max-width: 92vw;
  max-height: 92vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.image-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #333;
  gap: 12px;
  min-width: 0;
}

.viewer-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.viewer-filename {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.viewer-meta {
  font-size: 14px;
  color: #a0a0a0;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.viewer-counter {
  font-size: 16px;
  color: #a0a0a0;
  min-width: 40px;
  text-align: right;
}

.viewer-btn {
  background: #2e2e2e;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 18px;
  padding: 6px 12px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s;
}

.viewer-btn:hover,
.viewer-btn:focus {
  background: #444;
  outline: none;
}

.viewer-close-btn {
  font-size: 16px;
}

.image-viewer-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 12px;
  flex: 1;
  min-height: 300px;
}

.viewer-image {
  max-width: calc(92vw - 130px);
  max-height: calc(92vh - 120px);
  object-fit: contain;
  border-radius: 4px;
  display: block;
}

.viewer-nav {
  background: #2e2e2e;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 30px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.2s;
}

.viewer-nav:hover:not(:disabled),
.viewer-nav:focus:not(:disabled) {
  background: #444;
  outline: none;
}

.viewer-nav:disabled {
  opacity: 0.25;
  cursor: default;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 600px) {
  .file-upload-wrapper {
    max-width: 100%;
  }

  .attachment-detail-item {
    width: 80px;
  }

  .attachment-thumb {
    width: 64px;
    height: 64px;
  }

  .viewer-image {
    max-width: calc(92vw - 90px);
  }

  .viewer-nav {
    width: 38px;
    height: 38px;
    font-size: 24px;
  }

  .viewer-filename {
    max-width: 140px;
  }
}

@media (max-width: 400px) {
  .viewer-nav {
    width: 32px;
    height: 32px;
    font-size: 20px;
  }
}
