/* ═══════════════════════════════════════════════════════════════════
   case-tool.css  -  Case Converter  |  Scoped under #cct-root
   Theme: Light / Yellow-Amber accent - Premium SaaS
   Fix v2: all button/card rules use #cct-root prefix for proper
           specificity - beats the global reset that stripped borders
═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────── */
#cct-root {
  --cct-bg:           #fafaf8;
  --cct-surface:      #ffffff;
  --cct-surface2:     #fffef5;
  --cct-surface3:     #fffbeb;
  --cct-border:       #e8e4d8;
  --cct-border2:      #d9d3c0;
  --cct-accent:       #d97706;
  --cct-accent-bright:#f59e0b;
  --cct-accent-dim:   rgba(217,119,6,0.10);
  --cct-accent-glow:  rgba(245,158,11,0.22);
  --cct-accent-ring:  rgba(217,119,6,0.30);
  --cct-ok:           #16a34a;
  --cct-ok-dim:       rgba(22,163,74,0.12);
  --cct-text:         #1c1a14;
  --cct-text2:        #57534a;
  --cct-text3:        #78716a;
  --cct-muted:        #a8a08e;
  --cct-sans:         'Outfit', system-ui, -apple-system, sans-serif;
  --cct-mono:         'JetBrains Mono','Fira Code',ui-monospace,monospace;
  --cct-radius:       14px;
  --cct-radius-sm:    9px;
  --cct-radius-xs:    5px;
  --cct-shadow-sm:    0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
  --cct-shadow:       0 4px 16px rgba(0,0,0,.08),0 1px 4px rgba(0,0,0,.04);
  --cct-shadow-lg:    0 12px 40px rgba(0,0,0,.10),0 2px 8px rgba(0,0,0,.05);
  --cct-ease:         cubic-bezier(.25,.46,.45,.94);
  --cct-t:            160ms;

  font-family: var(--cct-sans);
  color: var(--cct-text);
  background: var(--cct-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px 100px;
}

#cct-root *, #cct-root *::before, #cct-root *::after { box-sizing: border-box; }
#cct-root button  { cursor: pointer; font-family: var(--cct-sans); }
#cct-root textarea, #cct-root input { font-family: var(--cct-sans); }

/* ════════════════════ HERO ════════════════════════════════════ */
#cct-root .cct-hero {
  text-align: center;
  padding: 48px 20px 36px;
}
#cct-root .cct-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  border-radius: 99px;
  background: var(--cct-accent-dim);
  border: 1px solid var(--cct-accent-ring);
  color: var(--cct-accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
#cct-root .cct-hero-badge svg { width:14px; height:14px; flex-shrink:0; }
#cct-root .cct-hero h1 {
  font-size: clamp(2rem,5vw,3.1rem);
  font-weight: 800;
  line-height: 1.12;
  color: var(--cct-text);
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
#cct-root .cct-hero h1 span {
  color: var(--cct-accent);
  background: linear-gradient(135deg, var(--cct-accent) 0%, var(--cct-accent-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#cct-root .cct-hero p {
  font-size: 1.0625rem;
  color: var(--cct-text2);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ════════════════════ GRID ════════════════════════════════════ */
#cct-root .cct-main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width:860px) { #cct-root .cct-main { grid-template-columns:1fr; } }

/* ════════════════════ CARDS ═══════════════════════════════════ */
#cct-root .cct-card {
  background: var(--cct-surface);
  border: 1.5px solid var(--cct-border);
  border-radius: var(--cct-radius);
  box-shadow: var(--cct-shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
#cct-root .cct-card:last-child { margin-bottom: 0; }

#cct-root .cct-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1.5px solid var(--cct-border);
  background: linear-gradient(to bottom, var(--cct-surface2), var(--cct-surface));
}
#cct-root .cct-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cct-text);
}
#cct-root .cct-card-title svg { width:16px; height:16px; color:var(--cct-accent); flex-shrink:0; }
#cct-root .cct-card-actions { display:flex; align-items:center; gap:7px; flex-wrap:wrap; }

/* ════════════════════ BUTTONS (all high-specificity) ══════════ */

/* Base */
#cct-root .cct-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--cct-radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--cct-t) var(--cct-ease);
  border: 1.5px solid transparent !important;
  background: transparent !important;
  color: inherit;
}
#cct-root .cct-btn svg { width:13px; height:13px; }

/* Primary */
#cct-root .cct-btn.cct-btn-primary,
#cct-root .cct-btn-primary {
  background: linear-gradient(135deg, var(--cct-accent) 0%, var(--cct-accent-bright) 100%) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 8px var(--cct-accent-glow);
}
#cct-root .cct-btn.cct-btn-primary:hover,
#cct-root .cct-btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px var(--cct-accent-glow);
}
#cct-root .cct-btn-primary:active { transform:translateY(0); filter:brightness(.96); }

