/* =========================================================
   AI Paraphraser – plugin stylesheet v3.0
   Namespace: #aipara-root and .aip-* prefix
   All SEO/content sections are native WP page content now.
   ========================================================= */
#aipara-root {
  --aip-green: #23c45e;
  --aip-green-dk: #18a84f;
  --aip-green-lt: #e8faf0;
  --aip-green-mid: #b8f0d0;
  --aip-blue: #5b6ee8;
  --aip-purple: #8b5cf6;
  --aip-orange: #f59e0b;
  --aip-navy: #1e293b;
  --aip-academic: #0369a1;
  --aip-teal: #06b6d4;
  --aip-red: #ef4444;
  --aip-text: #1e293b;
  --aip-text2: #64748b;
  --aip-text3: #94a3b8;
  --aip-border: #e2e8f0;
  --aip-border2: #cbd5e1;
  --aip-bg: #f1f5f9;
  --aip-white: #ffffff;
  --aip-surface: #f8fafc;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--aip-text);
  max-width: 1100px;
  margin: 0 auto 40px;
  -webkit-font-smoothing: antialiased;
}
#aipara-root *, #aipara-root *::before, #aipara-root *::after { box-sizing: border-box; }

/* ── TOOL CARD ── */
.aip-tool-card {
  background: var(--aip-white);
  border-radius: 16px;
  border: 1px solid var(--aip-border);
  box-shadow: 0 2px 16px rgba(30,41,59,.07);
  overflow: hidden;
}

/* ── MODE STRIP ── */
.aip-mode-strip {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--aip-border);
  background: var(--aip-white);
}
.aip-mode-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.aip-mode-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--aip-text3);
  margin-right: 4px;
  flex-shrink: 0;
}
.aip-mchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--aip-border);
  background: var(--aip-white);
  color: var(--aip-text2);
  font-family: inherit;
  transition: all .16s;
  white-space: nowrap;
}
.aip-mchip:hover { border-color: var(--aip-border2); color: var(--aip-text); }
.aip-mchip .aip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .4; flex-shrink: 0; }
.aip-mchip.on { border-color: transparent; color: #fff; }
.aip-mchip.on .aip-dot { opacity: 1; background: rgba(255,255,255,.6); }
.aip-mchip[data-m="standard"].on { background: var(--aip-green); }
.aip-mchip[data-m="fluency"].on  { background: var(--aip-blue); }
.aip-mchip[data-m="formal"].on   { background: var(--aip-navy); }
.aip-mchip[data-m="academic"].on { background: var(--aip-academic); }
.aip-mchip[data-m="creative"].on { background: var(--aip-purple); }
.aip-mchip[data-m="shorten"].on  { background: var(--aip-teal); }
.aip-mchip[data-m="expand"].on   { background: var(--aip-orange); }

/* ── PANELS ── */
.aip-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 420px;
}
.aip-panel { display: flex; flex-direction: column; position: relative; }
.aip-panel + .aip-panel { border-left: 1px solid var(--aip-border); }

/* panel top bar */
.aip-p-top {
  padding: 11px 16px;
  border-bottom: 1px solid var(--aip-border);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  flex-wrap: wrap;
}
.aip-p-top-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--aip-text3);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.aip-wc-tag {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--aip-text3);
  background: var(--aip-bg);
  border: 1px solid var(--aip-border);
  padding: 2px 9px;
  border-radius: 99px;
}
.aip-wc-tag.live { color: var(--aip-green-dk); background: var(--aip-green-lt); border-color: var(--aip-green-mid); }

/* placeholder overlay */
.aip-txt-ph {
  position: absolute;
  top: 44px; left: 0; right: 0; bottom: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  padding: 20px;
  transition: opacity .18s;
  gap: 8px;
}
.aip-txt-ph.gone { opacity: 0; }
.aip-ph-icon { opacity: .18; }
.aip-ph-t { font-size: 13.5px; font-weight: 600; color: var(--aip-text3); }
.aip-ph-s { font-size: 12px; color: var(--aip-text3); line-height: 1.5; max-width: 260px; opacity: .8; }

/* textarea */
#aipara-root textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--aip-text);
  font-family: inherit;
  background: transparent;
  caret-color: var(--aip-green);
  min-height: 300px;
}

/* error bar */
.aip-err-bar {
  display: none;
  padding: 9px 14px;
  background: #fef2f2;
  border-top: 1px solid #fecaca;
  font-size: 12.5px;
  color: var(--aip-red);
  font-weight: 500;
  line-height: 1.5;
}
.aip-err-bar.on { display: block; }

/* bottom bar */
.aip-p-bottom {
  padding: 10px 14px;
  border-top: 1px solid var(--aip-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--aip-surface);
  flex-wrap: wrap;
}
.aip-pb-left { display: flex; align-items: center; gap: 7px; }
.aip-pb-wc { font-size: 12px; color: var(--aip-text3); }
.aip-pb-wc b { color: var(--aip-text2); font-weight: 700; }

/* small buttons */
.aip-btn-sm {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: 1.5px solid var(--aip-border);
  background: var(--aip-white);
  color: var(--aip-text2);
  transition: all .15s;
}
.aip-btn-sm:hover { border-color: var(--aip-border2); color: var(--aip-text); background: var(--aip-bg); }

