/* =================================================================
   Coswaa Tools — Global Styles v2.0
   Safe, non-destructive layer on top of Astra theme.
   All classes prefixed coswaa- to avoid conflicts.
   ================================================================= */
:root {
  --c-primary:   #2563eb;
  --c-primary-d: #1d4ed8;
  --c-accent:    #0ea5e9;
  --c-success:   #16a34a;
  --c-danger:    #dc2626;
  --c-warn:      #d97706;
  --c-text:      #1e293b;
  --c-muted:     #64748b;
  --c-border:    #e2e8f0;
  --c-bg:        #f8fafc;
  --c-white:     #ffffff;
  --c-radius:    8px;
  --c-radius-lg: 14px;
  --c-shadow:    0 1px 3px rgba(0,0,0,.08),0 1px 2px rgba(0,0,0,.04);
  --c-shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --c-t:         0.18s ease;
  --c-font:      -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
}

/* ── "100% Free" inline badge ──────────────────────────────── */
.coswaa-free-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg,#16a34a,#15803d);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.coswaa-breadcrumb {
  font-size: 13px;
  color: var(--c-muted);
  margin-bottom: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--c-border);
}
.coswaa-breadcrumb ol {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.coswaa-breadcrumb li { display: inline-flex; align-items: center; }
.coswaa-breadcrumb a  { color: var(--c-primary); text-decoration: none; }
.coswaa-breadcrumb a:hover { text-decoration: underline; }

/* ── "Soon" pill badge ──────────────────────────────────────── */
.coswaa-badge-soon {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: .04em;
}

/* ── Spinner ─────────────────────────────────────────────────── */
.coswaa-spinner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  color: var(--c-muted);
  font-size: 14px;
}
.coswaa-spinner__ring {
  width: 28px; height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: coswaa-spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes coswaa-spin { to { transform: rotate(360deg); } }

/* ── Output / result ─────────────────────────────────────────── */
.coswaa-output,
.coswaa-result-card {
  margin-top: 24px;
  min-height: 60px;
}
.coswaa-result-card {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius-lg);
  padding: 22px;
  box-shadow: var(--c-shadow);
}
.coswaa-result {
  background: #f7f9fc;
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  padding: 16px;
  line-height: 1.7;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.coswaa-error-msg {
  color: var(--c-danger);
  background: #fdf0ef;
  border-left: 3px solid var(--c-danger);
  padding: 10px 14px;
  border-radius: 4px;
  margin: 0;
}

/* ── Copy / action button ────────────────────────────────────── */
.coswaa-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: var(--c-radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background var(--c-t);
  font-family: var(--c-font);
}
.coswaa-copy-btn:hover { background: var(--c-primary-d); }
.coswaa-copy-btn + .coswaa-copy-btn { margin-left: 8px; }

/* ── Shared table ────────────────────────────────────────────── */
.coswaa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 8px;
}
.coswaa-table th,
.coswaa-table td {
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  text-align: left;
  vertical-align: middle;
}
.coswaa-table th {
  background: #f0f4fa;
  font-weight: 600;
  width: 120px;
}

/* ── Code block ──────────────────────────────────────────────── */
.coswaa-code {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: var(--c-radius);
  font-family: 'Fira Code','Cascadia Code','Courier New',monospace;
  font-size: 13px;
  overflow-x: auto;
  white-space: pre;
  margin: 0 0 10px;
  position: relative;
}

/* ── Regex highlight ─────────────────────────────────────────── */
.coswaa-regex-preview {
  background: #f7f9fc;
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  margin-top: 8px;
}
.coswaa-regex-preview mark {
  background: #ffe066;
  color: #333;
  border-radius: 2px;
  padding: 0 2px;
}

/* ── MD preview ──────────────────────────────────────────────── */
.coswaa-md-preview {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  padding: 16px;
  font-size: 15px;
  line-height: 1.7;
}
.coswaa-md-preview code {
  background: #f0f4fa; padding: 1px 5px; border-radius: 3px; font-family: monospace;
}

/* ── OCR ─────────────────────────────────────────────────────── */
.coswaa-drop-zone {
  border: 2px dashed #b0c4de;
  border-radius: 10px;
  padding: 36px 20px;
  text-align: center;
  color: var(--c-muted);
  font-size: 15px;
  cursor: pointer;
  transition: border-color var(--c-t),background var(--c-t);
  margin-bottom: 16px;
  background: var(--c-bg);
}
.coswaa-drop-zone--over,
.coswaa-drop-zone:hover { border-color: var(--c-primary); background: #eef4ff; }
.coswaa-file-label { color: var(--c-primary); text-decoration: underline; cursor: pointer; }
.coswaa-progress-wrap {
  height: 8px; background: #e0e0e0;
  border-radius: 999px; overflow: hidden; margin: 10px 0 6px;
}
.coswaa-progress-bar {
  height: 100%; background: var(--c-primary);
  border-radius: 999px; transition: width .2s ease;
}
.coswaa-progress-label { font-size: 13px; color: var(--c-muted); margin: 0; }
.coswaa-ocr-text {
  border: 1px solid var(--c-border); border-radius: var(--c-radius);
  padding: 10px; font-size: 14px; font-family: monospace;
  resize: vertical; background: var(--c-bg); width: 100%;
}
.coswaa-ocr-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .coswaa-copy-btn { width: 100%; justify-content: center; margin-left: 0 !important; }
  .coswaa-table th { width: 90px; font-size: 13px; }
  .coswaa-ocr-actions { flex-direction: column; }
}

/* =================================================================
   v2.2.0 Mobile-First Improvements
   ================================================================= */

/* ── Touch target minimum 44×44px ──────────────────────────── */
.coswaa-tool-cta-link,
.coswaa-tool-cta-btn,
button[class*="coswaa-"],
a[class*="coswaa-btn"],
a[class*="coswaa-cta"] {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ── Improved global CTA (mobile slide-up) ──────────────────── */
.cseo-global-cta {
  position: fixed;
  bottom: -80px;
  left: 0; right: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  background: #1e293b;
  color: #fff;
  transition: bottom .35s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -4px 20px rgba(0,0,0,.2);
}
.cseo-global-cta.cseo-cta-visible { bottom: 0; }
.cseo-cta-btn {
  background: var(--c-primary);
  color: #fff;
  padding: 9px 20px;
  border-radius: var(--c-radius);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.cseo-cta-close {
  background: none;
  border: 1px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.7);
  border-radius: 50%;
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Sticky calculator wrapper on mobile ─────────────────────── */
@media (max-width: 768px) {
  .cseo-sticky-calc {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--c-white);
    padding: 10px 0;
    border-bottom: 1px solid var(--c-border);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
  }

  /* Readable font size on mobile */
  body { font-size: 16px; }
  input, select, textarea { font-size: 16px !important; } /* prevents iOS zoom */

  /* Wider line-height for readability */
  p, li { line-height: 1.75; }

  /* Spacing fixes */
  .coswaa-breadcrumb { padding: 6px 0; font-size: 12px; }
  .cseo-global-cta { padding: 10px 16px; font-size: 13px; gap: 10px; }
}

/* ── Skip link (accessibility) ──────────────────────────────── */
.cseo-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--c-primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 10000;
  text-decoration: none;
  font-weight: 700;
  transition: top .2s;
}
.cseo-skip-link:focus { top: 0; }

/* ── Lazy-loaded image placeholder ──────────────────────────── */
img[loading="lazy"] { background: var(--c-bg); }

/* ── Core Web Vitals: Prevent CLS from images ─────────────────── */
img { height: auto; }
