/* ──────────────────────────────────────────────────────────────────────────
   OpenDrawing — Upload package: hero drop zone, drag overlay, file chips
   Fonts + variables → tokens.css (load that first).
   ────────────────────────────────────────────────────────────────────────── */

@layer components {

/* ── ANIMATIONS ─────────────────────────────────────────────────────────── */
@keyframes od-fadeIn  { from { opacity:0; transform:translateY(8px) }  to { opacity:1; transform:none } }
@keyframes od-slideUp { from { opacity:0; transform:translateY(20px) scale(.98) } to { opacity:1; transform:none } }
@keyframes od-pulse   { 0%,100%{opacity:1} 50%{opacity:.4} }
@keyframes od-spin    { to{transform:rotate(360deg)} }
@keyframes od-glow    { 0%,100%{box-shadow:0 0 0 0 rgba(59,91,219,.3)} 50%{box-shadow:0 0 24px 6px rgba(59,91,219,.15)} }
@keyframes od-float   { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }

/* ── UPLOAD HERO ─────────────────────────────────────────────────────────── */
.upload-hero {
  width: 100%; height: 72px;
  border-radius: var(--radius-lg); margin-bottom: 24px;
  border: 1.5px dashed rgba(59,91,219,.35);
  background-color: var(--bg-surface);
  box-shadow: 0 4px 24px rgba(59,91,219,.10), 0 1px 4px rgba(0,0,0,.18);
  position: relative; outline: none; cursor: pointer;
  display: flex; flex-direction: row; align-items: center;
  gap: 16px; padding: 0 24px;
  transition: border-color .18s, background-color .15s, box-shadow .18s;

  &:hover {
    border-color: var(--accent);
    background-color: rgba(59,91,219,.04);
    box-shadow: 0 6px 32px rgba(59,91,219,.28), 0 1px 4px rgba(0,0,0,.2);
  }

  &:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
    border-color: var(--accent);
  }

  &.drag-over { border-color: var(--accent); background-color: rgba(59,91,219,.07); }
  &.has-file  { border-color: var(--success); border-style: solid; box-shadow: 0 4px 24px rgba(34,197,94,.10); }

  &:hover .drop-zone-icon-wrap,
  &.drag-over .drop-zone-icon-wrap {
    background: rgba(59,91,219,.22); border-color: rgba(59,91,219,.6);
    color: #7b96ff;
  }

  &.has-file .drop-zone-icon-wrap {
    background: var(--success-dim); border-color: rgba(34,197,94,.35);
    color: var(--success);
  }
}

/* ── Hero body text block ────────────────────────────────────────────────── */
.upload-hero-body {
  display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0;
}

/* ── WIZARD INLINE DROP ZONE (step 0) ───────────────────────────────────── */
.drop-zone {
  width: 100%; min-height: 160px;
  border-radius: var(--radius-lg);
  border: 1.5px dashed rgba(59,91,219,.25);
  background-color: var(--bg-hover);
  background-image:
    linear-gradient(rgba(59,91,219,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,91,219,.06) 1px, transparent 1px);
  background-size: 24px 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; position: relative; overflow: hidden;
  transition: border-color .18s, background-color .15s; outline: none;

  &:hover     { border-color: rgba(59,91,219,.5); background-color: rgba(59,91,219,.05); }
  &.drag-over { border-color: var(--accent); background-color: rgba(59,91,219,.08); }
  &.has-file  { border-color: rgba(34,197,94,.4); background-color: rgba(34,197,94,.04); }

  &:hover .drop-zone-icon-wrap,
  &.drag-over .drop-zone-icon-wrap {
    background: var(--accent-dim); border-color: var(--accent);
    box-shadow: 0 0 0 6px rgba(59,91,219,.12), 0 4px 16px rgba(59,91,219,.2);
    animation: od-glow 1.4s ease-in-out infinite;
  }

  &.has-file .drop-zone-icon-wrap {
    background: var(--success-dim); border-color: var(--success);
    color: var(--success); animation: none;
  }
}

.drop-zone-input { display: none; }

/* ── UPLOAD ICON WRAP ────────────────────────────────────────────────────── */
.drop-zone-icon-wrap {
  width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--accent-dim); border: 1px solid rgba(59,91,219,.25);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
  transition: all .18s;
}

/* ── DROP ZONE TEXT ELEMENTS ─────────────────────────────────────────────── */
.drop-zone-label   { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text-primary); letter-spacing: -.1px; }
.drop-zone-or      { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 1px; }
.drop-zone-browse  {
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--accent);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer; position: relative; z-index: 1; transition: color .1s;

  &:hover { color: var(--accent-hover); }
}
.drop-zone-hint {
  font-size: var(--fs-xs); color: var(--text-muted); position: relative; z-index: 1;
}
.drop-zone-privacy {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-muted);
}
.drop-zone-file-name {
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  color: var(--success); display: flex; align-items: center; gap: 6px; position: relative; z-index: 1;
}

/* ── FILE TYPE CHIPS ─────────────────────────────────────────────────────── */
.dz-file-types { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }

.dz-file-type {
  font-size: 10px; font-weight: var(--fw-semibold); color: var(--text-muted);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2px 7px; letter-spacing: .2px;
}

