/* ==========================================================================
   Onnax Tools — Shared Components (components.css)
   Upload, progress, toasts, modal, breadcrumbs, search, FAQ, tables, forms
   ========================================================================== */

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { padding: 18px 0 0; font-size: .86rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumbs li { display: flex; align-items: center; gap: 6px; color: var(--c-text-faint); }
.breadcrumbs li:not(:first-child)::before { content: "›"; color: var(--c-text-faint); }
.breadcrumbs a { color: var(--c-text-soft); }
.breadcrumbs a:hover { color: var(--c-primary-dark); }
.breadcrumbs [aria-current] { color: var(--c-primary-dark); font-weight: 600; }

/* ---------- Search ---------- */
.search-box { position: relative; }
.search-box input {
  width: 100%; padding: .72rem 1.1rem .72rem 2.7rem;
  border: 1.5px solid var(--c-border); border-radius: var(--r-full);
  background: var(--c-surface); font-size: .93rem; transition: var(--t-fast);
}
.search-box input:focus { outline: none; border-color: var(--c-primary); background: #fff; box-shadow: 0 0 0 4px rgba(24,197,200,.14); }
.search-box .search-ic { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--c-text-faint); pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 960;
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); max-height: 380px; overflow-y: auto; display: none;
}
.search-results.is-open { display: block; }
.search-results a {
  display: flex; align-items: center; gap: 12px; padding: .7rem .95rem;
  color: var(--c-text); font-size: .92rem; border-bottom: 1px solid var(--c-surface);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.is-active { background: var(--c-primary-light); }
.search-results .sr-ic { width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--c-primary-light); color: var(--c-primary-dark); }
.search-results .sr-cat { margin-left: auto; font-size: .72rem; color: var(--c-text-faint); white-space: nowrap; }
.search-results mark { background: rgba(24,197,200,.25); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-results .sr-empty { padding: 1rem; color: var(--c-text-faint); font-size: .9rem; text-align: center; }

/* ---------- Upload / dropzone ---------- */
.dropzone {
  border: 2.5px dashed rgba(24,197,200,.55); border-radius: var(--r-lg);
  background: var(--grad-soft); padding: 52px 26px; text-align: center; cursor: pointer;
  transition: var(--t-med); position: relative;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--c-primary); background: var(--c-primary-light); transform: scale(1.005); box-shadow: var(--shadow-glow); }
.dropzone__icon {
  width: 74px; height: 74px; margin: 0 auto 18px; border-radius: 22px;
  background: var(--grad-brand); color: #fff; display: grid; place-items: center; font-size: 2rem;
  box-shadow: var(--shadow-glow); animation: floatY 3.4s ease-in-out infinite;
}
@keyframes floatY { 50% { transform: translateY(-9px); } }
.dropzone h3 { font-size: 1.25rem; margin-bottom: 6px; }
.dropzone p { font-size: .9rem; }
.dropzone .btn { margin-top: 18px; }
.dropzone input[type="file"] { display: none; }
.dropzone__hint { margin-top: 14px; font-size: .8rem; color: var(--c-text-faint); }