/* paraphrase CTA */
.aip-btn-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 22px;
  background: var(--aip-green);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .18s, transform .1s, box-shadow .18s;
  box-shadow: 0 2px 10px rgba(35,196,94,.32);
  letter-spacing: .01em;
}
.aip-btn-go:hover:not(:disabled) {
  background: var(--aip-green-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(35,196,94,.42);
}
.aip-btn-go:active:not(:disabled) { transform: translateY(0); }
.aip-btn-go:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── RIGHT PANEL STATES ── */
.aip-r-idle {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 24px;
  text-align: center;
  color: var(--aip-text3);
}
.aip-r-idle.on { display: flex; }
.aip-r-idle svg { opacity: .2; }
.aip-r-idle-t { font-size: 14px; font-weight: 600; }
.aip-r-idle-s { font-size: 12.5px; line-height: 1.55; max-width: 190px; opacity: .75; }

.aip-r-load {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
}
.aip-r-load.on { display: flex; }
.aip-spin-ring {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid var(--aip-border);
  border-top-color: var(--aip-green);
  animation: aipSpin .9s linear infinite;
}
@keyframes aipSpin { to { transform: rotate(360deg); } }
.aip-spin-t { font-size: 13.5px; font-weight: 600; color: var(--aip-text2); }
.aip-spin-s { font-size: 12px; color: var(--aip-text3); }
.aip-spin-badge {
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: var(--aip-green);
}

.aip-r-result { display: none; flex-direction: column; flex: 1; min-height: 0; }
.aip-r-result.on { display: flex; }

.aip-r-result-body {
  flex: 1;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--aip-text);
  overflow-y: auto;
  user-select: text;
}
.aip-r-result-body p { margin: 0 0 10px; }
.aip-r-result-body p:last-child { margin-bottom: 0; }

.aip-w { display: inline; border-radius: 3px; padding: 0 1px; cursor: pointer; transition: background .12s; }
.aip-w:hover { background: var(--aip-green-lt); }
.aip-w.sel { background: var(--aip-green-lt); outline: 2px solid var(--aip-green-mid); border-radius: 3px; }
.aip-w.swapped { background: #fef3c7; border-bottom: 2px solid var(--aip-orange); border-radius: 3px 3px 0 0; }

.aip-r-result-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--aip-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--aip-surface);
}
.aip-rrf-hint { font-size: 11.5px; color: var(--aip-text3); }

/* action buttons */
.aip-btn-copy {
  padding: 7px 16px;
  background: var(--aip-green);
  border: none;
  border-radius: 7px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.aip-btn-copy:hover { background: var(--aip-green-dk); }
.aip-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: transparent;
  border: 1.5px solid var(--aip-border);
  border-radius: 7px;
  color: var(--aip-text2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.aip-btn-ghost:hover { border-color: var(--aip-border2); color: var(--aip-text); background: var(--aip-bg); }

/* result header */
.aip-mode-result-badge {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.aip-mode-result-badge.standard { background: var(--aip-green-lt); color: var(--aip-green-dk); }
.aip-mode-result-badge.fluency  { background: #eff2ff; color: var(--aip-blue); }
.aip-mode-result-badge.formal   { background: #f1f5f9; color: var(--aip-navy); }
.aip-mode-result-badge.academic { background: #e0f2fe; color: var(--aip-academic); }
.aip-mode-result-badge.creative { background: #f5f3ff; color: var(--aip-purple); }
.aip-mode-result-badge.shorten  { background: #ecfeff; color: var(--aip-teal); }
.aip-mode-result-badge.expand   { background: #fffbeb; color: #b45309; }

.aip-wc-compare { font-size: 12px; color: var(--aip-text3); margin-left: 8px; }
.aip-result-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }

/* ── SYNONYM POPOVER ── */
.aip-syn-pop {
  position: fixed;
  z-index: 9999;
  background: var(--aip-white);
  border: 1px solid var(--aip-border2);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.14);
  padding: 10px 8px 8px;
  min-width: 180px;
  max-width: 280px;
  display: none;
}
.aip-syn-pop.on { display: block; }
.aip-syn-hd {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--aip-text3);
  padding: 0 6px 8px;
  border-bottom: 1px solid var(--aip-border);
}
.aip-syn-items { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 4px 2px; }
.aip-syn-chip {
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--aip-surface);
  border: 1.5px solid var(--aip-border);
  color: var(--aip-text2);
  font-family: inherit;
  transition: all .14s;
}
.aip-syn-chip:hover { background: var(--aip-green-lt); border-color: var(--aip-green-mid); color: var(--aip-green-dk); }
.aip-syn-empty { font-size: 12.5px; color: var(--aip-text3); padding: 4px 6px; }

/* ── RESPONSIVE ── */
@media (max-width: 680px) {
  .aip-panels { grid-template-columns: 1fr; }
  .aip-panel + .aip-panel { border-left: none; border-top: 1px solid var(--aip-border); }
  #aipara-root textarea { min-height: 180px; }
  .aip-panels { min-height: unset; }
  .aip-mode-row { gap: 5px; }
  .aip-mchip { font-size: 12px; padding: 5px 11px; }
  .aip-btn-go { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
  .aip-pb-left { width: 100%; justify-content: space-between; }
  .aip-p-bottom { flex-wrap: wrap; }
  .aip-r-idle { min-height: 140px; padding: 20px; }
  .aip-r-load { min-height: 140px; }
  .aip-r-result-body { font-size: 13.5px; padding: 12px; min-height: 140px; }
  .aip-r-result-foot { flex-wrap: wrap; }
  .aip-syn-pop { max-width: 92vw; }
}
@media (max-width: 440px) {
  .aip-mchip { font-size: 11.5px; padding: 5px 9px; }
  .aip-tool-card { border-radius: 10px; }
  .aip-p-top { padding: 9px 12px; }
  #aipara-root textarea { padding: 10px 12px; font-size: 13.5px; }
  .aip-p-bottom { padding: 8px 10px; }
}
