/* =========================================================
   Code Repository — styles.css
   Layout inspirado no WPCode Snippets Library
   Sem Bootstrap, sem CDN externo
   ========================================================= */

:root {
  --cr-php:         #8B5CF6;
  --cr-js:          #F59E0B;
  --cr-css:         #3B82F6;
  --cr-html:        #F97316;

  --cr-text:        #1a1a2e;
  --cr-text-muted:  #667085;
  --cr-text-light:  #98a2b3;
  --cr-border:      #e2e8f0;
  --cr-bg:          #f8fafc;
  --cr-white:       #ffffff;
  --cr-accent:      #FFD700;
  --cr-radius:      10px;
  --cr-radius-sm:   6px;
  --cr-shadow:      0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --cr-shadow-md:   0 4px 16px rgba(0,0,0,0.10);
  --cr-container:   1216px;

  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.cr-page {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--cr-text);
  background: var(--white);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Container ── */
.cr-container {
  max-width: var(--cr-container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Hero ── */
.cr-hero {
  background: linear-gradient(180deg, #FFF 0%, #FFFCEB 100%);
  color: var(--cr-text);
  padding: 80px 0 80px;
  text-align: center;
}

.cr-hero__title {
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}

.cr-hero__subtitle {
  font-size: 16px;
  color: var(--cr-text-muted);
  margin-bottom: 28px;
}

/* ── Search ── */
.cr-search-wrapper {
  position: relative;
  max-width: 600px;
  margin: 0 auto 20px;
}

.cr-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cr-text-muted);
  pointer-events: none;
}

.cr-search-input {
  width: 100%;
  padding: 14px 16px 14px 46px;
  border: 1px solid #EAECF0;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--cr-text);
  background: var(--cr-white);
  outline: none;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.10);
  transition: box-shadow 150ms;
}

.cr-search-input:focus {
  box-shadow: 0 1px 8px rgba(0,0,0,0.10), 0 0 0 2px var(--cr-accent);
}

/* ── Search popover ── */
.cr-search-popover {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--cr-white);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
  z-index: 200;
  padding: 6px;
}

.cr-search-popover.is-open { display: block; }

.cr-search-popover__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--cr-text);
  text-align: left;
  border-radius: 8px;
  transition: background 120ms;
}

.cr-search-popover__item:hover { background: var(--cr-bg); }

.cr-search-popover__title {
  font-size: 13.5px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.cr-search-popover__title mark {
  background: none;
  color: var(--cr-accent);
  font-weight: 700;
}

.cr-search-popover__meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.cr-search-popover__cat {
  font-size: 11px;
  color: var(--cr-text-muted);
  background: transparent;
  border: 1px solid var(--cr-border);
  border-radius: 20px;
  padding: 2px 8px;
  letter-spacing: 0.01em;
}

.cr-search-popover__pro {
  font-size: 11px;
  font-weight: 600;
  color: #92400E;
  background: #FEF3C7;
  border-radius: 20px;
  padding: 2px 8px;
}

.cr-search-popover__empty {
  padding: 20px 16px;
  font-size: 13px;
  color: var(--cr-text-muted);
  text-align: center;
}

/* ── Popular tags ── */
.cr-popular-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.cr-popular-tags__label {
  font-size: 12px;
  color: var(--cr-text-muted);
}

.cr-tag-chip {
  background: rgba(255, 255, 255, 0.6);
  color: var(--cr-text-muted);
  border: 1px solid var(--cr-border);
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}

.cr-tag-chip:hover {
  background: rgba(255, 255, 255, 0.8);
  color: var(--cr-text);
  border-color: var(--cr-accent);
}

/* ── Filters bar ── */
.cr-filters-bar__inner {
  display: flex;
  align-items: center;
  gap: 48px;
  padding: 32px 0 32px;
  border-bottom: 1px solid var(--cr-border);
  margin-bottom: 32px;
}

/* ── Type tabs ── */
.cr-tabs {
  display: flex;
  gap: 2px;
}

.cr-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--cr-text-muted);
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  transition: background 120ms, color 120ms;
  text-decoration: none;
  cursor: pointer;
  position: relative;
}

