/* Extract Here Tools – scoped to .eh-tool so the theme is not affected. */
.eh-tool {
  --eh-primary: #4f46e5;
  --eh-primary-hover: #4338ca;
  --eh-text: #0f172a;
  --eh-muted: #64748b;
  --eh-border: #e2e8f0;
  --eh-bg: #ffffff;
  --eh-soft: #f8fafc;
  --eh-ok: #047857;
  --eh-warn: #b45309;
  --eh-error: #b91c1c;
  --eh-radius: 12px;
  color: var(--eh-text);
  background: var(--eh-bg);
  border: 1px solid var(--eh-border);
  border-radius: 16px;
  padding: clamp(16px, 3vw, 28px);
  margin: 0 0 2em;
  box-shadow: 0 10px 30px -18px rgba(15, 23, 42, .25);
  font-size: 16px;
  line-height: 1.5;
}
.eh-tool *, .eh-tool *::before, .eh-tool *::after { box-sizing: border-box; }
.eh-tool [hidden] { display: none !important; }

/* URL input */
.eh-input-row { display: flex; gap: 10px; margin: 0; }
.eh-input {
  flex: 1 1 auto; min-width: 0; height: 52px; padding: 0 16px;
  border: 2px solid var(--eh-border); border-radius: var(--eh-radius);
  font-size: 16px; background: #fff; color: var(--eh-text);
}
.eh-input:focus { outline: none; border-color: var(--eh-primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .15); }
.eh-hint { margin: 10px 0 0; color: var(--eh-muted); font-size: 14px; }

/* Buttons */
.eh-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--eh-primary);
  background: #fff; color: var(--eh-primary); font-weight: 600; font-size: 15px; cursor: pointer;
  white-space: nowrap; text-decoration: none; transition: background .15s, color .15s;
}
.eh-btn:hover { background: #eef2ff; }
.eh-btn-primary, .eh-download-zip { background: var(--eh-primary); color: #fff; }
.eh-btn-primary:hover, .eh-download-zip:hover { background: var(--eh-primary-hover); color: #fff; }
.eh-input-row .eh-btn { height: 52px; padding: 0 24px; }
.eh-btn-ghost { border-color: var(--eh-border); color: var(--eh-text); }
.eh-btn:disabled { opacity: .55; cursor: not-allowed; }

/* Drop zone */
.eh-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 170px; padding: 24px; text-align: center; cursor: pointer;
  border: 2px dashed #c7d2fe; border-radius: var(--eh-radius); background: #f5f7ff;
  transition: border-color .15s, background .15s;
}
.eh-drop:hover, .eh-drop.is-over { border-color: var(--eh-primary); background: #eef2ff; }
.eh-drop-title { font-weight: 700; font-size: 18px; }
.eh-drop-title::before { content: "\2191"; display: block; font-size: 30px; font-weight: 700; line-height: 1; color: var(--eh-primary); margin-bottom: 4px; }
.eh-drop-sub { color: var(--eh-muted); font-size: 14px; }

/* Options */
.eh-options { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 14px; font-size: 15px; }
.eh-options label { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; }
.eh-options input[type=number] { width: 72px; height: 38px; padding: 0 8px; border: 1px solid var(--eh-border); border-radius: 8px; }
.eh-options select, .eh-filters select {
  height: 40px; padding: 0 10px; border: 1px solid var(--eh-border); border-radius: 8px; background: #fff; font-size: 14px;
}
.eh-sep { color: var(--eh-muted); }

/* Video */
.eh-video-wrap { margin-top: 16px; }
.eh-video { display: block; width: 100%; max-height: 420px; background: #000; border-radius: var(--eh-radius); }

/* Status */
.eh-status { margin-top: 14px; font-size: 15px; color: var(--eh-muted); min-height: 1px; }
.eh-status:empty { margin: 0; }
.eh-status-ok { color: var(--eh-ok); }
.eh-status-warn { color: var(--eh-warn); }
.eh-status-error { color: var(--eh-error); }

/* Results */
.eh-results { margin-top: 18px; }
.eh-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px; background: var(--eh-soft); border: 1px solid var(--eh-border); border-radius: var(--eh-radius);
}
.eh-count { font-weight: 600; font-size: 15px; }
.eh-filters, .eh-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.eh-actions .eh-btn { height: 40px; padding: 0 14px; font-size: 14px; }

.eh-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-top: 14px;
}
.eh-card {
  margin: 0; border: 2px solid var(--eh-border); border-radius: var(--eh-radius); overflow: hidden; background: #fff;
  transition: border-color .15s;
}
.eh-card.is-selected { border-color: var(--eh-primary); }
.eh-thumb {
  position: relative; aspect-ratio: 1 / 1; cursor: pointer;
  background-color: #f1f5f9;
  background-image: linear-gradient(45deg, #e2e8f0 25%, transparent 25%), linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%), linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.eh-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 6px; margin: 0; }
.eh-card.is-broken .eh-thumb img { visibility: hidden; }
.eh-card.is-broken .eh-thumb::after {
  content: attr(data-ext) " file"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--eh-muted); font-size: 14px;
}
.eh-check { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; margin: 0; accent-color: var(--eh-primary); cursor: pointer; z-index: 1; }
.eh-card figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--eh-border); }
.eh-meta { flex: 1 1 100%; font-size: 12px; color: var(--eh-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eh-mini {
  height: 30px; padding: 0 10px; border: 1px solid var(--eh-border); border-radius: 7px; background: #fff;
  font-size: 13px; font-weight: 600; color: var(--eh-text); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
}
.eh-mini:hover { border-color: var(--eh-primary); color: var(--eh-primary); }

@media (max-width: 600px) {
  .eh-input-row { flex-direction: column; }
  .eh-input-row .eh-btn { width: 100%; }
  .eh-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  
  .eh-actions, .eh-filters { width: 100%; }
  .eh-actions .eh-btn, .eh-filters select { flex: 1 1 auto; }
}
