/* ═══════════════════════════════════════════════════════════════
   Equalza — Readability Checker  v1.0
   ═══════════════════════════════════════════════════════════════ */

:root {
  --rd-bg: #f5f6f8;
  --rd-surface: #fff;
  --rd-border: #e2e5ea;
  --rd-accent: #7c3aed;
  --rd-accent-light: #f5f3ff;
  --rd-accent-mid: #c4b5fd;
  --rd-text: #111827;
  --rd-text2: #4b5563;
  --rd-text3: #9ca3af;
  --rd-green: #10b981;
  --rd-yellow: #f59e0b;
  --rd-orange: #f97316;
  --rd-red: #ef4444;
  --rd-r: 8px;
  --rd-rl: 12px;
}

.tool-card.rd {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  color: var(--rd-text);
  line-height: 1.5;
}

/* ── Input ──────────────────────────────────────────────── */
.rd-input-section { padding: 24px 24px 12px; }
.rd-input-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.rd-section-label {
  font-weight: 600; font-size: 14px; color: var(--rd-text2);
  text-transform: uppercase; letter-spacing: .04em;
}
.rd-input-actions { display: flex; gap: 6px; }
.rd-btn-ghost {
  background: none; border: 1px solid var(--rd-border); border-radius: var(--rd-r);
  padding: 6px 14px; font-size: 13px; color: var(--rd-text2); cursor: pointer; transition: all .2s;
}
.rd-btn-ghost:hover { background: var(--rd-accent-light); color: var(--rd-accent); border-color: var(--rd-accent-mid); }

.rd-textarea {
  width: 100%; min-height: 180px; border: 1px solid var(--rd-border); border-radius: var(--rd-rl);
  padding: 16px; font-size: 15px; line-height: 1.7; resize: vertical;
  color: var(--rd-text); background: var(--rd-surface); transition: border-color .2s; box-sizing: border-box;
}
.rd-textarea:focus { outline: none; border-color: var(--rd-accent); box-shadow: 0 0 0 3px rgba(124,58,237,.1); }

.rd-meta-row {
  display: flex; gap: 16px; padding: 8px 4px 0; font-size: 13px; color: var(--rd-text3);
}

/* ── Overall Score (Gauge) ──────────────────────────────── */
.rd-score-section { display: none; padding: 0 24px 8px; }
.rd-score-section.visible { display: block; }

