/* ============================================================
   Screenshot to Text — style.css
   Full-screen, dark, modern tool. All rules are scoped under
   #s2t-app so the tool can be dropped into any page (shortcode /
   iframe) without breaking the surrounding theme.
   ============================================================ */

/* Minimal global reset (safe for embedding) */
body { margin: 0; }

/* ---------- App root / theme ---------- */
#s2t-app {
  --s2t-bg: #070a12;
  --s2t-panel: rgba(148, 163, 197, 0.06);
  --s2t-panel-solid: rgba(17, 23, 39, 0.72);
  --s2t-border: rgba(148, 163, 197, 0.14);
  --s2t-border-strong: rgba(148, 163, 197, 0.30);
  --s2t-text: #e8ecf6;
  --s2t-muted: #93a0b8;
  --s2t-dim: #66748f;
  --s2t-accent: #6366f1;
  --s2t-accent-2: #22d3ee;
  --s2t-accent-3: #a855f7;
  --s2t-success: #34d399;
  --s2t-error: #fb7185;
  --s2t-warn: #fbbf24;
  --s2t-radius: 16px;
  --s2t-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --s2t-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  font-family: var(--s2t-font);
  color: var(--s2t-text);
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(99, 102, 241, 0.30), transparent 60%),
    radial-gradient(900px 520px at 100% 0%, rgba(34, 211, 238, 0.16), transparent 55%),
    radial-gradient(900px 620px at 50% 125%, rgba(168, 85, 247, 0.18), transparent 60%),
    linear-gradient(180deg, #080b14, #070a12);

  width: 100%;
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

#s2t-app *, #s2t-app *::before, #s2t-app *::after { box-sizing: border-box; }

#s2t-app kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--s2t-border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 6px;
  font-family: var(--s2t-mono);
  font-size: 11px;
  color: var(--s2t-text);
}

#s2t-app ::-webkit-scrollbar { width: 10px; height: 10px; }
#s2t-app ::-webkit-scrollbar-track { background: transparent; }
#s2t-app ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
#s2t-app ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
  background-clip: padding-box;
}

/* ---------- Header ---------- */
.s2t-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-bottom: 1px solid var(--s2t-border);
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.s2t-brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.s2t-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--s2t-accent), var(--s2t-accent-2));
  box-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.55);
  flex: 0 0 auto;
}
.s2t-brand-text h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.s2t-brand-text p { margin: 2px 0 0; font-size: 12.5px; color: var(--s2t-muted); }

.s2t-header-actions { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }

/* ---------- Field (select) ---------- */
.s2t-field { display: flex; flex-direction: column; gap: 5px; }
.s2t-field-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--s2t-dim);
  font-weight: 700;
}
.s2t-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--s2t-text);
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--s2t-border-strong);
  border-radius: 10px;
  padding: 9px 32px 9px 12px;
  cursor: pointer;
  min-width: 150px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2393a0b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  transition: border-color 0.15s, background-color 0.15s;
}
.s2t-select:hover { border-color: rgba(148, 163, 197, 0.45); }
.s2t-select:focus { outline: none; border-color: var(--s2t-accent-2); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18); }
.s2t-select option { background: #0d1220; color: var(--s2t-text); }

/* ---------- Switch ---------- */
.s2t-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  padding-bottom: 2px;
}
.s2t-switch input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.s2t-switch-track {
  width: 40px; height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  position: relative;
  transition: background 0.2s;
  flex: 0 0 auto;
}
.s2t-switch-track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.s2t-switch input:checked + .s2t-switch-track { background: linear-gradient(135deg, var(--s2t-accent), var(--s2t-accent-2)); }
.s2t-switch input:checked + .s2t-switch-track::after { transform: translateX(18px); }
.s2t-switch input:focus-visible + .s2t-switch-track { outline: 2px solid var(--s2t-accent-2); outline-offset: 2px; }
.s2t-switch-label { font-size: 13px; font-weight: 600; color: var(--s2t-muted); }

/* ---------- Main layout ---------- */
.s2t-main {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px 22px;
}

/* ---------- Panels ---------- */
.s2t-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--s2t-panel);
  border: 1px solid var(--s2t-border);
  border-radius: var(--s2t-radius);
  overflow: hidden;
}

.s2t-panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--s2t-border);
  flex-wrap: wrap;
}
.s2t-panel-head h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--s2t-muted);
}

.s2t-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--s2t-border);
  color: var(--s2t-muted);
  white-space: nowrap;
}