.cr-tab:hover {
  background: var(--cr-bg);
  color: var(--cr-text);
}

.cr-tab.active {
  color: var(--cr-accent);
  font-weight: 600;
}

.cr-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--cr-accent);
  border-radius: 2px 2px 0 0;
}

/* ── Paywall filter ── */
.cr-paywall-filter {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cr-paywall-filter input[type="radio"] {
  display: none;
}

.cr-paywall-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cr-text-muted);
  cursor: pointer;
  transition: background 120ms, color 120ms;
  border: 1px solid transparent;
}

.cr-paywall-label:hover {
  background: var(--cr-bg);
  color: var(--cr-text);
}

.cr-paywall-filter input:checked + .cr-paywall-label {
  background: var(--cr-bg);
  color: var(--cr-text);
  border-color: var(--cr-border);
  font-weight: 600;
}

/* ── Loader ── */
.cr-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
}

.cr-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--cr-border);
  border-top-color: var(--cr-accent);
  border-radius: 50%;
  animation: cr-spin 0.7s linear infinite;
}

@keyframes cr-spin { to { transform: rotate(360deg); } }

/* ── Main ── */
.cr-main {
  padding: 0 0 60px;
}

/* ── Tab panel ── */
.repository-tab { display: none; }
.repository-tab.active { display: block; }

.cr-result-count {
  font-size: 13px;
  color: var(--cr-text-muted);
  margin-bottom: 20px;
}

.cr-result-count .repository-count {
  font-weight: 700;
  color: var(--cr-text);
}

/* ── Grid ── */
.repository-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* ── Card ── */
.cr-card {
  background: var(--cr-white);
  border-radius: 16px;
  border: 1px solid #EAECF0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  transition: box-shadow 150ms, border-color 150ms;
  text-decoration: none;
  color: var(--cr-text);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.10);
}

.cr-card:hover {
  box-shadow: var(--cr-shadow-md);
  border-color: var(--cr-accent);
}

/* ── Author avatar ── */
.cr-author-avatar {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.cr-author-avatar__icon {
  width: 26px;
  height: 26px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.cr-author-avatar__name {
  font-size: 12px;
  font-weight: 500;
  color: var(--cr-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Badge (PRO) ── */
.cr-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 20px;
}

.cr-badge--pro {
  background: #fef3c7;
  color: #92400e;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cr-badge--pro svg {
  flex-shrink: 0;
  display: block;
}

.cr-badge--free {
  display: none;
}

/* ── Card title ── */
.cr-card__title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  padding-right: 52px; /* space for badge */
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Card description ── */
.cr-card__description {
  font-size: 13px;
  color: var(--cr-text-muted);
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 24px;
}

/* ── Card footer ── */
.cr-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--cr-border);
}

/* ── Type pill ── */
.cr-card__type-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 20px;
}

.cr-type-pill--php  { background: #f3f0ff; color: var(--cr-php); }
.cr-type-pill--js   { background: #fffbeb; color: #b45309; }
.cr-type-pill--css  { background: #eff6ff; color: var(--cr-css); }
.cr-type-pill--html { background: #fff7ed; color: var(--cr-html); }

/* ── Card actions ── */
.cr-card__actions {
  display: flex;
  gap: 6px;
}

/* ── Buttons ── */
.cr-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--cr-radius-sm);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--cr-border);
  background: var(--cr-white);
  color: var(--cr-text);
  transition: background 120ms, border-color 120ms, color 120ms;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.cr-btn:hover {
  background: var(--cr-bg);
  border-color: #c8d5e8;
}

.cr-btn--primary {
  background: var(--cr-accent);
  color: var(--cr-text);
  border-color: var(--cr-accent);
}

.cr-btn--primary:hover {
  background: #D19E00;
  border-color: #D19E00;
}

.cr-btn--view {
  background: transparent;
  border-color: transparent;
  color: var(--cr-text-muted);
  padding-left: 8px;
  padding-right: 8px;
}

.cr-btn--view:hover {
  color: var(--cr-accent);
  background: transparent;
  border-color: transparent;
}

/* ── Empty state ── */
.cr-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--cr-text-muted);
  font-size: 15px;
}

