/**
 * XFactorAI File Upload Styles
 * Styles for drag-drop overlay, file badges, and loading states
 * 
 * @version 4.1.0
 */

/* ========================================
   DROP OVERLAY
   ======================================== */

.input-area__overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 2px dashed var(--color-primary, #2563EB);
  border-radius: var(--radius-lg, 12px);
  z-index: 10;
  pointer-events: none;
  transition: all 0.2s ease;
}

.input-area__overlay.is-active {
  display: flex;
}

.input-area__overlay.is-loading {
  display: flex;
  background: rgba(255, 255, 255, 0.95);
  border-style: solid;
}

.input-area__overlay-icon {
  font-size: 48px;
  opacity: 0.8;
}

.input-area__overlay-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-primary, #2563EB);
}

/* ========================================
   FILE BADGE
   ======================================== */

.file-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 8px;
  background: var(--color-surface, #f8fafc);
  border: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
  border-radius: var(--radius-md, 8px);
  font-size: 13px;
}

.file-badge__icon {
  font-size: 18px;
  flex-shrink: 0;
}

.file-badge__name {
  flex: 1;
  color: var(--color-text, #1a1a1a);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.file-badge__conf {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.file-badge__conf--high {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.file-badge__conf--medium {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.file-badge__conf--low {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.file-badge__remove {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--color-text-muted, #888);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.file-badge__remove:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border, rgba(0, 0, 0, 0.1));
  border-top-color: var(--color-primary, #2563EB);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.loading-spinner--lg {
  width: 32px;
  height: 32px;
  border-width: 4px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   INPUT AREA STATES
   ======================================== */

.input-area {
  position: relative;
}

.input-area__textarea:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Drag over state for the whole input section */
.input-section.is-dragover .input-area {
  border-color: var(--color-primary, #2563EB);
  background: rgba(59, 130, 246, 0.02);
}

/* ========================================
   TOAST STYLES (if not already defined)
   ======================================== */

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--color-surface, #fff);
  color: var(--color-text, #1a1a1a);
  border: 1px solid var(--color-border, rgba(0, 0, 0, 0.1));
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  max-width: 360px;
  animation: toast-in 0.3s ease;
}

.toast--success {
  border-left: 4px solid #22c55e;
}

.toast--warning {
  border-left: 4px solid #f59e0b;
}

.toast--error {
  border-left: 4px solid #ef4444;
}

.toast--info {
  border-left: 4px solid #3b82f6;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   PARSE CONFIDENCE INDICATOR
   ======================================== */

.parse-confidence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.parse-confidence--high {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.parse-confidence--medium {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.parse-confidence--low {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.parse-confidence__icon {
  font-size: 14px;
}

/* ========================================
   FILE TYPE ICONS (for visual feedback)
   ======================================== */

[data-filetype="pdf"]::before { content: "📄"; }
[data-filetype="docx"]::before { content: "📝"; }
[data-filetype="xlsx"]::before { content: "📊"; }
[data-filetype="csv"]::before { content: "📊"; }
[data-filetype="html"]::before { content: "🌐"; }
[data-filetype="eml"]::before { content: "✉️"; }
[data-filetype="audio"]::before { content: "🎵"; }
[data-filetype="text"]::before { content: "📃"; }
