/* image-uploader.css · 图片上传 UI 样式 */

/* === 字段内的上传区(替代原 URL 输入 + alt + fit) === */

.iu-image-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.iu-drop-zone {
  position: relative;
  border: 1.5px dashed #D4D4D4;
  border-radius: 6px;
  padding: 12px;
  background: #FAFAFA;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.iu-drop-zone:hover {
  border-color: #0066FF;
  background: #F4F8FF;
}

.iu-drop-zone.dragover {
  border-color: #0066FF;
  border-style: solid;
  background: #DBEAFE;
  transform: scale(1.01);
}

.iu-drop-zone-empty {
  flex-direction: column;
  justify-content: center;
  min-height: 80px;
  text-align: center;
}

.iu-icon {
  font-size: 22px;
  color: #A3A3A3;
}

.iu-drop-zone-empty .iu-icon {
  font-size: 28px;
}

.iu-text {
  font-size: 11px;
  color: #525252;
  line-height: 1.4;
}

.iu-text strong {
  color: #1A1A1A;
}

.iu-text .iu-link {
  color: #0066FF;
  text-decoration: underline;
}

.iu-hidden-input {
  display: none;
}

/* 已上传图: 缩略图 + 文件名 + 大小 + 操作 */
.iu-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  background: #FFF;
  border: 1px solid #E5E5E5;
  border-radius: 4px;
}

.iu-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.iu-thumb {
  width: 56px;
  height: 38px;
  object-fit: cover;
  border-radius: 3px;
  background: #F4F4F5;
  border: 1px solid #E5E5E5;
  flex-shrink: 0;
}

.iu-preview-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.iu-preview-name {
  font-size: 11px;
  color: #1A1A1A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iu-preview-meta {
  font-size: 10px;
  color: #737373;
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iu-badge {
  display: inline-block;
  padding: 0 4px;
  background: #DCFCE7;
  color: #166534;
  border-radius: 3px;
  font-size: 9px;
  margin-left: 4px;
}

.iu-preview-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.iu-action-btn {
  background: transparent;
  border: 1px solid #E5E5E5;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 10px;
  color: #525252;
  cursor: pointer;
  white-space: nowrap;
}

.iu-action-btn:hover {
  background: #F4F4F5;
  color: #1A1A1A;
}

.iu-action-btn.danger:hover {
  background: #FEE2E2;
  color: #991B1B;
  border-color: #FECACA;
}

/* 拖到 preview 也支持替换 */
.iu-preview.dragover {
  border-color: #0066FF;
  background: #DBEAFE;
}

/* === URL 模式切换 === */

.iu-url-row {
  display: flex;
  gap: 4px;
}

.iu-url-input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #D4D4D4;
  border-radius: 4px;
  font-size: 11px;
  background: #FFF;
  font-family: ui-monospace, monospace;
}

/* === 弹框 === */

.iu-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: iu-fade-in 0.15s;
}

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

.iu-dialog {
  background: #FFF;
  border-radius: 12px;
  padding: 24px;
  width: 440px;
  max-width: 90vw;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.iu-dialog h3 {
  margin: 0 0 16px;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.iu-file-info {
  padding: 10px 12px;
  background: #FAFAFA;
  border: 1px solid #E5E5E5;
  border-radius: 6px;
  margin-bottom: 12px;
}

.iu-file-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  word-break: break-all;
}

.iu-file-meta {
  font-size: 11px;
  color: #737373;
  font-family: ui-monospace, monospace;
}

.iu-dialog .iu-hint {
  font-size: 12px;
  color: #525252;
  line-height: 1.5;
  margin: 0 0 16px;
}

.iu-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.iu-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  padding: 12px 16px;
  background: #FFF;
  border: 1.5px solid #E5E5E5;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.iu-btn:hover {
  border-color: #0066FF;
  background: #F4F8FF;
}

.iu-btn strong {
  font-size: 14px;
  color: #1A1A1A;
  font-weight: 600;
  margin-bottom: 2px;
}

.iu-btn span {
  font-size: 11px;
  color: #737373;
  font-family: ui-monospace, monospace;
}

.iu-btn-compress {
  border-color: #0066FF;
}

.iu-btn-compress strong::after {
  content: '★';
  margin-left: 6px;
  color: #0066FF;
}

.iu-btn-cancel {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid #E5E5E5;
  border-radius: 6px;
  color: #737373;
  font-size: 13px;
  cursor: pointer;
}

.iu-btn-cancel:hover {
  background: #F4F4F5;
  color: #1A1A1A;
}

/* ============ 附件上传(doc-parser)============ */

.attach-zone {
  margin: 12px 0 14px;
}

.attach-drop {
  position: relative;
  border: 1.5px dashed #D4D4D4;
  border-radius: 6px;
  padding: 10px 14px;
  background: #FAFAFA;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.attach-drop:hover {
  border-color: #0066FF;
  background: #F4F8FF;
}

.attach-drop.dragover {
  border-color: #0066FF;
  border-style: solid;
  background: #DBEAFE;
}

.attach-icon {
  font-size: 22px;
}

.attach-text {
  flex: 1;
  font-size: 12px;
  color: #525252;
  line-height: 1.45;
}

.attach-text strong {
  color: #1A1A1A;
}

.attach-link {
  color: #0066FF;
  text-decoration: underline;
}

.attach-formats {
  display: block;
  font-size: 10px;
  color: #A3A3A3;
  font-family: ui-monospace, monospace;
  margin-top: 2px;
}

.attach-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.attach-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #FFF;
  border: 1px solid #E5E5E5;
  border-radius: 4px;
  font-size: 12px;
}

.attach-item.parsing {
  background: #FEF3C7;
  border-color: #FCD34D;
}

.attach-item.error {
  background: #FEE2E2;
  border-color: #FECACA;
}

.attach-item.ok {
  border-color: #E5E5E5;
}

.attach-item-icon {
  font-size: 16px;
  flex-shrink: 0;
}

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

.attach-item-name {
  font-size: 12px;
  color: #1A1A1A;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attach-item-meta {
  font-size: 10px;
  color: #737373;
  font-family: ui-monospace, monospace;
}

.attach-item-status {
  font-size: 11px;
  font-family: ui-monospace, monospace;
}

.attach-item.parsing .attach-item-status {
  color: #92400E;
}

.attach-item.error .attach-item-status {
  color: #991B1B;
}

.attach-item.ok .attach-item-status {
  color: #166534;
}

.attach-item-preview {
  background: transparent;
  border: 1px solid #E5E5E5;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 10px;
  color: #525252;
  cursor: pointer;
}

.attach-item-preview:hover {
  background: #F4F4F5;
}

.attach-item-remove {
  background: transparent;
  border: 1px solid #E5E5E5;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 10px;
  color: #525252;
  cursor: pointer;
}

.attach-item-remove:hover {
  background: #FEE2E2;
  color: #991B1B;
  border-color: #FECACA;
}

/* 预览弹窗 */
.attach-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-preview-box {
  background: #FFF;
  border-radius: 12px;
  padding: 20px 24px;
  width: 800px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.attach-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.attach-preview-header h3 {
  margin: 0;
  font-size: 14px;
}

.attach-preview-text {
  flex: 1;
  background: #FAFAFA;
  border: 1px solid #E5E5E5;
  border-radius: 6px;
  padding: 12px;
  overflow-y: auto;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  line-height: 1.5;
}