/* Outline */
#cct-root .cct-btn.cct-btn-outline,
#cct-root .cct-btn-outline {
  background: var(--cct-surface) !important;
  border-color: var(--cct-border2) !important;
  color: var(--cct-text2) !important;
}
#cct-root .cct-btn.cct-btn-outline:hover,
#cct-root .cct-btn-outline:hover {
  border-color: var(--cct-accent) !important;
  color: var(--cct-accent) !important;
  background: var(--cct-accent-dim) !important;
}

/* Ghost */
#cct-root .cct-btn.cct-btn-ghost,
#cct-root .cct-btn-ghost {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--cct-text3) !important;
}
#cct-root .cct-btn.cct-btn-ghost:hover,
#cct-root .cct-btn-ghost:hover {
  background: var(--cct-surface3) !important;
  color: var(--cct-text) !important;
  border-color: var(--cct-border) !important;
}

/* ════════════════════ TEXTAREAS ═══════════════════════════════ */
#cct-root .cct-textarea {
  display: block;
  width: 100%;
  min-height: 200px;
  padding: 16px;
  border: none;
  outline: none;
  resize: vertical;
  font-size: 15px;
  line-height: 1.65;
  color: var(--cct-text);
  background: var(--cct-surface);
}
#cct-root .cct-textarea::placeholder { color: var(--cct-muted); }
#cct-root .cct-textarea:focus { background: var(--cct-surface2); }

#cct-root .cct-output-area {
  display: block;
  width: 100%;
  min-height: 170px;
  padding: 16px;
  border: none;
  outline: none;
  resize: vertical;
  font-size: 15px;
  line-height: 1.65;
  color: var(--cct-text);
  background: var(--cct-surface3);
}
#cct-root .cct-output-area::placeholder { color: var(--cct-muted); }
#cct-root .cct-output-area:focus { outline: 2px solid var(--cct-accent-ring); outline-offset:-2px; }

/* ════════════════════ INLINE STATS BAR ═══════════════════════ */
#cct-root .cct-inline-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1.5px solid var(--cct-border);
  background: var(--cct-surface2);
}
#cct-root .cct-inline-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 99px;
  background: var(--cct-surface3);
  border: 1px solid var(--cct-accent-ring);
  font-size: 12px;
}
#cct-root .cct-pill-val { font-weight:700; color:var(--cct-accent); font-size:13px; font-variant-numeric:tabular-nums; }
#cct-root .cct-pill-lbl { color:var(--cct-text3); font-weight:500; }

/* ════════════════════ CASE SECTION ════════════════════════════ */
#cct-root .cct-case-section { padding: 18px; }

#cct-root .cct-case-group-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cct-muted);
  margin-bottom: 10px;
  margin-top: 4px;
}

#cct-root .cct-case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px,1fr));
  gap: 9px;
  margin-bottom: 20px;
}

