/* ==========================================================================
   attach.css — Drag overlay, paperclip button, pre-send chip strip, in-bubble
   attachment rows, and the Logo-SVG mask spinner used while a chip uploads.
   Part of منصة عقاب dashboard styles. Cascade order is significant — load
   AFTER input.css and chat.css so the paperclip + strip slot in cleanly.
   ========================================================================== */

/* ── Drag overlay ──────────────────────────────────────────────────────── */
#drag-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(20, 22, 25, 0.78);
  backdrop-filter: blur(4px) saturate(140%);
  -webkit-backdrop-filter: blur(4px) saturate(140%);
  display: none; align-items: center; justify-content: center;
  pointer-events: none;
  animation: fadeIn .14s ease;
}
#drag-overlay.active { display: flex; }
.drag-card {
  background: var(--s2);
  border: 2px dashed var(--g);
  border-radius: 18px;
  padding: 36px 56px;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0,0,0,.4);
  max-width: 70vw;
}
.drag-logo {
  width: 64px; height: 64px; margin: 0 auto 14px;
  background: var(--g);
  -webkit-mask: url('/assets/Logo.svg') center / contain no-repeat;
  mask: url('/assets/Logo.svg') center / contain no-repeat;
  animation: dragLogoFloat 1.8s ease-in-out infinite;
}
@keyframes dragLogoFloat {
  0%, 100% { transform: translateY(0) }
  50% { transform: translateY(-6px) }
}
.drag-title {
  font-size: 18px; font-weight: 700; color: var(--t1);
  margin-bottom: 6px;
}
.drag-sub { font-size: 13px; color: var(--t3); }

/* ── Paperclip button (inside .input-wrap) ─────────────────────────────── */
#attach-btn {
  width: 36px; height: 36px; min-width: 34px; min-height: 34px;
  border-radius: var(--rf);
  background: transparent;
  border: 1.5px solid var(--b2);
  color: var(--t2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; align-self: flex-end; padding: 0;
  transition: background .18s, border-color .18s, color .18s, transform .12s;
  cursor: pointer;
}
#attach-btn svg { width: 18px; height: 18px; }
#attach-btn:hover {
  background: var(--s3);
  border-color: var(--gb);
  color: var(--g);
  transform: scale(1.06);
}
#attach-btn:active { transform: scale(.92); }

/* ── Pre-send chip strip (between #chip-strip and .input-wrap) ─────────── */
#attach-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 9px 0;
  max-width: var(--content-max);
  margin-left: auto; margin-right: auto;
}

.att-chip {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  background: var(--s2);
  border: 1px solid var(--b2);
  border-radius: var(--r2);
  padding: 7px 10px 7px 9px;
  min-width: 160px; max-width: 280px;
  font-size: 12px; color: var(--t1);
  transition: border-color .15s, background .15s;
}
.att-chip:hover { border-color: var(--gb); }
.att-chip.att-error { border-color: var(--red); background: rgba(220, 60, 60, 0.08); }

.att-ico {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}

.att-meta {
  display: flex; flex-direction: column; min-width: 0; flex: 1;
}
.att-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 600; color: var(--t1);
}
.att-sub { font-size: 10.5px; color: var(--t3); margin-top: 1px; }

.att-x {
  width: 22px; height: 22px;
  border-radius: var(--rf);
  background: transparent;
  border: none;
  color: var(--t3);
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.att-x:hover { background: var(--s3); color: var(--red); }

/* The Logo-SVG mask spinner shown while the file uploads.
   Re-uses the same masking trick as #send-btn so the spinning glyph is the
   firm's own logo, in the firm's gold accent — no third-party loader image. */
.att-spin {
  width: 20px; height: 20px;
  background: var(--g);
  -webkit-mask: url('/assets/Logo.svg') center / contain no-repeat;
  mask: url('/assets/Logo.svg') center / contain no-repeat;
  animation: attSpin 1.1s linear infinite;
  flex-shrink: 0;
}
@keyframes attSpin { to { transform: rotate(360deg); } }

/* Progress bar at the bottom of an uploading chip */
.att-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--b1);
  border-radius: 0 0 var(--r2) var(--r2);
  overflow: hidden;
}
.att-progress-fill {
  height: 100%;
  background: var(--g);
  transition: width .25s ease;
}

/* ── Edit-form chip strip (inside .bubble.user when editing) ──────────── */
.edit-att-strip {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 8px 0; padding: 0;
}
.edit-att-strip .att-chip { font-size: 11px; min-width: 140px; max-width: 260px; }
.edit-att-strip .att-chip.att-kept { border-style: dashed; }
.att-edit-pc {
  width: 30px; height: 30px;
  border-radius: var(--rf);
  background: transparent;
  border: 1.5px dashed var(--b2);
  color: var(--t2);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.att-edit-pc:hover { background: var(--s3); border-color: var(--gb); color: var(--g); }

/* ── In-bubble attachment row (live + history) ─────────────────────────── */
.msg-attachments {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 8px;
}

.msg-att {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--r2);
  padding: 6px 10px;
  font-size: 12px; color: inherit; text-decoration: none;
  max-width: 280px; min-width: 0;
  transition: background .15s, border-color .15s;
}
.msg-att:hover {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.18);
}
[data-theme="light"] .msg-att {
  background: rgba(0,0,0,.04);
  border-color: rgba(0,0,0,.08);
}
[data-theme="light"] .msg-att:hover {
  background: rgba(0,0,0,.07);
}

.msg-att-ico { font-size: 16px; flex-shrink: 0; }
.msg-att-meta { display: flex; flex-direction: column; min-width: 0; }
.msg-att-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 600;
}
.msg-att-sub { font-size: 10.5px; opacity: .72; margin-top: 1px; }

/* Image attachments — show a thumbnail tile */
.msg-att.msg-att-img {
  padding: 0;
  display: block;
  width: 160px; max-width: 50vw;
  overflow: hidden;
}
.msg-att.msg-att-img img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
}
.msg-att.msg-att-img .msg-att-cap {
  display: block;
  padding: 5px 8px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(0,0,0,.18);
}

/* Small screens: shrink chips & previews so the strip doesn't push the input
   off-screen. */
@media (max-width: 600px) {
  .att-chip { min-width: 140px; max-width: 70vw; }
  .msg-att { max-width: 70vw; }
  .msg-att.msg-att-img { width: 130px; }
  .msg-att.msg-att-img img { height: 90px; }
}
