/* ============================================================
   TOOLSHUB4U — TEXT & WRITING TOOLS (shared base)
   Used by: word-counter, case-converter, lorem-ipsum-generator,
            grammar-checker, code-lorem
   Each page carries its own scoped (wc-/cc-/lig-/gc-) styles.
   This file provides the shared section shell + dark theme
   token alignment so tools blend with the Aurora Dark design.
   ============================================================ */

/* ==============================
   TOOL SECTION SHELL
   ============================== */
.twt-tool-section,
.tw-tool-section {
  position: relative;
  width: 100%;
  max-width: 1100px;
  margin: var(--space-2xl, 3rem) auto;
  padding: var(--space-2xl, 3rem) var(--space-xl, 2rem);
  background: linear-gradient(160deg, rgba(19, 29, 51, .85), rgba(14, 22, 38, .95));
  border: 1px solid var(--border, rgba(148, 163, 184, .16));
  border-radius: var(--radius-2xl, 30px);
  box-shadow: var(--shadow-lg, 0 16px 48px rgba(0, 0, 0, .5));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  isolation: isolate;
  overflow: hidden;
  box-sizing: border-box;
}
.twt-tool-section::before,
.tw-tool-section::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad-brand, linear-gradient(135deg, #6366f1, #a855f7, #22d3ee));
  z-index: 2;
}

/* Neutralize the page-wide inline reset so tool sections keep sane spacing */
.twt-tool-section *,
.tw-tool-section * {
  box-sizing: border-box;
}

/* ==============================
   DARK THEME TOKEN ALIGNMENT
   (higher specificity than the pages' inline :root blocks)
   ============================== */
html[data-theme="dark"] {
  /* ── Word Counter (wc-) ── */
  --wc-bg: #0b1120;
  --wc-surface: #0e1626;
  --wc-surface-2: #131d33;
  --wc-border: rgba(148, 163, 184, .16);
  --wc-border-2: rgba(148, 163, 184, .28);
  --wc-text-primary: #e7ecf5;
  --wc-text-secondary: #9aa8bd;
  --wc-text-muted: #64748b;
  --wc-accent: #818cf8;
  --wc-accent-dark: #6366f1;
  --wc-accent-light: rgba(99, 102, 241, .16);
  --wc-success: #34d399;
  --wc-success-light: rgba(16, 185, 129, .16);
  --wc-warning: #fbbf24;
  --wc-warning-light: rgba(245, 158, 11, .16);
  --wc-danger: #f87171;
  --wc-danger-light: rgba(239, 68, 68, .16);
  --wc-shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
  --wc-shadow-md: 0 6px 24px rgba(0, 0, 0, .45);
  --wc-shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);

  /* ── Case Converter / Code Lorem (cc-) ── */
  --cc-bg: #0b1120;
  --cc-surface: #0e1626;
  --cc-surface-2: #131d33;
  --cc-surface-3: #182440;
  --cc-border: rgba(148, 163, 184, .16);
  --cc-border-2: rgba(148, 163, 184, .28);
  --cc-text-primary: #e7ecf5;
  --cc-text-secondary: #9aa8bd;
  --cc-text-muted: #64748b;
  --cc-accent: #818cf8;
  --cc-accent-dark: #6366f1;
  --cc-accent-light: rgba(99, 102, 241, .16);
  --cc-accent-2: #a855f7;
  --cc-success: #34d399;
  --cc-success-light: rgba(16, 185, 129, .16);
  --cc-warning: #fbbf24;
  --cc-danger: #f87171;

  /* ── Lorem Ipsum / Grammar (tw-) ── */
  --tw-bg-primary: #0e1626;
  --tw-bg-secondary: #131d33;
  --tw-bg-tertiary: #182440;
  --tw-text-primary: #e7ecf5;
  --tw-text-secondary: #9aa8bd;
  --tw-text-muted: #64748b;
  --tw-border: rgba(148, 163, 184, .16);
  --tw-border-color: rgba(148, 163, 184, .16);
  --tw-accent: #818cf8;
  --tw-accent-dark: #6366f1;
  --tw-accent-light: rgba(99, 102, 241, .16);
}