/* Garante que dialogs fechados fiquem ocultos mesmo com display customizado */
.cr-dialog:not([open]),
.cr-popover:not([open]) {
  display: none;
}

/* ── Dialog ── */
.cr-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: none;
  border-radius: var(--cr-radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  padding: 0;
  max-width: 440px;
  width: 90%;
}

.cr-dialog::backdrop {
  background: rgba(0,0,0,0.5);
}

.cr-dialog__inner {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  position: relative;
}

.cr-dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none !important;
  border: none !important;
  font-size: 16px !important;
  color: var(--cr-text-muted) !important;
  padding: 6px 8px !important;
  border-radius: var(--cr-radius-sm) !important;
  cursor: pointer !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

.cr-dialog__close:hover { background: var(--cr-bg); }
.cr-dialog__icon { font-size: 36px; color: #F59E0B; }
.cr-dialog__title { font-size: 22px; font-weight: 700; }
.cr-dialog__body { font-size: 14px; color: var(--cr-text-muted); max-width: 320px; }

/* ── Snippet popover ── */
.cr-popover {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: none;
  border-radius: var(--cr-radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  padding: 0;
  width: min(780px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cr-popover::backdrop {
  background: rgba(0,0,0,0.5);
}

.cr-popover__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--cr-border);
  flex-shrink: 0;
}

.cr-popover__header-left { min-width: 0; }

.cr-popover__lang {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cr-text-muted);
  margin-bottom: 4px;
}

.cr-popover__title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 4px;
}

.cr-popover__desc {
  font-size: 13px;
  color: var(--cr-text-muted);
  margin: 0;
}

.cr-popover__close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius-sm);
  background: var(--cr-white);
  color: var(--cr-text-muted);
  cursor: pointer;
  transition: background 100ms;
}

.cr-popover__close:hover { background: var(--cr-bg); }

.cr-popover__close svg {
  display: block;
  stroke: currentColor;
  fill: none;
}

.cr-popover__code {
  flex: 1;
  overflow: auto;
  min-height: 0;
  background: #f6f8fa;
}

.cr-popover__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.cr-popover__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f1f5f9;
  border-top: 1px solid var(--cr-border);
  gap: 12px;
  flex-shrink: 0;
}

.cr-popover__credit { font-size: 12px; color: var(--cr-text-muted); }

.cr-popover__actions { display: flex; gap: 8px; }

.cr-popover__code .cr-code-block__inner { border: none; border-radius: 0; }

.cr-popover__code .cr-code-block__inner pre[class*="language-"] {
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  font-size: 13px;
  line-height: 1.6 !important;
  padding: 0.75em 1em 0.75em 3.8em !important;
  overflow: auto !important;
}

.cr-popover__code .cr-code-block__inner pre[class*="language-"] > code {
  line-height: 1.6 !important;
  display: block;
  background: #f6f8fa !important;
}

.cr-popover__code .cr-pro-gate {
  margin-bottom: 0;
  border: none;
  border-radius: 0;
}

/* ─────────────────────────────────────────────────────────
   SINGLE PAGE
   ───────────────────────────────────────────────────────── */
/* ── Single header ── */
.cr-single__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.cr-single__header-left {
  flex: 1;
  min-width: 0;
}

.cr-single__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  align-items: stretch;
  padding-top: 6px;
  min-width: 140px;
}

.cr-btn--copy-main {
  background: var(--cr-accent);
  color: #1a1a2e;
  border-color: var(--cr-accent);
  font-weight: 600;
  padding: 8px 16px;
  font-size: 13px;
  justify-content: center;
}

