/* ============================================================
   CODE-VALIDATOR.CSS – makeCSS.com Code Validator Tool
   Validate HTML, CSS & JavaScript
   ============================================================ */

.cv-shell {
  display: grid;
  gap: var(--space-lg);
}

/* ---------- Language Tabs ---------- */
.cv-lang-tabs {
  display: flex;
  gap: var(--space-xs);
  padding: 4px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.cv-lang-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
  padding: 10px 16px;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--transition);
}

.cv-lang-tab:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.5);
}

.cv-lang-tab--active {
  background: #fff;
  color: var(--color-primary);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.cv-lang-tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.cv-lang-tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-left: 2px;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.16);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: var(--weight-bold);
  line-height: 1;
}

.cv-lang-tab__badge[hidden] {
  display: none;
}

.cv-lang-tab__badge--error {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

.cv-lang-tab__badge--warning {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}

/* ---------- Cards ---------- */
.cv-card {
  display: grid;
  gap: var(--space-md);
  padding: clamp(18px, 2vw, 24px);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius-lg) + 2px);
  background:
    radial-gradient(circle at top right, rgba(67, 97, 238, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  box-shadow: var(--shadow-sm);
}

.cv-card__head {
  display: grid;
  gap: 6px;
}

.cv-card__head--split {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-md);
  align-items: start;
}

.cv-card__title {
  font-size: clamp(1.05rem, 1.1vw, 1.2rem);
  letter-spacing: -0.02em;
}

.cv-card__text {
  max-width: 52ch;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.cv-card--input .cv-card__text {
  max-width: none;
}

/* ---------- Status Badge ---------- */
.cv-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  background-color: rgba(67, 97, 238, 0.08);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.cv-status--pass {
  background-color: rgba(34, 197, 94, 0.10);
  color: #16a34a;
}

.cv-status--fail {
  background-color: rgba(239, 68, 68, 0.10);
  color: #dc2626;
}

.cv-status--warnings {
  background-color: rgba(245, 158, 11, 0.10);
  color: #d97706;
}

/* ---------- Editor Wrapper (Line Numbers + Highlight Overlay) ---------- */
.cv-editor-wrap {
  display: flex;
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98));
  overflow: hidden;
  max-height: 500px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.cv-editor-wrap:focus-within {
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
}