/* Hardcoded light fills inside tool cards */
html[data-theme="dark"] .cc-detail-box,
html[data-theme="dark"] .cc-result-box,
html[data-theme="dark"] .cc-ref-card,
html[data-theme="dark"] .lig-setting-group,
html[data-theme="dark"] .lig-output-area,
html[data-theme="dark"] .gc-card {
  background: var(--cc-surface, #0e1626) !important;
  border-color: var(--cc-border, rgba(148, 163, 184, .16)) !important;
  color: var(--cc-text-primary, #e7ecf5) !important;
}

/* Inputs / textareas across text tools */
html[data-theme="dark"] .cc-textarea,
html[data-theme="dark"] .wc-textarea,
html[data-theme="dark"] .lig-raw-textarea,
html[data-theme="dark"] .gc-textarea,
html[data-theme="dark"] .wc-limit-input,
html[data-theme="dark"] .lig-amount-input,
html[data-theme="dark"] .lig-select,
html[data-theme="dark"] .cc-input,
html[data-theme="dark"] .cc-select {
  background: var(--cc-surface-2, #131d33) !important;
  border-color: var(--cc-border, rgba(148, 163, 184, .16)) !important;
  color: var(--cc-text-primary, #e7ecf5) !important;
}
html[data-theme="dark"] .cc-textarea::placeholder,
html[data-theme="dark"] .wc-textarea::placeholder,
html[data-theme="dark"] .lig-raw-textarea::placeholder,
html[data-theme="dark"] .gc-textarea::placeholder {
  color: var(--cc-text-muted, #64748b) !important;
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 768px) {
  .twt-tool-section,
  .tw-tool-section {
    margin: var(--space-xl, 2rem) auto;
    padding: var(--space-lg, 1.5rem) var(--space-md, 1rem);
    border-radius: var(--radius-xl, 22px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .twt-tool-section::before,
  .tw-tool-section::before { height: 3px; }
}

/* Light theme: section shell back to light glass */
[data-theme="light"] .twt-tool-section,
[data-theme="light"] .tw-tool-section {
  background: linear-gradient(160deg, #ffffff, #f1f5fb);
  border-color: rgba(15, 23, 42, .12);
  box-shadow: 0 16px 48px rgba(15, 23, 42, .12);
}

/* ==============================
   GRAMMAR CHECKER (gc-)
   Full product styling: glass card, two-column body,
   review view, issue cards, stats, how-it-works.
   ============================== */

.gc-tool-wrapper {
  max-width: 1100px;
  margin: var(--space-2xl, 3rem) auto;
  padding: 0 var(--space-xl, 2rem);
}

.gc-card,
html[data-theme="dark"] .gc-card {
  position: relative;
  background: linear-gradient(160deg, rgba(19, 29, 51, .85), rgba(14, 22, 38, .95)) !important;
  border: 1px solid var(--border, rgba(148, 163, 184, .16)) !important;
  border-radius: var(--radius-2xl, 30px);
  box-shadow: var(--shadow-lg, 0 16px 48px rgba(0, 0, 0, .5));
  padding: var(--space-xl, 2rem);
  overflow: hidden;
  isolation: isolate;
}

.gc-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad-brand, linear-gradient(135deg, #6366f1, #a855f7, #22d3ee));
  z-index: 1;
}

/* header */
.gc-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.gc-header__icon {
  flex: 0 0 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: var(--shadow-md, 0 4px 14px rgba(99, 102, 241, .45));
}

.gc-header__text { flex: 1; min-width: 180px; }
.gc-header__title { margin: 0; font-size: 1.25rem; font-weight: 700; }
.gc-header__sub { margin: .2rem 0 0; font-size: .85rem; color: var(--cc-text-muted, #94a3b8); }

.gc-header__badges { display: flex; gap: .5rem; }

.gc-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
  font-weight: 700;
  padding: .3rem .7rem;
  border-radius: 999px;
}

.gc-badge--free {
  color: #34d399;
  background: rgba(16, 185, 129, .14);
  border: 1px solid rgba(16, 185, 129, .35);
}

.gc-badge--live {
  color: #22d3ee;
  background: rgba(34, 211, 238, .1);
  border: 1px solid rgba(34, 211, 238, .3);
}

.gc-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22d3ee;
  animation: gc-pulse 1.6s ease-in-out infinite;
}

@keyframes gc-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.8); }
}

/* body: two columns */
.gc-body {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.gc-input-panel,
.gc-result-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.gc-input-toolbar,
.gc-result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.gc-input-label,
.gc-result-label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--cc-text-muted, #94a3b8);
}

.gc-word-badge,
.gc-error-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--cc-text-primary, #e7ecf5);
  background: var(--cc-surface-2, #131d33);
  border: 1px solid var(--cc-border, rgba(148, 163, 184, .16));
  border-radius: 999px;
  padding: .28rem .75rem;
}

.gc-error-badge--clean {
  color: #34d399;
  border-color: rgba(16, 185, 129, .4);
  background: rgba(16, 185, 129, .1);
}

.gc-textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  font: inherit;
  font-size: .95rem;
  line-height: 1.65;
  color: var(--cc-text-primary, #e7ecf5);
  background: var(--cc-surface-2, #131d33);
  border: 1px solid var(--cc-border, rgba(148, 163, 184, .16));
  border-radius: var(--radius-lg, 14px);
  padding: .9rem 1rem;
  transition: border-color .2s ease, box-shadow .2s ease;
  box-sizing: border-box;
}

.gc-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .2);
}

/* actions */
.gc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

.gc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  border-radius: var(--radius-md, 10px);
  padding: .6rem 1.15rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.gc-btn:active { transform: translateY(1px); }

.gc-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: var(--shadow-md, 0 4px 14px rgba(99, 102, 241, .4));
}

.gc-btn--primary:hover { box-shadow: 0 6px 20px rgba(99, 102, 241, .55); }

.gc-btn--danger {
  color: #f87171;
  background: rgba(239, 68, 68, .08);
  border-color: rgba(239, 68, 68, .35);
}

.gc-btn--danger:hover { background: rgba(239, 68, 68, .16); }

.gc-btn--ghost {
  color: var(--cc-text-primary, #e7ecf5);
  background: var(--cc-surface-2, #131d33);
  border-color: var(--cc-border, rgba(148, 163, 184, .16));
}

.gc-btn--ghost:hover { border-color: #6366f1; }

.gc-btn--sm { font-size: .8rem; padding: .4rem .85rem; border-radius: 8px; }

.gc-btn.is-loading { pointer-events: none; opacity: .75; }

.gc-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gc-spin .7s linear infinite;
}

.gc-btn.is-loading .gc-spinner { display: inline-block; }

@keyframes gc-spin { to { transform: rotate(360deg); } }

/* result panel */
.gc-result-output {
  min-height: 230px;
  background: var(--cc-surface-2, #131d33);
  border: 1px solid var(--cc-border, rgba(148, 163, 184, .16));
  border-radius: var(--radius-lg, 14px);
  padding: 1rem;
  overflow-y: auto;
  max-height: 460px;
}

/* empty state */
.gc-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  gap: .4rem;
}

.gc-empty-state__icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #818cf8;
  background: rgba(99, 102, 241, .12);
  border: 1px solid rgba(99, 102, 241, .3);
  margin-bottom: .4rem;
}

.gc-empty-state__title { margin: 0; font-size: 1.05rem; font-weight: 700; }
.gc-empty-state__desc { margin: 0 0 .6rem; font-size: .85rem; color: var(--cc-text-muted, #94a3b8); }

.gc-empty-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .45rem .9rem;
  width: 100%;
  max-width: 420px;
}

.gc-empty-features li {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--cc-text-primary, #e7ecf5);
  background: rgba(148, 163, 184, .07);
  border: 1px solid var(--cc-border, rgba(148, 163, 184, .12));
  border-radius: 8px;
  padding: .4rem .6rem;
}

.gc-empty-features svg { color: #34d399; flex: 0 0 auto; }

/* results */
.gc-result-clean {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem;
  gap: .3rem;
}

.gc-result-clean__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #34d399;
  background: rgba(16, 185, 129, .12);
  margin-bottom: .4rem;
}

.gc-result-clean h3 { margin: 0; font-size: 1.05rem; }
.gc-result-clean p { margin: 0; font-size: .85rem; color: var(--cc-text-muted, #94a3b8); }

.gc-summary__head {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .9rem;
}

.gc-summary__icon {
  color: #818cf8;
  display: inline-flex;
}

.gc-summary h3 { margin: 0; font-size: 1.05rem; }

.gc-summary__chips { display: flex; gap: .35rem; flex-wrap: wrap; margin-left: auto; }

.gc-chip {
  font-size: .72rem;
  font-weight: 700;
  text-transform: capitalize;
  border-radius: 999px;
  padding: .22rem .6rem;
}

.gc-chip--spelling { color: #fbbf24; background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .3); }
.gc-chip--grammar { color: #fb7185; background: rgba(244, 63, 94, .12); border: 1px solid rgba(244, 63, 94, .3); }
.gc-chip--punctuation { color: #22d3ee; background: rgba(34, 211, 238, .1); border: 1px solid rgba(34, 211, 238, .3); }
.gc-chip--style { color: #a78bfa; background: rgba(139, 92, 246, .12); border: 1px solid rgba(139, 92, 246, .3); }

.gc-result-actions {
  display: flex;
  gap: .5rem;
  margin-bottom: .9rem;
}

/* inline review with highlights */
.gc-review {
  background: var(--cc-surface, #0e1626);
  border: 1px solid var(--cc-border, rgba(148, 163, 184, .14));
  border-radius: 10px;
  padding: .8rem .95rem;
  font-size: .92rem;
  line-height: 2;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 1rem;
  color: var(--cc-text-primary, #e7ecf5);
}

.gc-hit {
  cursor: pointer;
  border-bottom: 2px solid;
  border-radius: 3px;
  padding: 0 2px;
  transition: filter .15s ease;
}

.gc-hit:hover { filter: brightness(1.25); }

.gc-hit--spelling { color: #fde68a; background: rgba(245, 158, 11, .16); border-color: #f59e0b; }
.gc-hit--grammar { color: #fecdd3; background: rgba(244, 63, 94, .16); border-color: #f43f5e; }
.gc-hit--punctuation { color: #cffafe; background: rgba(34, 211, 238, .12); border-color: #22d3ee; }
.gc-hit--style { color: #e9d5ff; background: rgba(139, 92, 246, .16); border-color: #8b5cf6; }

/* issue list */
.gc-issues {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.gc-issue-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: rgba(148, 163, 184, .06);
  border: 1px solid var(--cc-border, rgba(148, 163, 184, .14));
  border-radius: 10px;
  padding: .55rem .7rem;
}

.gc-issue-type {
  flex: 0 0 auto;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-radius: 6px;
  padding: .2rem .45rem;
}

.gc-issue-type--spelling { color: #fbbf24; background: rgba(245, 158, 11, .14); }
.gc-issue-type--grammar { color: #fb7185; background: rgba(244, 63, 94, .14); }
.gc-issue-type--punctuation { color: #22d3ee; background: rgba(34, 211, 238, .1); }
.gc-issue-type--style { color: #a78bfa; background: rgba(139, 92, 246, .14); }

.gc-issue-body { flex: 1; min-width: 0; }
.gc-issue-msg { margin: 0; font-size: .85rem; font-weight: 600; }
.gc-issue-count { font-size: .74rem; color: var(--cc-text-muted, #94a3b8); }

.gc-issue-fix { flex: 0 0 auto; }

.gc-result-note {
  margin: .8rem 0 0;
  font-size: .78rem;
  color: var(--cc-text-muted, #94a3b8);
  line-height: 1.5;
}

/* stats bar */
.gc-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .8rem;
  margin-top: 1.5rem;
}

.gc-stat {
  background: var(--cc-surface-2, #131d33);
  border: 1px solid var(--cc-border, rgba(148, 163, 184, .16));
  border-radius: var(--radius-lg, 14px);
  padding: .9rem 1rem;
  text-align: center;
}

.gc-stat__num {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.gc-stat__label {
  display: block;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--cc-text-muted, #94a3b8);
  margin-top: .15rem;
}

/* how it works */
.gc-how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .8rem;
  margin-top: 1.5rem;
}

.gc-how-step {
  background: var(--cc-surface-2, #131d33);
  border: 1px solid var(--cc-border, rgba(148, 163, 184, .16));
  border-radius: var(--radius-lg, 14px);
  padding: 1rem;
  text-align: center;
}

.gc-how-step__num {
  width: 32px;
  height: 32px;
  margin: 0 auto .5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: .95rem;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
}

.gc-how-step h4 { margin: 0 0 .25rem; font-size: .92rem; }
.gc-how-step p { margin: 0; font-size: .8rem; color: var(--cc-text-muted, #94a3b8); }

/* responsive */
@media (max-width: 900px) {
  .gc-body { grid-template-columns: 1fr; }
  .gc-stats-bar { grid-template-columns: repeat(2, 1fr); }
  .gc-how { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .gc-tool-wrapper { padding: 0 var(--space-md, 1rem); }
  .gc-card { padding: 1.2rem; border-radius: 22px; }
  .gc-empty-features { grid-template-columns: 1fr; }
  .gc-summary__chips { margin-left: 0; width: 100%; }
}

/* light theme */
[data-theme="light"] .gc-card {
  background: linear-gradient(160deg, #ffffff, #f1f5fb);
  border-color: rgba(15, 23, 42, .12);
  box-shadow: 0 16px 48px rgba(15, 23, 42, .12);
}

[data-theme="light"] .gc-textarea,
[data-theme="light"] .gc-result-output,
[data-theme="light"] .gc-review,
[data-theme="light"] .gc-word-badge,
[data-theme="light"] .gc-error-badge,
[data-theme="light"] .gc-btn--ghost,
[data-theme="light"] .gc-stat,
[data-theme="light"] .gc-how-step,
[data-theme="light"] .gc-empty-features li,
[data-theme="light"] .gc-issue-item {
  background: #ffffff;
  border-color: rgba(15, 23, 42, .12);
  color: #1e293b;
}

[data-theme="light"] .gc-header__sub,
[data-theme="light"] .gc-result-note,
[data-theme="light"] .gc-issue-count,
[data-theme="light"] .gc-stat__label,
[data-theme="light"] .gc-how-step p,
[data-theme="light"] .gc-empty-state__desc,
[data-theme="light"] .gc-result-clean p {
  color: #64748b;
}

[data-theme="light"] .gc-review { background: #f8fafc; }

@media (prefers-reduced-motion: reduce) {
  .gc-badge__dot { animation: none; }
}

