/* ==========================================================================
   Word to HTML Converter
   ========================================================================== */

/* Drop zone ---------------------------------------------------------------- */
.w2h-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 2.25rem 1.5rem;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background-color 0.25s, transform 0.35s var(--ease);
}
.w2h-dropzone:hover, .w2h-dropzone.drag { border-color: rgba(139, 92, 246, 0.7); background: var(--surface-2); }
.w2h-dropzone.drag { transform: scale(1.01); }
.w2h-dropzone:focus-visible { outline: 2px solid var(--lilac); outline-offset: 3px; }
.w2h-dropzone.is-busy { pointer-events: none; opacity: 0.7; }
.w2h-dz-icon {
  display: grid;
  place-items: center;
  width: 60px; height: 60px;
  border-radius: 20px;
  color: #fff;
  background: var(--grad);
  box-shadow: var(--glow);
  transition: transform 0.35s var(--ease);
}
.w2h-dz-icon .icon { width: 26px; height: 26px; }
.w2h-dropzone:hover .w2h-dz-icon { transform: translateY(-3px); }
.w2h-dz-title { margin: 1rem 0 0.3rem; color: var(--text); font: 600 1.25rem/1.2 var(--font-display); letter-spacing: -0.01em; }
.w2h-dz-sub { margin: 0; color: var(--text-2); font-size: 0.92rem; }
.w2h-link { color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.w2h-dz-formats { margin: 0.9rem 0 0; color: var(--muted); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.04em; }

/* Paste box ---------------------------------------------------------------- */
.w2h-paste {
  min-height: 58px;
  padding: 1rem;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text-2);
  font-size: 0.88rem;
  text-align: center;
  cursor: text;
  overflow: hidden;
  transition: border-color 0.2s, background-color 0.2s;
}
.w2h-paste:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.w2h-paste:hover { border-color: rgba(139, 92, 246, 0.5); }
.w2h-paste:focus { outline: none; border-color: rgba(139, 92, 246, 0.7); background: var(--field-bg-focus); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.16); }
.w2h-paste:focus::before { content: "Now press Ctrl + V (or Cmd + V on a Mac)"; }