/* ── THE FIX: case buttons with full specificity ────────────── */
#cct-root .cct-case-btn {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 12px 14px;
  border-radius: var(--cct-radius-sm);
  border: 1.5px solid var(--cct-border) !important;
  background: var(--cct-surface) !important;
  color: var(--cct-text);
  text-align: left;
  cursor: pointer;
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: all var(--cct-t) var(--cct-ease);
  box-shadow: var(--cct-shadow-sm);
}
#cct-root .cct-case-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--cct-accent-dim) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--cct-t) var(--cct-ease);
  pointer-events: none;
}
#cct-root .cct-case-btn:hover {
  border-color: var(--cct-accent) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--cct-accent-glow) !important;
}
#cct-root .cct-case-btn:hover::after { opacity: 1; }
#cct-root .cct-case-btn:active { transform: translateY(0); }

#cct-root .cct-case-btn.cct-active {
  border-color: var(--cct-accent) !important;
  background: var(--cct-surface3) !important;
  box-shadow: 0 0 0 3px var(--cct-accent-ring), var(--cct-shadow-sm) !important;
}
#cct-root .cct-case-btn.cct-active::after { opacity: 1; }

#cct-root .cct-case-btn-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cct-text);
  position: relative;
  z-index: 1;
  line-height: 1.2;
}
#cct-root .cct-case-btn-preview {
  font-size: 10.5px;
  color: var(--cct-text3);
  font-family: var(--cct-mono);
  position: relative;
  z-index: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
#cct-root .cct-case-btn.cct-active .cct-case-btn-label  { color: var(--cct-accent); }
#cct-root .cct-case-btn.cct-active .cct-case-btn-preview { color: var(--cct-accent); opacity:.75; }

/* ── Utility buttons ───────────────────────────────────────── */
#cct-root .cct-util-grid { display:flex; flex-wrap:wrap; gap:8px; }

#cct-root .cct-util-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--cct-radius-sm);
  border: 1.5px solid var(--cct-border) !important;
  background: var(--cct-surface) !important;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cct-text2);
  cursor: pointer;
  transition: all var(--cct-t) var(--cct-ease);
  box-shadow: var(--cct-shadow-sm);
}
#cct-root .cct-util-btn svg { width:13px; height:13px; flex-shrink:0; }
#cct-root .cct-util-btn:hover {
  border-color: var(--cct-accent) !important;
  color: var(--cct-accent);
  background: var(--cct-accent-dim) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--cct-accent-glow);
}
#cct-root .cct-util-btn:active { transform:translateY(0); }

/* ════════════════════ SIDEBAR ═════════════════════════════════ */
#cct-root .cct-sidebar { display:flex; flex-direction:column; gap:0; }

#cct-root .cct-stat-list { padding: 4px 0; }
#cct-root .cct-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
  border-bottom: 1px solid var(--cct-border);
  transition: background var(--cct-t) var(--cct-ease);
}
#cct-root .cct-stat-row:last-child { border-bottom: none; }
#cct-root .cct-stat-row:hover { background: var(--cct-surface2); }
#cct-root .cct-stat-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--cct-text2);
  font-weight: 500;
}
#cct-root .cct-stat-icon {
  width: 30px; height: 30px;
  border-radius: var(--cct-radius-xs);
  background: var(--cct-accent-dim);
  border: 1px solid var(--cct-accent-ring);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#cct-root .cct-stat-icon svg { width:13px; height:13px; color:var(--cct-accent); }
#cct-root .cct-stat-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--cct-accent);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

#cct-root .cct-active-badge {
  margin: 12px 16px 16px;
  padding: 10px 14px;
  border-radius: var(--cct-radius-sm);
  background: var(--cct-surface3);
  border: 1.5px solid var(--cct-accent-ring);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#cct-root .cct-active-badge-label { font-size:11.5px; color:var(--cct-text3); font-weight:500; }
#cct-root .cct-active-badge-val   { font-size:12.5px; font-weight:700; color:var(--cct-accent); }

/* History */
#cct-root .cct-history-list {
  max-height: 260px;
  overflow-y: auto;
}
#cct-root .cct-history-list::-webkit-scrollbar { width:4px; }
#cct-root .cct-history-list::-webkit-scrollbar-thumb { background:var(--cct-border2); border-radius:99px; }