.rd-big-score {
  display: flex; align-items: center; gap: 32px;
  background: var(--rd-bg); border: 1px solid var(--rd-border); border-radius: var(--rd-rl); padding: 24px;
}
.rd-gauge { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.rd-gauge svg { width: 120px; height: 70px; }
.rd-gauge-bg { fill: none; stroke: var(--rd-border); stroke-width: 8; stroke-linecap: round; }
.rd-gauge-fill {
  fill: none; stroke: var(--rd-accent); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 157; stroke-dashoffset: 157; transition: stroke-dashoffset .8s ease, stroke .3s;
}
.rd-gauge-val { font-size: 28px; font-weight: 800; margin-top: -36px; color: var(--rd-text); }
.rd-gauge-label { font-size: 11px; color: var(--rd-text3); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

.rd-grade-badge { display: flex; flex-direction: column; gap: 6px; }
.rd-grade-icon { font-size: 32px; }
.rd-grade-text { font-size: 16px; font-weight: 600; color: var(--rd-text); line-height: 1.4; }

/* ── Metrics ────────────────────────────────────────────── */
.rd-metrics { padding: 0 24px 8px; }
.rd-section-title { font-size: 15px; font-weight: 700; margin: 20px 0 14px; color: var(--rd-text); }

/* Explainer */
.rd-explainer {
  background: var(--rd-accent-light); border: 1px solid var(--rd-accent-mid); border-radius: var(--rd-rl);
  padding: 20px 24px; margin-bottom: 16px;
}
.rd-explainer-title { font-size: 16px; font-weight: 700; margin: 0 0 8px; color: var(--rd-accent); }
.rd-explainer-text { font-size: 14px; color: var(--rd-text2); margin: 0 0 16px; line-height: 1.6; }
.rd-explain-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rd-explain-card {
  background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: var(--rd-r);
  padding: 14px; font-size: 13px; line-height: 1.5;
}
.rd-explain-card h5 { margin: 6px 0 4px; font-size: 13px; font-weight: 700; color: var(--rd-text); }
.rd-explain-card p { margin: 0; color: var(--rd-text2); }
.rd-explain-icon { font-size: 20px; }

.rd-metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.rd-metric-card {
  background: var(--rd-bg); border: 1px solid var(--rd-border); border-radius: var(--rd-rl); padding: 16px;
}
.rd-metric-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rd-metric-name { font-size: 12px; font-weight: 600; color: var(--rd-text2); text-transform: uppercase; letter-spacing: .03em; }
.rd-metric-badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--rd-border); color: var(--rd-text3);
}
.rd-metric-badge.good { background: #d1fae5; color: #065f46; }
.rd-metric-badge.ok { background: #fef3c7; color: #92400e; }
.rd-metric-badge.hard { background: #fed7aa; color: #9a3412; }
.rd-metric-badge.bad { background: #fecaca; color: #991b1b; }

.rd-metric-val { font-size: 24px; font-weight: 800; color: var(--rd-text); margin-bottom: 8px; }
.rd-metric-bar { height: 6px; background: var(--rd-border); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.rd-mbar-fill { height: 100%; width: 0%; border-radius: 3px; transition: width .5s ease, background .3s; background: var(--rd-accent); }
.rd-mbar-fill.good { background: var(--rd-green); }
.rd-mbar-fill.ok { background: var(--rd-yellow); }
.rd-mbar-fill.hard { background: var(--rd-orange); }
.rd-mbar-fill.bad { background: var(--rd-red); }

.rd-metric-desc { font-size: 11px; color: var(--rd-text3); line-height: 1.4; }

/* ── Stats ──────────────────────────────────────────────── */
.rd-stats-section { display: none; padding: 0 24px 8px; }
.rd-stats-section.visible { display: block; }
.rd-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rd-stat-item {
  background: var(--rd-bg); border: 1px solid var(--rd-border); border-radius: var(--rd-r);
  padding: 14px; text-align: center;
}
.rd-stat-val { display: block; font-size: 22px; font-weight: 700; color: var(--rd-text); }
.rd-stat-label { display: block; font-size: 12px; color: var(--rd-text3); margin-top: 4px; }

/* ── Sentence Heatmap ───────────────────────────────────── */
.rd-heatmap-section { display: none; padding: 0 24px 8px; }
.rd-heatmap-section.visible { display: block; }
.rd-heatmap-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.rd-heatmap-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--rd-text3); }
.rd-hl-easy-swatch, .rd-hl-ok-swatch, .rd-hl-hard-swatch, .rd-hl-vhard-swatch {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
}
.rd-hl-easy-swatch { background: #d1fae5; }
.rd-hl-ok-swatch { background: #fef3c7; }
.rd-hl-hard-swatch { background: #fed7aa; }
.rd-hl-vhard-swatch { background: #fecaca; }

.rd-heatmap-body {
  background: var(--rd-bg); border: 1px solid var(--rd-border); border-radius: var(--rd-rl);
  padding: 20px; font-size: 15px; line-height: 1.8; max-height: 400px; overflow-y: auto; word-wrap: break-word;
}
.rd-heatmap-body .rd-sent { border-radius: 3px; padding: 1px 2px; transition: background .3s; }
.rd-heatmap-body .rd-sent-easy { background: #d1fae5; }
.rd-heatmap-body .rd-sent-ok { background: #fef3c7; }
.rd-heatmap-body .rd-sent-hard { background: #fed7aa; }
.rd-heatmap-body .rd-sent-vhard { background: #fecaca; }

/* ── Suggestions ────────────────────────────────────────── */
.rd-suggestions { display: none; padding: 0 24px 16px; }
.rd-suggestions.visible { display: block; }
.rd-tip-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.rd-tip-list li {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px;
  background: var(--rd-bg); border: 1px solid var(--rd-border); border-radius: var(--rd-r);
  font-size: 13px; color: var(--rd-text2); line-height: 1.5;
}
.rd-tip-icon { flex-shrink: 0; font-size: 16px; }

/* ── Privacy ────────────────────────────────────────────── */
.rd-privacy {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; font-size: 12px; color: var(--rd-text3); border-top: 1px solid var(--rd-border);
}

/* ── Toast ──────────────────────────────────────────────── */
.rd-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--rd-text); color: #fff; padding: 10px 20px; border-radius: var(--rd-r);
  font-size: 13px; opacity: 0; transition: all .3s ease; z-index: 9999; pointer-events: none;
}
.rd-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── RTL ────────────────────────────────────────────────── */
[dir="rtl"] .rd-textarea, [dir="rtl"] .rd-heatmap-body { text-align: right; }
[dir="rtl"] .rd-metric-name { text-align: right; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .rd-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .rd-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .rd-explain-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .rd-big-score { flex-direction: column; gap: 16px; padding: 16px; }
  .rd-metrics-grid { grid-template-columns: 1fr; }
  .rd-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .rd-explain-grid { grid-template-columns: 1fr; }
  .rd-heatmap-header { flex-direction: column; align-items: flex-start; }
}

/* ==========================================================================
   Button Upgrade — theme-proof overrides
   ========================================================================== */
.tool-card.rd .rd-btn-ghost{background:var(--rd-bg)!important;color:var(--rd-text2)!important;border:1px solid var(--rd-border2)!important;border-radius:var(--rd-r)!important;font-weight:600!important;transition:all .2s cubic-bezier(.4,0,.2,1)!important}
.tool-card.rd .rd-btn-ghost:hover{border-color:var(--rd-accent)!important;color:var(--rd-accent)!important;background:var(--rd-bg)!important}