/* ---------- Line Number Gutter ---------- */
.cv-line-numbers {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-width: 44px;
  padding: 16px 0;
  background: rgba(15, 23, 42, 0.4);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.cv-line-numbers span {
  display: block;
  padding: 0 10px 0 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  color: rgba(226, 232, 240, 0.3);
  transition: color 0.2s, background 0.2s;
}

.cv-line-numbers span.cv-line-active {
  color: #facc15;
  background: rgba(250, 204, 21, 0.08);
}

/* ---------- Highlight Wrap (Overlay Container) ---------- */
.cv-highlight-wrap {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ---------- Highlight Pre (Behind Textarea) ---------- */
.cv-highlight-pre {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 16px 18px;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  tab-size: 2;
  -moz-tab-size: 2;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: auto;
  pointer-events: none;
  color: transparent;
}

.cv-highlight-pre code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* ---------- Textarea (Transparent, On Top) ---------- */
.cv-textarea {
  width: 100%;
  height: 100%;
  min-height: 260px;
  max-height: 500px;
  padding: 16px 18px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: transparent;
  caret-color: #e2e8f0;
  -webkit-text-fill-color: transparent;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  tab-size: 2;
  -moz-tab-size: 2;
  resize: none;
  position: relative;
  z-index: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
}

.cv-textarea::placeholder {
  color: rgba(226, 232, 240, 0.5);
  -webkit-text-fill-color: rgba(226, 232, 240, 0.5);
}

.cv-textarea:focus {
  outline: none;
}

.cv-textarea::selection {
  background: rgba(56, 116, 203, 0.55);
  -webkit-text-fill-color: #e2e8f0;
  color: #e2e8f0;
}

/* ---------- Syntax Highlight Token Colors (VS Code Dark+) ---------- */

/* HTML tokens */
.sh-tag        { color: #569cd6; }
.sh-attr       { color: #9cdcfe; }
.sh-attr-val   { color: #ce9178; }
.sh-comment    { color: #6a9955; font-style: italic; }
.sh-entity     { color: #d4d4d4; }
.sh-punct      { color: #808080; }
.sh-doctype    { color: #569cd6; }
.sh-text       { color: #d4d4d4; }

/* CSS tokens */
.sh-selector   { color: #d7ba7d; }
.sh-property   { color: #9cdcfe; }
.sh-value      { color: #ce9178; }
.sh-unit       { color: #b5cea8; }
.sh-color-val  { color: #ce9178; }
.sh-important  { color: #569cd6; font-weight: 600; }
.sh-atrule     { color: #c586c0; }
.sh-brace      { color: #da70d6; }
.sh-colon      { color: #d4d4d4; }
.sh-func       { color: #dcdcaa; }

/* JavaScript tokens */
.sh-js-keyword       { color: #569cd6; }
.sh-js-literal       { color: #569cd6; }
.sh-js-builtin       { color: #4ec9b0; }
.sh-js-func          { color: #dcdcaa; }
.sh-js-string        { color: #ce9178; }
.sh-js-number        { color: #b5cea8; }
.sh-js-regex         { color: #d16969; }
.sh-js-op            { color: #d4d4d4; }
.sh-js-bracket       { color: #da70d6; }
.sh-js-punct         { color: #d4d4d4; }
.sh-js-ident         { color: #9cdcfe; }
.sh-js-comment       { color: #6a9955; font-style: italic; }
.sh-js-template-expr { color: #569cd6; }

/* ---------- Clickable Issue Rows ---------- */
.cv-issue[data-line] {
  cursor: pointer;
}

.cv-issue[data-line]:hover {
  border-color: var(--color-primary);
  background-color: rgba(67, 97, 238, 0.04);
}

.cv-issue[data-line]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* ---------- Actions ---------- */
.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.cv-actions--support {
  justify-content: flex-start;
}

/* ---------- Stats ---------- */
.cv-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
}

.cv-stat {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.9);
}

.cv-stat__label {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cv-stat__value {
  color: var(--color-text);
  font-size: clamp(1rem, 1.1vw, 1.15rem);
  letter-spacing: -0.02em;
}

.cv-stat__value--errors {
  color: #dc2626;
}

.cv-stat__value--warnings {
  color: #d97706;
}

.cv-results-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.98), rgba(226, 232, 240, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.cv-results-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 120px;
  padding: 9px 14px;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  background: rgba(255, 255, 255, 0.45);
  color: #475569;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
  transition: all var(--transition);
}

.cv-results-tab:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(67, 97, 238, 0.16),
    0 1px 3px rgba(15, 23, 42, 0.06);
}

.cv-results-tab--active {
  background: #fff;
  color: var(--color-primary);
  box-shadow:
    inset 0 0 0 1px rgba(67, 97, 238, 0.22),
    0 4px 14px rgba(15, 23, 42, 0.08);
}

.cv-results-tab__badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 2px;
}

.cv-results-tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.16);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: var(--weight-bold);
  line-height: 1;
}

.cv-results-tab__badge--error {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

.cv-results-tab__badge--warning {
  background: rgba(245, 158, 11, 0.18);
  color: #d97706;
}

.cv-results-tab__badge[hidden] {
  display: none;
}

.cv-results-tab__badges[hidden] {
  display: none;
}

.cv-results-context {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  background: rgba(67, 97, 238, 0.08);
  color: #3651d4;
  font-size: 0.8rem;
  font-weight: var(--weight-medium);
  line-height: 1.4;
}

.cv-results-context::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.12);
  flex-shrink: 0;
}

.cv-results-context[hidden] {
  display: none;
}

/* ---------- Issues List ---------- */
.cv-issues {
  display: grid;
  gap: var(--space-xs);
  max-height: 500px;
  overflow-y: auto;
}

.cv-issues__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xl) var(--space-md);
  color: var(--color-text-muted);
  text-align: center;
  font-size: var(--text-sm);
}

.cv-issues__empty svg {
  opacity: 0.4;
}

.cv-issues-group {
  display: grid;
  gap: var(--space-xs);
}

.cv-issues-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
}

.cv-issues-group__title {
  font-size: 0.76rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text);
}

.cv-issues-group__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cv-issues-group__count {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0.03em;
}

.cv-issues-group__count--error {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.cv-issues-group__count--warning {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
}

.cv-issues-group__note {
  padding: 0 4px 6px;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

/* --- Success message --- */
.cv-issues__success {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-md);
  background: rgba(34, 197, 94, 0.06);
  color: #16a34a;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.cv-issues__success svg {
  flex-shrink: 0;
}

/* ---------- SEO Content & FAQ ---------- */
.cv-seo-content {
  display: grid;
  gap: var(--space-lg);
  padding: clamp(24px, 3vw, 40px) clamp(18px, 2vw, 32px);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius-lg) + 2px);
  background:
    radial-gradient(circle at bottom left, rgba(67, 97, 238, 0.05), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  box-shadow: var(--shadow-sm);
}

.cv-seo-content__title {
  font-size: clamp(1.15rem, 1.3vw, 1.4rem);
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin: 0;
}

.cv-seo-content__body {
  display: grid;
  gap: var(--space-md);
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--color-text-muted);
}

.cv-seo-content__body h3 {
  font-size: clamp(0.95rem, 1vw, 1.1rem);
  color: var(--color-text);
  margin: 0;
}

.cv-seo-content__body ul,
.cv-seo-content__body ol {
  padding-left: 1.5em;
  display: grid;
  gap: 6px;
}

.cv-seo-content__body li {
  line-height: 1.65;
}

.cv-seo-content__body p {
  margin: 0;
}

.cv-faq {
  display: grid;
  gap: var(--space-sm);
}

.cv-faq__item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  transition: border-color 0.2s;
}

.cv-faq__item[open] {
  border-color: rgba(67, 97, 238, 0.3);
}

.cv-faq__q {
  padding: 14px 18px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.cv-faq__q::-webkit-details-marker {
  display: none;
}

.cv-faq__q::after {
  content: '+';
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

.cv-faq__item[open] .cv-faq__q::after {
  content: '−';
}

.cv-faq__a {
  padding: 0 18px 16px;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text-muted);
}

.cv-faq__a p {
  margin: 0;
}

/* --- Issue row --- */
.cv-issue {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: var(--space-sm);
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.9);
  transition: border-color var(--transition);
}

.cv-issue:hover {
  border-color: var(--color-border-strong);
}

.cv-issue--error {
  border-left: 3px solid #ef4444;
}

.cv-issue--warning {
  border-left: 3px solid #f59e0b;
}

.cv-issue__severity {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.cv-issue__severity--error {
  background: rgba(239, 68, 68, 0.10);
  color: #dc2626;
}

.cv-issue__severity--warning {
  background: rgba(245, 158, 11, 0.10);
  color: #d97706;
}

.cv-issue__line {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: var(--weight-bold);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.cv-issue__message {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.5;
  padding-top: 1px;
}

.cv-issue__message code {
  padding: 1px 5px;
  background-color: rgba(67, 97, 238, 0.06);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-primary);
}

/* ---------- Repair Button ---------- */
/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .cv-card__head--split {
    grid-template-columns: 1fr;
  }

  .cv-stats {
    grid-template-columns: 1fr;
  }

  .cv-textarea {
    min-height: 200px;
  }

  .cv-line-numbers {
    min-width: 36px;
  }

  .cv-line-numbers span {
    padding: 0 6px 0 0;
    font-size: 0.75rem;
  }

  .cv-results-tab {
    justify-content: space-between;
    flex-basis: calc(50% - var(--space-xs));
  }

  .cv-issue {
    grid-template-columns: auto 1fr;
  }

  .cv-issue__line {
    grid-row: 2;
    grid-column: 1 / -1;
    justify-self: start;
  }
}