#cct-root .cct-history-item {
  padding: 10px 18px;
  border-bottom: 1px solid var(--cct-border);
  cursor: pointer;
  transition: background var(--cct-t) var(--cct-ease);
}
#cct-root .cct-history-item:last-child { border-bottom:none; }
#cct-root .cct-history-item:hover { background: var(--cct-surface2); }
#cct-root .cct-history-meta { display:flex; align-items:center; justify-content:space-between; margin-bottom:3px; }
#cct-root .cct-history-case { font-size:10.5px; font-weight:700; color:var(--cct-accent); text-transform:uppercase; letter-spacing:.04em; }
#cct-root .cct-history-time { font-size:10px; color:var(--cct-muted); }
#cct-root .cct-history-text { font-size:12px; color:var(--cct-text2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#cct-root .cct-history-empty { padding:24px 18px; text-align:center; color:var(--cct-muted); font-size:13px; font-style:italic; }

#cct-root .cct-history-clear {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--cct-muted);
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: var(--cct-radius-xs);
  cursor: pointer;
  transition: all var(--cct-t) var(--cct-ease);
}
#cct-root .cct-history-clear svg { width:11px; height:11px; }
#cct-root .cct-history-clear:hover {
  color: #ef4444 !important;
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

/* ════════════════════ STICKY BAR ══════════════════════════════ */
#cct-root .cct-sticky-bar {
  display: none;
  position: fixed;
  bottom:0; left:0; right:0;
  z-index: 100;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1.5px solid var(--cct-border);
  padding: 10px 16px 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
#cct-root .cct-sticky-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  max-width: 440px;
  margin: 0 auto;
}
#cct-root .cct-sticky-pill { display:flex; flex-direction:column; align-items:center; gap:2px; }
#cct-root .cct-sp-val { font-size:16px; font-weight:800; color:var(--cct-accent); font-variant-numeric:tabular-nums; line-height:1.1; }
#cct-root .cct-sp-lbl { font-size:10px; color:var(--cct-muted); font-weight:600; text-transform:uppercase; letter-spacing:.05em; }

@media (max-width:640px) { #cct-root .cct-sticky-bar { display:flex; } }

/* ════════════════════ TOAST ═══════════════════════════════════ */
#cct-root .cct-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 10px 22px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  opacity: 0;
  transition: all .26s var(--cct-ease);
  pointer-events: none;
  z-index: 300;
  white-space: nowrap;
  background: var(--cct-text);
  color: #fff;
}
#cct-root .cct-toast.cct-toast-show    { opacity:1; transform:translateX(-50%) translateY(0); }
#cct-root .cct-toast.cct-toast-success { background:var(--cct-ok); }
#cct-root .cct-toast.cct-toast-info    { background:var(--cct-accent); }

/* ════════════════════ SEO SECTION ═════════════════════════════ */
#cct-root .cct-seo {
  margin-top: 64px;
  border-top: 1.5px solid var(--cct-border);
  padding-top: 52px;
}
#cct-root .cct-seo-headline {
  text-align: center;
  font-size: clamp(1.4rem,3vw,2rem);
  font-weight: 800;
  color: var(--cct-text);
  margin-bottom: 32px;
  letter-spacing: -.02em;
}
#cct-root .cct-seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
  gap: 18px;
  margin-bottom: 52px;
}
#cct-root .cct-seo-card {
  background: var(--cct-surface);
  border: 1.5px solid var(--cct-border);
  border-radius: var(--cct-radius);
  padding: 24px;
  box-shadow: var(--cct-shadow-sm);
  transition: box-shadow var(--cct-t) var(--cct-ease), transform var(--cct-t) var(--cct-ease);
}
#cct-root .cct-seo-card:hover { box-shadow:var(--cct-shadow); transform:translateY(-2px); }
#cct-root .cct-seo-card h3 {
  display: flex; align-items:center; gap:9px;
  font-size:14.5px; font-weight:700; color:var(--cct-text); margin:0 0 10px;
}
#cct-root .cct-seo-card h3 svg { width:18px; height:18px; color:var(--cct-accent); flex-shrink:0; }
#cct-root .cct-seo-card p { font-size:13.5px; line-height:1.68; color:var(--cct-text2); margin:0; }