.cr-btn--copy-main:hover {
  background: #e6c200;
  border-color: #e6c200;
}

.cr-btn--copy-main.copied {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.cr-btn--download,
.cr-btn--share {
  background: var(--cr-white);
  color: var(--cr-text);
  border-color: var(--cr-border);
  font-weight: 500;
  padding: 8px 16px;
  font-size: 13px;
  justify-content: center;
}

.cr-btn--download:hover,
.cr-btn--share:hover {
  background: var(--cr-bg);
  border-color: #b0bed4;
}

/* ── Single page layout ── */
.cr-single-page {
  padding: 40px 0 80px;
  min-height: 60vh;
  max-width: 100%;
  overflow-x: hidden;
}

.cr-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--cr-text-muted);
  margin-bottom: 24px;
  white-space: nowrap;
  overflow: hidden;
}

.cr-breadcrumb a { flex-shrink: 0; }
.cr-breadcrumb a:hover { text-decoration: underline; }
.cr-breadcrumb__sep { flex-shrink: 0; color: var(--cr-text-light); }
.cr-breadcrumb span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cr-single__title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.4px;
  margin-bottom: 12px;
}

.cr-single__description {
  font-size: 15px;
  color: var(--cr-text-muted);
  margin-bottom: 20px;
  max-width: 720px;
  line-height: 1.6;
}

/* ── Single meta row ── */
.cr-single__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.cr-single__author-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.cr-single__author-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--cr-text);
}

/* Badge inline (not absolute) */
.cr-badge--inline {
  position: static;
  font-size: 10px;
}

/* ── Code block (WPCode style) ── */
.cr-code-block {
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  overflow: hidden;
  margin-bottom: 40px;
  max-width: 100%;
  overflow-x: auto;
}

.cr-code-block pre[class*="language-"] { max-width: 100%; overflow-x: auto; }

.cr-code-block__tabs {
  display: flex;
  align-items: center;
  background: var(--cr-white);
  border-bottom: 1px solid var(--cr-border);
  padding: 0 8px;
}

.cr-code-block__tab {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cr-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: color 100ms, border-color 100ms;
  position: relative;
  top: 1px;
}

.cr-code-block__tab.active {
  color: var(--cr-text);
  font-weight: 600;
  border-bottom-color: var(--cr-text);
}

.cr-code-block__inner {
  position: relative;
}

.cr-code-block__lang {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  z-index: 1;
  pointer-events: none;
}

.cr-code-block__inner pre[class*="language-"] {
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  font-size: 13px;
  line-height: 1.6 !important;
  padding: 0.75em 1em 0.75em 3.8em !important;
  overflow: auto !important;
}

.cr-code-block__inner pre[class*="language-"] > code {
  line-height: 1.6 !important;
  display: block;
  background: #f6f8fa !important;
}

.cr-code-block__lang {
  color: #57606a;
}

.cr-code-block__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f1f5f9;
  border-top: 1px solid var(--cr-border);
  gap: 12px;
}

.cr-code-block__credit {
  font-size: 12px;
  color: var(--cr-text-muted);
}

.cr-code-block__credit strong {
  color: var(--cr-text);
}

.cr-btn--sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: var(--cr-radius-sm);
  border: 1px solid var(--cr-border);
  background: var(--cr-white);
  color: var(--cr-text);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 100ms;
}

.cr-btn--sm:hover { background: var(--cr-bg); }

/* ── Pro gate ── */
.cr-pro-gate {
  position: relative;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  overflow: hidden;
  margin-bottom: 40px;
  min-height: 320px;
}

.cr-pro-gate__preview {
  filter: blur(4px);
  user-select: none;
  pointer-events: none;
  max-height: 200px;
  overflow: hidden;
}