/* ---------- File list ---------- */
.file-list { list-style: none; margin-top: 18px; display: grid; gap: 10px; }
.file-item {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 10px 14px;
  box-shadow: var(--shadow-sm); cursor: grab;
}
.file-item.sortable-ghost { opacity: .4; }
.file-item__ic { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--c-primary-light); color: var(--c-primary-dark); display: grid; place-items: center; font-weight: 700; font-size: .72rem; overflow: hidden; }
.file-item__ic img { width: 100%; height: 100%; object-fit: cover; }
.file-item__meta { min-width: 0; flex: 1; }
.file-item__name { font-size: .9rem; font-weight: 600; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item__size { font-size: .77rem; color: var(--c-text-faint); }
.file-item__remove { background: none; border: 0; cursor: pointer; color: var(--c-text-faint); padding: 6px; border-radius: 8px; font-size: 1rem; line-height: 1; }
.file-item__remove:hover { color: var(--c-danger); background: #FEF2F2; }

/* ---------- Tool workspace ---------- */
.tool-panel { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 30px; }
.tool-options { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--c-surface); }
.opt { display: flex; flex-direction: column; gap: 6px; min-width: 150px; flex: 1; }
.opt > label { font-size: .82rem; font-weight: 600; color: var(--c-text); }
.opt input[type="number"], .opt input[type="text"], .opt input[type="password"], .opt select, .opt textarea {
  padding: .58rem .8rem; border: 1.5px solid var(--c-border); border-radius: var(--r-sm);
  background: var(--c-surface); font-size: .9rem; width: 100%;
}
.opt input:focus, .opt select:focus, .opt textarea:focus { outline: none; border-color: var(--c-primary); background: #fff; box-shadow: 0 0 0 3px rgba(24,197,200,.13); }
.opt input[type="range"] { accent-color: var(--c-primary); }
.opt input[type="color"] { width: 46px; height: 34px; padding: 2px; border: 1.5px solid var(--c-border); border-radius: var(--r-sm); background: #fff; cursor: pointer; }
.opt--row { flex-direction: row; align-items: center; gap: 10px; }
.opt .range-val { font-size: .8rem; color: var(--c-primary-dark); font-weight: 700; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; align-items: center; }
.tool-preview { margin-top: 22px; text-align: center; }
.tool-preview img, .tool-preview canvas { margin-inline: auto; max-height: 460px; border-radius: var(--r-md); box-shadow: var(--shadow-md); }
.tool-note { margin-top: 16px; font-size: .85rem; color: var(--c-text-soft); background: var(--c-primary-light); border-left: 3px solid var(--c-primary); border-radius: var(--r-sm); padding: 10px 14px; }
.tool-note--warn { background: #FFF7E6; border-color: var(--c-warning); }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; margin-top: 20px; }
.thumb-grid .pg {
  position: relative; border: 1.5px solid var(--c-border); border-radius: var(--r-md); overflow: hidden;
  background: #fff; cursor: grab; transition: var(--t-fast); text-align: center;
}
.thumb-grid .pg:hover { border-color: var(--c-primary); box-shadow: var(--shadow-md); }
.thumb-grid .pg.is-selected { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(24,197,200,.3); }
.thumb-grid .pg canvas, .thumb-grid .pg img { width: 100%; height: auto; }
.thumb-grid .pg .pg-n { font-size: .74rem; color: var(--c-text-faint); padding: 4px 0; display: block; }
.thumb-grid .pg .pg-x {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,.92); border: 1px solid var(--c-border); color: var(--c-danger);
  cursor: pointer; font-size: .8rem; line-height: 1;
}

/* ---------- Progress ---------- */
.progress-wrap { margin-top: 22px; display: none; }
.progress-wrap.is-active { display: block; }
.progress-bar { height: 10px; border-radius: var(--r-full); background: var(--c-surface); overflow: hidden; }
.progress-bar__fill {
  height: 100%; width: 0%; border-radius: var(--r-full);
  background: var(--grad-brand); background-size: 200% 100%;
  animation: borderFlow 1.6s linear infinite; transition: width .25s ease;
}
.progress-label { margin-top: 8px; font-size: .84rem; color: var(--c-text-soft); display: flex; justify-content: space-between; }

/* ---------- Result ---------- */
.tool-result { display: none; margin-top: 24px; text-align: center; background: #F0FDF6; border: 1.5px solid #BBEDD0; border-radius: var(--r-lg); padding: 30px; }
.tool-result.is-active { display: block; animation: popIn .4s ease; }
@keyframes popIn { from { opacity: 0; transform: scale(.96); } }
.tool-result__ic { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 50%; background: var(--c-success); color: #fff; display: grid; place-items: center; font-size: 1.6rem; }
.tool-result h3 { margin-bottom: 4px; }
.tool-result p { font-size: .9rem; margin-bottom: 16px; }
.tool-result textarea { width: 100%; min-height: 180px; margin-bottom: 14px; padding: 12px; border: 1px solid var(--c-border); border-radius: var(--r-sm); font-family: ui-monospace, monospace; font-size: .84rem; text-align: left; }

/* ---------- Toasts ---------- */
.toast-region { position: fixed; bottom: 24px; right: 24px; z-index: 1200; display: grid; gap: 10px; max-width: min(360px, calc(100vw - 40px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; background: #fff; border-radius: var(--r-md);
  border: 1px solid var(--c-border); border-left: 4px solid var(--c-primary);
  box-shadow: var(--shadow-lg); padding: 13px 16px; font-size: .9rem;
  animation: toastIn .35s cubic-bezier(.21, 1.02, .73, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }
.toast--success { border-left-color: var(--c-success); }
.toast--error { border-left-color: var(--c-danger); }
.toast--warn { border-left-color: var(--c-warning); }
.toast.is-leaving { opacity: 0; transform: translateX(30px); transition: all .3s; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1100; background: rgba(15, 25, 35, .55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.is-open { display: flex; }
.modal { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); max-width: 520px; width: 100%; padding: 30px; position: relative; animation: popIn .3s ease; max-height: 88dvh; overflow-y: auto; }
.modal__close { position: absolute; top: 14px; right: 14px; background: var(--c-surface); border: 0; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1rem; }
.modal__close:hover { background: #FEF2F2; color: var(--c-danger); }

/* ---------- FAQ accordion ---------- */
.faq-list { max-width: 780px; margin-inline: auto; display: grid; gap: 12px; }
.faq-item { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-md); overflow: hidden; transition: box-shadow var(--t-fast); }
.faq-item[open] { box-shadow: var(--shadow-md); border-color: rgba(24,197,200,.5); }
.faq-item summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 17px 20px; font-family: var(--font-head); font-weight: 600; font-size: .98rem; color: var(--c-secondary);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--c-primary); transition: transform var(--t-med); flex: none; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-a { padding: 0 20px 18px; font-size: .93rem; color: var(--c-text-soft); }

/* ---------- Content prose (SEO sections) ---------- */
.prose { max-width: 780px; margin-inline: auto; }
.prose h2 { margin: 44px 0 14px; }
.prose h3 { margin: 28px 0 10px; }
.prose p { margin-bottom: 14px; font-size: 1rem; }
.prose ul, .prose ol { margin: 0 0 16px 22px; color: var(--c-text-soft); }
.prose li { margin-bottom: 8px; }
.prose table { width: 100%; border-collapse: collapse; margin: 18px 0 22px; font-size: .92rem; }
.prose th { background: var(--c-primary-light); color: var(--c-secondary); text-align: left; padding: 10px 14px; font-family: var(--font-head); font-size: .86rem; }
.prose td { padding: 10px 14px; border-bottom: 1px solid var(--c-surface); color: var(--c-text-soft); }
.prose tr:nth-child(even) td { background: #FBFCFD; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; display: grid; gap: 16px; margin: 20px 0; }
.step { display: flex; gap: 16px; align-items: flex-start; background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 18px 20px; }
.step::before {
  counter-increment: step; content: counter(step);
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  background: var(--grad-brand); color: #fff; font-family: var(--font-head); font-weight: 700;
  display: grid; place-items: center; box-shadow: var(--shadow-glow);
}
.step h3 { font-size: 1rem; margin-bottom: 3px; }
.step p { font-size: .9rem; margin: 0; }

/* ---------- Feature list ---------- */
.feature-item { display: flex; gap: 14px; align-items: flex-start; }
.feature-item__ic { width: 42px; height: 42px; flex: none; border-radius: 12px; background: var(--c-primary-light); color: var(--c-primary-dark); display: grid; place-items: center; font-size: 1.1rem; }
.feature-item h3 { font-size: 1rem; margin-bottom: 3px; }
.feature-item p { font-size: .89rem; margin: 0; }

/* ---------- Forms (contact / newsletter) ---------- */
.form-grid { display: grid; gap: 18px; }
.form-field label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 6px; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%; padding: .75rem 1rem; border: 1.5px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-surface); font-size: .95rem; transition: var(--t-fast);
}
.form-field input:focus, .form-field textarea:focus { outline: none; border-color: var(--c-primary); background: #fff; box-shadow: 0 0 0 4px rgba(24,197,200,.13); }
.form-field .field-error { display: none; color: var(--c-danger); font-size: .8rem; margin-top: 5px; }
.form-field.has-error input, .form-field.has-error textarea { border-color: var(--c-danger); }
.form-field.has-error .field-error { display: block; }

/* ---------- CTA band ---------- */
.cta-band { background: var(--c-secondary); border-radius: var(--r-lg); padding: 56px 40px; text-align: center; position: relative; overflow: hidden; }
.cta-band::before, .cta-band::after {
  content: ""; position: absolute; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(24,197,200,.35), transparent 70%); pointer-events: none;
}
.cta-band::before { top: -170px; left: -120px; }
.cta-band::after { bottom: -170px; right: -120px; animation: floatY 6s ease-in-out infinite; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #AEB9C4; max-width: 520px; margin: 12px auto 26px; }

/* ---------- Related tools strip ---------- */
.related-tools .tool-card { padding: 20px 18px; }
.related-tools .tool-card__icon { width: 42px; height: 42px; font-size: 1.05rem; border-radius: 12px; }

@media (max-width: 700px) {
  .tool-panel { padding: 20px 16px; }
  .dropzone { padding: 38px 16px; }
  .cta-band { padding: 42px 22px; }
}