/* Reference Table */
#cct-root .cct-ref-section { margin-bottom:52px; }
#cct-root .cct-ref-section h2 { font-size:1.3rem; font-weight:800; color:var(--cct-text); margin:0 0 18px; letter-spacing:-.01em; }
#cct-root .cct-ref-table { width:100%; border-collapse:collapse; font-size:13.5px; border-radius:var(--cct-radius); overflow:hidden; border:1.5px solid var(--cct-border); box-shadow:var(--cct-shadow-sm); }
#cct-root .cct-ref-table th { background:var(--cct-surface3); padding:12px 16px; text-align:left; font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--cct-accent); border-bottom:1.5px solid var(--cct-border2); }
#cct-root .cct-ref-table td { padding:11px 16px; border-bottom:1px solid var(--cct-border); color:var(--cct-text2); vertical-align:middle; }
#cct-root .cct-ref-table tr:last-child td { border-bottom:none; }
#cct-root .cct-ref-table tr:hover td { background:var(--cct-surface2); }
#cct-root .cct-ref-table td:first-child { font-weight:700; color:var(--cct-text); white-space:nowrap; }
#cct-root .cct-ref-table td:nth-child(2) { font-family:var(--cct-mono); font-size:12.5px; color:var(--cct-accent); font-weight:600; }

/* FAQ */
#cct-root .cct-faq-section h2 { font-size:1.3rem; font-weight:800; color:var(--cct-text); margin:0 0 18px; letter-spacing:-.01em; }
#cct-root .cct-faq-list { display:flex; flex-direction:column; border-radius:var(--cct-radius); overflow:hidden; border:1.5px solid var(--cct-border); box-shadow:var(--cct-shadow-sm); }
#cct-root .cct-faq-item { background:var(--cct-surface); border-bottom:1px solid var(--cct-border); }
#cct-root .cct-faq-item:last-child { border-bottom:none; }
#cct-root .cct-faq-q {
  width:100%; display:flex !important; align-items:center; justify-content:space-between; gap:12px;
  padding:16px 20px; font-size:14px; font-weight:600; color:var(--cct-text); text-align:left;
  background:transparent !important; border:none !important; cursor:pointer;
  transition: background var(--cct-t) var(--cct-ease), color var(--cct-t) var(--cct-ease);
}
#cct-root .cct-faq-q:hover { background:var(--cct-surface2) !important; }
#cct-root .cct-faq-q[aria-expanded="true"] { color:var(--cct-accent); background:var(--cct-surface3) !important; }
#cct-root .cct-faq-chevron { width:16px; height:16px; flex-shrink:0; transition:transform var(--cct-t) var(--cct-ease); color:var(--cct-muted); }
#cct-root .cct-faq-q[aria-expanded="true"] .cct-faq-chevron { transform:rotate(180deg); color:var(--cct-accent); }
#cct-root .cct-faq-a { display:none; padding:2px 20px 18px; font-size:13.5px; line-height:1.72; color:var(--cct-text2); }
#cct-root .cct-faq-a.cct-open { display:block; }
#cct-root .cct-faq-a code { font-family:var(--cct-mono); font-size:12px; background:var(--cct-surface3); border:1px solid var(--cct-border2); border-radius:4px; padding:1px 5px; color:var(--cct-accent); }

/* ════════════════════ RESPONSIVE ══════════════════════════════ */
@media (max-width:640px) {
  #cct-root { padding:0 12px 110px; }
  #cct-root .cct-hero { padding:32px 16px 24px; }
  #cct-root .cct-case-grid { grid-template-columns:repeat(2,1fr); }
  #cct-root .cct-card-header { flex-wrap:wrap; gap:8px; }
  #cct-root .cct-btn { padding:6px 11px; font-size:12px; }
  #cct-root .cct-ref-table { font-size:12px; }
  #cct-root .cct-ref-table td, #cct-root .cct-ref-table th { padding:9px 12px; }
}