.dz-sep { font-size: 10px; color: var(--border-light); }

/* ── FULL-PAGE DRAG OVERLAY ─────────────────────────────────────────────── */
.drag-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: var(--overlay-dark); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .18s;

  &.visible { opacity: 1; pointer-events: auto; }
}

.drag-overlay-inner {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  border: 2px dashed rgba(59,91,219,.6); border-radius: 24px; padding: 72px 96px;
  background: rgba(59,91,219,.06);
  animation: od-glow 1.6s ease-in-out infinite;
}

.drag-overlay-icon  { color: var(--accent); animation: od-float 2.4s ease-in-out infinite; }
.drag-overlay-title { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: -.5px; color: var(--text-primary); }
.drag-overlay-sub   { font-size: var(--fs-sm); color: var(--text-muted); letter-spacing: .5px; }

/* ── COMPACT DROP ZONE (files already queued) ───────────────────────────── */
.drop-zone-compact {
  width: 100%; padding: 11px 16px;
  border: 1.5px dashed rgba(59,91,219,.2);
  border-radius: var(--radius-lg);
  background: var(--bg-hover);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .15s, background .15s;

  &:hover     { border-color: rgba(59,91,219,.45); background: rgba(59,91,219,.04); }
  &.drag-over { border-color: var(--accent); background: rgba(59,91,219,.07); }
}

.drop-zone-compact-body {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-sm); color: var(--text-muted);
  pointer-events: none;

  & svg { color: var(--accent); opacity: .65; flex-shrink: 0; }
}

/* ── FILE QUEUE ──────────────────────────────────────────────────────────── */
.file-queue {
  display: flex; flex-direction: column; gap: 8px; margin-top: 10px;
}

.file-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color .15s;

  &.uploading { border-color: rgba(59,91,219,.25); }
  &.done      { border-color: rgba(34,197,94,.2); background: rgba(34,197,94,.02); }
  &.error     { border-color: rgba(239,68,68,.2); background: rgba(239,68,68,.02); }
}

.file-row-icon {
  width: 34px; height: 34px; border-radius: var(--radius);
  background: var(--bg-hover); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text-muted); margin-top: 1px;

  .file-row.uploading & { color: var(--accent); border-color: rgba(59,91,219,.25); background: rgba(59,91,219,.08); }
  .file-row.done      & { color: var(--success); border-color: rgba(34,197,94,.25); background: rgba(34,197,94,.08); }
}

.file-row-body {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px;
}

.file-row-name {
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.file-row-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-muted);
}

/* ── Status pill ─────────────────────────────────────────────────────────── */
.file-status-pill {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: var(--fw-semibold);
  padding: 1px 7px; border-radius: 20px; letter-spacing: .1px;

  &.queued    { background: var(--bg-hover); color: var(--text-muted); border: 1px solid var(--border); }
  &.uploading { background: rgba(59,91,219,.1); color: var(--accent); border: 1px solid rgba(59,91,219,.2); }
  &.done      { background: rgba(34,197,94,.1); color: var(--success); border: 1px solid rgba(34,197,94,.2); }
  &.error     { background: rgba(239,68,68,.1); color: var(--danger);  border: 1px solid rgba(239,68,68,.2); }
}

/* ── Per-file progress bar ───────────────────────────────────────────────── */
.file-row-progress {
  display: flex; align-items: center; gap: 8px; margin-top: 5px;
}

.file-row-track {
  flex: 1; height: 3px; border-radius: 2px; background: var(--bg-hover); overflow: hidden;
}

.file-row-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), #7b96ff);
  transition: width .25s ease;
}

.file-row-pct {
  font-size: 11px; font-family: var(--mono); color: var(--text-muted);
  flex-shrink: 0; min-width: 28px; text-align: right;
}

/* ── Remove button ───────────────────────────────────────────────────────── */
.file-row-remove {
  width: 24px; height: 24px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; transition: all .1s; flex-shrink: 0; margin-top: 2px;

  &:hover { background: var(--bg-hover); color: var(--danger); }
}

/* ── Overall progress card ───────────────────────────────────────────────── */
.upload-overall {
  margin-top: 10px; padding: 14px 16px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.overall-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}

.overall-label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-primary); }
.overall-pct   { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--accent); font-family: var(--mono); }

.overall-track {
  height: 5px; border-radius: 3px; background: var(--bg-hover); overflow: hidden; margin-bottom: 8px;
}

.overall-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-hover), var(--accent), #7b96ff);
  transition: width .4s ease;
}

.overall-stats { font-size: 11px; color: var(--text-muted); }

/* ── Button spinner (upload in-flight) ───────────────────────────────────── */
.btn-spin {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: od-spin .7s linear infinite; margin-right: 2px;
  display: inline-block; vertical-align: middle;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .upload-hero { min-height: 180px; }
}

@media (max-width: 600px) {
  .upload-hero {
    height: auto; flex-wrap: wrap;
    padding: 14px 18px; gap: 10px;
    align-items: flex-start;
  }

  .upload-hero-body { flex: 1; min-width: 0; }

  .dz-file-types {
    margin-left: 0; width: 100%;
    padding-top: 6px; border-top: 1px solid var(--border);
    flex-wrap: wrap;
  }
}

} /* @layer components */