/* ---------- Dropzone / input ---------- */
.s2t-dropzone {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.s2t-empty {
  height: 100%;
  min-height: 330px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed var(--s2t-border-strong);
  border-radius: 12px;
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.s2t-dropzone.drag .s2t-empty,
.s2t-empty:hover { border-color: var(--s2t-accent-2); background: rgba(34, 211, 238, 0.06); }

.s2t-drop-icon {
  width: 62px; height: 62px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: rgba(99, 102, 241, 0.16);
  color: var(--s2t-accent-2);
  margin-bottom: 6px;
}
.s2t-drop-title { margin: 2px 0 0; font-size: 16px; font-weight: 700; }
.s2t-drop-sub { margin: 0; font-size: 13px; color: var(--s2t-muted); }
.s2t-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }

.s2t-preview {
  position: relative;
  height: 100%;
  min-height: 330px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.03) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.03) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  overflow: hidden;
}
.s2t-preview img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); }
.s2t-preview-overlay {
  position: absolute;
  top: 12px; right: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}
.s2t-preview:hover .s2t-preview-overlay { opacity: 1; }

/* ---------- Run bar / progress ---------- */
.s2t-runbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--s2t-border);
  flex-wrap: wrap;
}

.s2t-progress { flex: 1 1 180px; min-width: 130px; }
.s2t-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.s2t-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--s2t-accent), var(--s2t-accent-2), var(--s2t-accent-3));
  background-size: 200% 100%;
  transition: width 0.25s ease;
  animation: s2t-flow 1.8s linear infinite;
}
@keyframes s2t-flow { to { background-position: -200% 0; } }

.s2t-progress.indeterminate .s2t-progress-bar { width: 45%; animation: s2t-ind 1.3s ease-in-out infinite; }
@keyframes s2t-ind { 0% { margin-left: -45%; } 100% { margin-left: 100%; } }

.s2t-progress-text { display: block; font-size: 12px; color: var(--s2t-muted); margin-top: 7px; }

/* ---------- Buttons ---------- */
.s2t-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--s2t-text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--s2t-border-strong);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s, filter 0.15s;
}
.s2t-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.10); border-color: rgba(148, 163, 197, 0.45); }
.s2t-btn:active:not(:disabled) { transform: translateY(1px); }
.s2t-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.25); }
.s2t-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.s2t-btn-primary {
  background: linear-gradient(135deg, var(--s2t-accent), var(--s2t-accent-2));
  border-color: transparent;
  color: #fff;
}
.s2t-btn-primary:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(135deg, var(--s2t-accent), var(--s2t-accent-2)); }
.s2t-btn-ghost { background: transparent; }

.s2t-btn-extract {
  background: linear-gradient(135deg, var(--s2t-accent), var(--s2t-accent-2));
  border-color: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 18px;
  box-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.55);
}
.s2t-btn-extract:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }
.s2t-btn-extract:active:not(:disabled) { transform: translateY(0); }
.s2t-btn-extract.s2t-btn-busy { opacity: 0.75; cursor: wait; }

/* ---------- Output / textarea ---------- */
.s2t-output-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.s2t-textarea {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--s2t-text);
  font-family: var(--s2t-mono);
  font-size: 14px;
  line-height: 1.75;
  padding: 16px;
}
.s2t-textarea::placeholder { color: var(--s2t-dim); }

.s2t-stats {
  flex: 0 0 auto;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--s2t-border);
  font-size: 12px;
  color: var(--s2t-muted);
}
.s2t-stats b { color: var(--s2t-text); font-weight: 700; }

/* ---------- Footer ---------- */
.s2t-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 22px;
  border-top: 1px solid var(--s2t-border);
  font-size: 12px;
  color: var(--s2t-dim);
}
.s2t-footer p { margin: 0; }

/* ---------- Toasts ---------- */
.s2t-toasts {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  width: min(92vw, 430px);
  pointer-events: none;
}
.s2t-toast {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  background: rgba(19, 25, 40, 0.94);
  border: 1px solid var(--s2t-border-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: s2t-in 0.25s ease;
}
.s2t-toast::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--s2t-success);
}
.s2t-toast.error::before { background: var(--s2t-error); }
.s2t-toast.warn::before { background: var(--s2t-warn); }
.s2t-toast.info::before { background: var(--s2t-accent-2); }
.s2t-toast.out { animation: s2t-out 0.3s ease forwards; }

@keyframes s2t-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes s2t-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  #s2t-app { height: auto; min-height: 100vh; overflow: visible; }
  .s2t-main { grid-template-columns: 1fr; overflow: visible; }
  .s2t-panel { min-height: 0; }
  .s2t-empty, .s2t-preview { min-height: 300px; }
  .s2t-textarea { min-height: 300px; }
  .s2t-header { padding: 14px 16px; }
  .s2t-main { padding: 12px 16px; }
  .s2t-footer { flex-direction: column; align-items: flex-start; }
  .s2t-select { min-width: 0; }
}