/* Documents ---------------------------------------------------------------- */
.w2h-docs-wrap { display: flex; flex-direction: column; gap: 0.6rem; }
.w2h-docs-wrap[hidden] { display: none; }
.w2h-docs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.w2h-docs { display: flex; flex-direction: column; gap: 0.45rem; max-height: 300px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.w2h-doc {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  animation: fade-up 0.35s var(--ease);
  transition: border-color 0.2s, background-color 0.2s;
}
.w2h-doc.is-active { border-color: rgba(139, 92, 246, 0.6); background: var(--surface-2); }
.w2h-doc-main {
  display: flex; flex: 1; align-items: center; gap: 0.75rem;
  min-width: 0;
  padding: 0.65rem 0.8rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.w2h-doc-main:focus-visible, .w2h-doc-remove:focus-visible { outline: 2px solid var(--lilac); outline-offset: -2px; border-radius: 12px; }
.w2h-doc-icon {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
}
.w2h-doc-icon .icon { width: 18px; height: 18px; }
.w2h-doc-text { display: flex; flex-direction: column; min-width: 0; }
.w2h-doc-text b { overflow: hidden; color: var(--text); font-size: 0.92rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.w2h-doc-text span { color: var(--muted); font-size: 0.78rem; }
.w2h-doc-remove {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px;
  margin-right: 0.4rem;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.w2h-doc-remove:hover { color: var(--danger-text); background: rgba(251, 113, 133, 0.12); }
.w2h-doc-remove .icon { width: 16px; height: 16px; }
.w2h.has-file .w2h-dropzone { min-height: 130px; padding: 1.2rem; }
.w2h.has-file .w2h-dz-icon { width: 44px; height: 44px; border-radius: 14px; }
.w2h.has-file .w2h-dz-icon .icon { width: 20px; height: 20px; }
.w2h.has-file .w2h-dz-title { margin-top: 0.6rem; font-size: 1.05rem; }
.w2h.has-file .w2h-dz-formats, .w2h.has-file .w2h-tips { display: none; }

/* Options ------------------------------------------------------------------ */
.w2h-options { display: flex; flex-direction: column; gap: 1rem; }
.w2h-checks { display: flex; flex-direction: column; gap: 0.65rem; }
.w2h-checks .check { align-items: flex-start; }
.w2h-checks .check input { flex: none; margin-top: 0.1rem; }
.w2h-checks small { color: var(--muted); font-size: 0.78rem; }

/* Remove tags dropdown ----------------------------------------------------- */
.w2h-tags { position: relative; }
.w2h-tags summary {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  min-height: 46px;
  padding: 0.6rem 2.5rem 0.6rem 1rem;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--field-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b91b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.9rem center;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.w2h-tags summary::-webkit-details-marker { display: none; }
.w2h-tags summary:hover { border-color: rgba(var(--ink), 0.22); }
.w2h-tags summary:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }
.w2h-tags[open] summary { border-color: rgba(139, 92, 246, 0.7); }
.w2h-tags-value { min-width: 0; overflow: hidden; color: var(--muted); font: 500 0.8rem/1.3 var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.w2h-tags-panel {
  margin-top: 6px;
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 0.9rem;
  border: 1px solid var(--border-2);
  border-radius: 14px;
  background: var(--menu-bg);
  box-shadow: var(--shadow);
}
.w2h-tags-hint { margin: 0; color: var(--muted); font-size: 0.8rem; }
.w2h-tags-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.4rem; max-height: 220px; overflow-y: auto; }
.w2h-tags-empty { margin: 0; color: var(--muted); font-size: 0.85rem; }
.w2h-tag {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.w2h-tag:hover { border-color: rgba(139, 92, 246, 0.45); }
.w2h-tag:has(input:checked) { border-color: rgba(251, 113, 133, 0.55); background: rgba(251, 113, 133, 0.08); }
.w2h-tag input { flex: none; width: 16px; height: 16px; accent-color: var(--danger); }
.w2h-tag code { flex: 1; color: var(--text); font: 600 0.8rem/1.2 var(--font-mono); }
.w2h-tag:has(input:checked) code { text-decoration: line-through; }
.w2h-tag span { color: var(--muted); font-size: 0.72rem; }
.w2h-tags-panel .link-btn { align-self: flex-start; }

.w2h-tips { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.w2h-tips li {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.85rem;
}
.w2h-tips b { color: var(--text); font-weight: 600; }
.w2h-tips span { color: var(--muted); }

/* Output ------------------------------------------------------------------- */
.w2h-tabs { display: inline-flex; padding: 3px; border: 1px solid var(--border-2); border-radius: 999px; background: var(--surface-2); }
.w2h-tabs[hidden] { display: none; }
.w2h-tabs button {
  padding: 0.35rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font: 600 0.8rem/1.2 var(--font-body);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.w2h-tabs button:hover { color: var(--text); }
.w2h-tabs button[aria-selected="true"] { color: var(--on-soft); background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.55); }
.w2h-tabs button:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }

.w2h-panel { display: flex; flex-direction: column; gap: 0.6rem; }
.w2h-panel[hidden] { display: none; }
.w2h-editor {
  position: relative;
  height: 460px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--field-bg);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.w2h-editor:focus-within { border-color: rgba(139, 92, 246, 0.7); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.16); }
.w2h-hl, .w2h-editor .w2h-code {
  position: absolute; inset: 0;
  margin: 0;
  padding: 0.75rem 1rem;
  font: 0.82rem/1.6 var(--font-mono);
  letter-spacing: 0;
  white-space: pre;
  tab-size: 2;
  overflow: auto;
}
.w2h-hl { overflow: hidden; color: var(--text); pointer-events: none; }
.w2h-hl code { font: inherit; }
.w2h-editor .w2h-code {
  width: 100%; height: 100%;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: var(--text);
  resize: none;
  outline: none;
}
.w2h-editor .w2h-code::selection { background: rgba(139, 92, 246, 0.35); color: transparent; }
.w2h-md {
  min-height: 420px;
  height: 460px;
  font: 0.82rem/1.6 var(--font-mono);
  white-space: pre;
  overflow: auto;
  resize: vertical;
}
.hl-tag { color: var(--code-k); }
.hl-att { color: var(--code-f); }
.hl-val { color: var(--code-s); }
.hl-pun { color: var(--muted); }
.hl-ent { color: var(--pink); }
.hl-com, .hl-doc { color: var(--muted); font-style: italic; }
.output-body.is-busy { opacity: 0.6; transition: opacity 0.2s; }
.w2h-meta { margin-top: 0; }
.w2h-preview {
  display: block;
  width: 100%;
  height: 460px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: #fff;
}

.w2h-notes { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 0.85rem; }
.w2h-notes[hidden] { display: none; }
.w2h-notes summary { padding: 0.7rem 0.9rem; color: var(--text-2); font-weight: 600; cursor: pointer; }
.w2h-notes ul { max-height: 180px; margin: 0; padding: 0 0.9rem 0.8rem 2rem; overflow-y: auto; color: var(--muted); }
.w2h-notes li { margin-bottom: 0.3rem; overflow-wrap: anywhere; }

.w2h-drop-overlay {
  position: fixed; inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: rgba(10, 8, 30, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.w2h-drop-overlay.on { opacity: 1; }
.w2h-drop-overlay-inner {
  padding: 3rem 4rem;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  color: #fff;
  font: 600 1.4rem/1 var(--font-display);
}

@media (max-width: 640px) {
  .w2h-dropzone { min-height: 200px; }
  .w2h-editor, .w2h-md, .w2h-preview { height: 380px; min-height: 320px; }
  .w2h-drop-overlay-inner { padding: 2rem; font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .w2h-dropzone, .w2h-dz-icon, .w2h-doc { transition: none; animation: none; }
}