.cr-pro-gate__overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.cr-pro-gate__content {
  text-align: center;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.cr-pro-gate__icon { font-size: 28px; color: #F59E0B; }

/* ── Related snippets ── */
.cr-related {
  margin-top: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--cr-border);
}

.cr-related__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.cr-related__title { font-size: 22px; font-weight: 700; }

/* ── Carousel ── */
.cr-carousel { overflow: hidden; }

.cr-carousel__track {
  display: flex;
  gap: 20px;
  transition: transform 400ms ease;
}

.cr-carousel__slide {
  flex: 0 0 calc((100% - 40px) / 3);
  min-width: 0;
}

.cr-carousel__controls { display: flex; gap: 6px; }

.cr-carousel__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--cr-radius-sm);
  border: 1px solid var(--cr-border);
  background: var(--cr-white);
  color: var(--cr-text);
  cursor: pointer;
  transition: background 100ms, border-color 100ms;
}

.cr-carousel__btn:hover:not(:disabled) {
  background: var(--cr-bg);
  border-color: #b0bed4;
}

.cr-carousel__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.cr-carousel__btn svg {
  display: block;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
}

/* ── Category tabs wrapper ── */
.cr-cat-tabs-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cr-cat-arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius-sm);
  background: var(--cr-white);
  color: var(--cr-text-muted);
  cursor: pointer;
  transition: background 120ms, color 120ms, opacity 120ms;
}

.cr-cat-arrow:hover {
  background: var(--cr-bg);
  color: var(--cr-text);
}

.cr-cat-arrow[disabled] {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ── Category tabs ── */
.cr-cat-tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cr-cat-tabs::-webkit-scrollbar { display: none; }

.cr-cat-tab {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--cr-text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 100ms, color 100ms;
}

.cr-cat-tab:hover {
  background: var(--cr-bg);
  color: var(--cr-text);
}

.cr-cat-tab.active {
  background: var(--cr-white);
  color: var(--cr-text);
  font-weight: 600;
  border-color: var(--cr-border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}


/* ── Pagination ── */
.cr-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.cr-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--cr-radius-sm);
  border: 1px solid var(--cr-border);
  background: var(--cr-white);
  color: var(--cr-text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 100ms, border-color 100ms, color 100ms;
  line-height: 1;
}

.cr-page-btn:hover:not(:disabled):not(.cr-page-btn--disabled) {
  background: var(--cr-bg);
  border-color: #b0bed4;
}

.cr-page-btn.active {
  background: var(--cr-accent);
  border-color: var(--cr-accent);
  color: var(--cr-text);
  font-weight: 600;
  cursor: default;
}

.cr-page-btn--disabled,
.cr-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.cr-page-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 36px;
  color: var(--cr-text-muted);
  font-size: 13px;
  user-select: none;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .cr-carousel__slide { flex: 0 0 calc((100% - 20px) / 2); }
}

@media (max-width: 768px) {
  .cr-hero { padding: 40px 0 36px; }
  .cr-hero__title { font-size: 26px; }
  .cr-hero__subtitle { font-size: 14px; }

  .cr-filters-bar__inner {
    gap: 16px;
    padding-top: 16px;
    padding-bottom: 14px;
  }

  .repository-grid { grid-template-columns: 1fr; }

  .cr-single__title { font-size: 22px; }
  .cr-single-page { padding: 24px 0 60px; }

  .cr-carousel__slide { flex: 0 0 100%; }

  .cr-single__header { flex-direction: column; gap: 16px; }
  .cr-single__actions {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
    width: 100%;
  }
  .cr-single__actions .cr-btn {
    flex: 1;
    justify-content: center;
  }

  .cr-popover__footer {
    flex-direction: column;
    align-items: stretch;
  }
  .cr-popover__actions {
    width: 100%;
  }
  .cr-popover__actions .cr-btn {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .repository-grid { gap: 12px; }
  .cr-card { padding: 18px; }
  .cr-related__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .cr-container { padding: 0 16px; }
  .cr-main { padding: 20px 0 40px; }
  .cr-hero__title { font-size: 22px; }
  .cr-search-input { font-size: 14px; padding: 12px 14px 12px 42px; }
  .cr-single__title { font-size: 20px; }
  .cr-code-block__footer { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* =========================================================
   WP Fixer — Additions
   ========================================================= */

/* ── Severity badges ── */
.cr-badge--critical   { background: #fee2e2 !important; color: #dc2626 !important; width: fit-content; }
.cr-badge--warning    { background: #fef9c3 !important; color: #ca8a04 !important; width: fit-content; }
.cr-badge--info       { background: #dbeafe !important; color: #2563eb !important; width: fit-content; }
.cr-badge--deprecated { background: #f3f4f6 !important; color: #6b7280 !important; text-decoration: line-through; width: fit-content; }

/* ── Meta blocks (causa/solução) ── */
.cr-meta-blocks        { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 2rem 0; }
.cr-meta-block         { background: var(--cr-bg); border: 1px solid var(--cr-border); border-radius: 8px; padding: 1.25rem; }
.cr-meta-block__title  { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--cr-text-muted); margin: 0 0 .5rem; }
.cr-meta-block__text   { font-size: .875rem; color: var(--cr-text); margin: 0; line-height: 1.6; }

/* ── Since badge ── */
.cr-single__since { font-size: .75rem; color: var(--cr-text-muted); margin-left: .5rem; }

@media (max-width: 640px) {
  .cr-meta-blocks { grid-template-columns: 1fr; }
}

/* ── Meta card (ficha de metadados) ── */
.cr-meta-card { border: 1px solid var(--cr-border); border-radius: 10px; overflow: hidden; margin: 1.5rem 0 2rem; width: 100%; table-layout: fixed; word-break: break-word; }
.cr-meta-card__row { display: flex; gap: 1rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--cr-border); font-size: .875rem; }
.cr-meta-card__row:last-child { border-bottom: none; }
.cr-meta-card__label { font-weight: 600; min-width: 130px; color: var(--cr-text-muted); }
.cr-meta-card__value { color: var(--cr-text); }

/* ── Content sections (causa / solução) ── */
.cr-content-section { margin: 2rem 0; }
.cr-section-title { font-size: 1.125rem; font-weight: 700; margin: 0 0 .75rem; color: var(--cr-text); }
.cr-section-text { font-size: .9375rem; color: var(--cr-text); line-height: 1.75; white-space: pre-line; margin: 0; }

/* ── Thumbnail ── */
.cr-single__thumbnail { margin: 1.5rem 0; border-radius: 12px; overflow: hidden; }
.cr-single__thumbnail-img { width: 100%; height: auto; display: block; }

/* ── Two-column layout (sidebar + content) ── */
.cr-single-layout { display: grid; grid-template-columns: 220px 1fr; gap: 2.5rem; align-items: start; width: 100%; min-width: 0; }
.cr-single-content { min-width: 0; overflow: hidden; }

/* ── Sidebar TOC ── */
.cr-single-sidebar { position: sticky; top: 2rem; }
.cr-toc { border: 1px solid var(--cr-border); border-radius: 10px; padding: 1.25rem; }
.cr-toc__title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--cr-text-muted); margin: 0 0 .75rem; }
.cr-toc__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.cr-toc__link { display: block; font-size: .875rem; color: var(--cr-text); text-decoration: none; padding: .35rem .5rem; border-radius: 6px; transition: background .15s, color .15s; }
.cr-toc__link:hover,
.cr-toc__link.active {
  background: var(--cr-accent-light, #FFD700);
  color: #1a1a1a;
  font-weight: 600;
}

@media (max-width: 768px) {
  .cr-single-layout { grid-template-columns: 1fr; }
  .cr-single-sidebar { position: static; }
}

/* Código inline na solução */
.cr-inline-code {
  display: block;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: .85rem;
  background: var(--cr-surface, #f8f8f8);
  color: var(--cr-text);
  padding: .5rem 1rem;
  border-radius: 6px;
  margin: .5rem 0;
  white-space: pre;
  overflow-x: auto;
  border: 1px solid var(--cr-border);
  border-left: 3px solid var(--cr-accent, #ca8a04);
}

.cr-solution-line {
  display: block;
  font-size: .9375rem;
  color: var(--cr-text);
  line-height: 1.75;
  min-height: 1rem;
}

.cr-solution-line:empty {
  display: block;
  height: .75rem;
}

/* ── Section body (causa / solução com wpautop) ── */
.cr-section-body {
  font-size: .9375rem;
  color: var(--cr-text);
  line-height: 1.8;
}

.cr-section-body p {
  margin: 0 0 1rem;
}

.cr-section-body h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.5rem 0 .5rem;
  color: var(--cr-text);
}

.cr-section-body > p code,
.cr-section-body > h2 code,
.cr-section-body > h3 code {
  display: inline;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: .85rem;
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  padding: 2px 6px;
  border-radius: 4px;
}

.cr-section-body pre.wp-block-code {
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  border-left: 3px solid var(--cr-accent, #ca8a04);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin: .75rem 0 1.25rem;
}

.cr-section-body pre.wp-block-code code {
  display: block;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: .84rem;
  color: var(--cr-text);
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
  width: 100%;
}

.cr-section-body ol,
.cr-section-body ul {
  padding-left: 1.5rem;
  margin: 0 0 1rem;
}

.cr-section-body li {
  margin-bottom: .5rem;
  line-height: 1.7;
}

/* ── Blocos de código inline em causa/solução ── */
.cr-code-inline {
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  border-left: 3px solid var(--cr-accent, #ca8a04);
  border-radius: 6px;
  padding: .65rem 1rem;
  margin: .5rem 0 1rem;
  overflow-x: auto;
}

.cr-code-inline code {
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: .84rem;
  color: var(--cr-text);
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
  display: block;
}

/* Fix sticky — isolar do Elementor */
.cr-single-page,
.cr-single-page .cr-container,
.cr-single-layout,
.cr-single-content {
  overflow: visible !important;
  transform: none !important;
}

.cr-single-sidebar {
  position: sticky !important;
  top: 120px !important;
  align-self: start !important;
  height: fit-content !important;
}

/* Conteúdo Gutenberg */
.cr-section-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2rem 0 .75rem;
  color: var(--cr-text);
}
.cr-section-body h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.5rem 0 .5rem;
  color: var(--cr-text);
}
.cr-section-body img {
  max-width: 100%;
  border-radius: 8px;
  margin: 1rem 0;
}
.cr-section-body figure {
  margin: 1.5rem 0;
}
.cr-section-body figcaption {
  font-size: .8rem;
  color: var(--cr-muted);
  text-align: center;
  margin-top: .35rem;
}
.cr-section-body .wp-block-code {
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  border-left: 3px solid var(--cr-accent, #ca8a04);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: .84rem;
}

/* Badge inline na ficha de metadados */
.cr-meta-card__value.cr-badge {
  position: static !important;
  display: inline-block !important;
  top: auto !important;
  right: auto !important;
  font-size: .75rem !important;
  padding: 3px 8px !important;
}

@media (max-width: 768px) {
  .cr-single-layout { grid-template-columns: 1fr; }
  .cr-single-sidebar { 
    display: none !important;
    position: static !important;
    top: auto !important;
    height: auto !important;
  }
}

@media (max-width: 768px) {
  .cr-filters-bar__inner {
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
  }

  .cr-cat-tabs-wrapper {
    width: 100%;
    overflow: hidden;
  }

  .cr-cat-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .cr-cat-tabs::-webkit-scrollbar {
    display: none;
  }

  .cr-paywall-filter {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    width: 100%;
  }

  .cr-paywall-filter::-webkit-scrollbar {
    display: none;
  }

  body.cr-page {
    overflow-x: hidden;
  }
}
