/* ==========================================================
   GOFKK COMMUNITY — domande e risposte (/community/)
   Solo classi cq-*; usa i token di styles.css.
   ========================================================== */

.cq-body { background: var(--bg); }
.cq-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.cq-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cq-inline { display: inline; }
.cq-muted { color: var(--text-muted); }

/* ---------- Hero + barra utente ---------- */
.cq-hero {
  padding-top: calc(72px + var(--sp-10));
  padding-bottom: var(--sp-8);
  background: linear-gradient(145deg, var(--teal-deep) 0%, var(--teal-mid) 60%, #2a6f7f 100%);
  color: #fff;
}
.cq-hero--slim { padding-top: calc(72px + var(--sp-3)); padding-bottom: var(--sp-3); }
.cq-hero .container { display: flex; flex-direction: column; gap: var(--sp-3); }
.cq-hero-kicker { font-size: .6875rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.cq-hero h1 { color: #fff; font-size: clamp(1.75rem, 4vw, 2.75rem); max-width: 820px; }
.cq-hero p { color: rgba(255,255,255,.78); font-size: 1.0625rem; max-width: 640px; }
.cq-userbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-5); margin-top: var(--sp-2); font-size: .875rem; }
.cq-hero--slim .cq-userbar { justify-content: flex-end; margin-top: 0; }
.cq-userbar a, .cq-userbar .cq-linkbtn { color: rgba(255,255,255,.85); }
.cq-userbar a:hover, .cq-userbar .cq-linkbtn:hover { color: #fff; text-decoration: underline; }
.cq-userbar-me { font-weight: 700; color: #fff !important; }
.cq-userbar-cta { background: var(--accent); color: #fff !important; padding: .35rem .9rem; border-radius: var(--r-sm); font-weight: 700; }
.cq-userbar-cta:hover { background: var(--accent-dark); text-decoration: none !important; }
.cq-count { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; }
.cq-rep { display: inline-block; padding: 0 .45em; border-radius: 999px; background: rgba(240,146,94,.16); color: var(--accent-dark); font-size: .75rem; font-weight: 700; }
.cq-hero .cq-rep { background: rgba(255,255,255,.18); color: #fff; }

.cq-linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--teal-deep); cursor: pointer; }
.cq-linkbtn:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.cq-main { padding: var(--sp-8) 0 var(--sp-16); }
.cq-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-8); align-items: start; }
.cq-sidebar { display: flex; flex-direction: column; gap: var(--sp-5); }
.cq-narrow { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--sp-6); }
@media (max-width: 900px) {
  .cq-layout { grid-template-columns: 1fr; }
}

.cq-flash { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); margin-bottom: var(--sp-5); font-size: .9375rem; border: 1px solid; }
.cq-flash--success { background: #eef8f1; border-color: #bfe3ca; color: #1f5e36; }
.cq-flash--error { background: #fdf0ec; border-color: #f3c7b5; color: #8a3517; }

.cq-breadcrumb { font-size: .8125rem; color: var(--text-muted); margin-bottom: var(--sp-4); }
.cq-breadcrumb a { color: var(--teal-mid); }
.cq-breadcrumb a:hover { text-decoration: underline; }

/* ---------- Toolbar e tab ---------- */
.cq-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.cq-tabs { display: flex; gap: var(--sp-1); background: var(--white); border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px; overflow-x: auto; }
.cq-tabs a { padding: .45rem .9rem; border-radius: var(--r-sm); font-size: .875rem; font-weight: 600; color: var(--text-mid); white-space: nowrap; }
.cq-tabs a:hover { color: var(--teal-deep); background: var(--bg-card); }
.cq-tabs a.is-active { background: var(--teal-deep); color: #fff; }

/* ---------- Card domanda ---------- */
.cq-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.cq-card { display: flex; gap: var(--sp-5); background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-5); transition: box-shadow var(--t), border-color var(--t); }
.cq-card:hover { box-shadow: var(--sh-md); border-color: var(--border-mid); }
.cq-card-stats { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 78px; font-size: .8125rem; color: var(--text-muted); text-align: right; }
.cq-stat strong { display: block; font-size: 1.125rem; color: var(--text); line-height: 1.1; }
.cq-stat--answered { color: var(--teal-mid); }
.cq-stat--answered strong { color: var(--teal-mid); }
.cq-stat--solved { background: #eef8f1; border-radius: var(--r-sm); padding: 2px 6px; color: #1f5e36; }
.cq-stat--solved strong { color: #1f5e36; }
.cq-card-body { flex: 1; min-width: 0; }
.cq-card-title { font-family: var(--font-sans); font-size: 1.0625rem; font-weight: 700; line-height: 1.35; margin-bottom: var(--sp-2); }
.cq-card-title a:hover { color: var(--teal-mid); text-decoration: underline; }
.cq-card-excerpt { font-size: .9rem; color: var(--text-mid); line-height: 1.55; margin-bottom: var(--sp-3); overflow-wrap: anywhere; }
.cq-card-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--sp-2) var(--sp-4); }
.cq-byline { font-size: .8125rem; color: var(--text-muted); }
.cq-author { font-weight: 600; color: var(--teal-mid); }
a.cq-author:hover { text-decoration: underline; }
.cq-author--deleted { font-style: italic; font-weight: 400; color: var(--text-muted); }
@media (max-width: 560px) {
  .cq-card { flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); }
  .cq-card-stats { flex-direction: row; min-width: 0; text-align: left; gap: var(--sp-4); }
  .cq-stat strong { display: inline; font-size: .9375rem; }
}

/* ---------- Tag ---------- */
.cq-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cq-tags--stack { gap: 6px; }
.cq-tag { display: inline-block; padding: .2rem .6rem; border-radius: 999px; background: var(--bg-card); border: 1px solid var(--border); font-size: .75rem; font-weight: 600; color: var(--text-mid); }
.cq-tag:hover { border-color: var(--teal-mid); color: var(--teal-deep); }
.cq-tag--dest { background: rgba(15,76,92,.07); color: var(--teal-deep); }
.cq-tag.is-active { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }

/* ---------- Box laterali ---------- */
.cq-box { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-5); }
.cq-box h3 { margin-bottom: var(--sp-2); }
.cq-box p { font-size: .9rem; color: var(--text-mid); margin-bottom: var(--sp-4); }
.cq-box--accent { background: linear-gradient(160deg, #fff 0%, #fff4ec 100%); border-color: #f6d3bd; }
.cq-box--center { text-align: center; }
.cq-box--center .btn { margin: var(--sp-1); }
.cq-box-kicker { font-size: .6875rem !important; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-dark) !important; margin-bottom: var(--sp-1) !important; }
.cq-box-foot { margin: var(--sp-4) 0 0 !important; font-size: .8125rem !important; }
.cq-box-foot a, .cq-howto a { color: var(--teal-mid); font-weight: 600; }
.cq-box-foot a:hover { text-decoration: underline; }
.cq-howto { display: flex; flex-direction: column; gap: var(--sp-2); font-size: .875rem; color: var(--text-mid); }
.cq-howto li { padding-left: 1.1em; position: relative; }
.cq-howto li::before { content: "•"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.cq-btn-block { width: 100%; justify-content: center; }
.cq-btn-sm { padding: .5rem .9rem; font-size: .75rem; }
.cq-btn-danger { background: #b83a1f; color: #fff; }
.cq-btn-danger:hover { background: #8f2c16; }

.cq-empty { background: var(--white); border: 1px dashed var(--border-mid); border-radius: var(--r-lg); padding: var(--sp-10) var(--sp-6); text-align: center; }
.cq-empty h3 { margin-bottom: var(--sp-2); }
.cq-empty p { color: var(--text-mid); margin-bottom: var(--sp-5); }

.cq-pagination { display: flex; justify-content: center; align-items: center; gap: var(--sp-5); margin-top: var(--sp-6); font-size: .875rem; color: var(--text-muted); }
.cq-pagination a { color: var(--teal-deep); font-weight: 700; }

/* ---------- Domanda e risposte ---------- */
.cq-post { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-6); }
.cq-question-title { font-size: clamp(1.5rem, 3.2vw, 2.125rem); margin-bottom: var(--sp-5); color: var(--text); overflow-wrap: anywhere; }
.cq-post-row { display: flex; gap: var(--sp-5); }
.cq-post-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.cq-post-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); }
.cq-post-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-4); font-size: .8125rem; }

.cq-text { color: var(--text); line-height: 1.7; overflow-wrap: anywhere; }
.cq-text p + p { margin-top: var(--sp-3); }
.cq-text a { color: var(--teal-mid); text-decoration: underline; }

.cq-vote { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 44px; }
.cq-vote-btn { width: 40px; height: 36px; display: grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--white); color: var(--text-muted); cursor: pointer; transition: var(--t); }
.cq-vote-btn:hover:not(:disabled) { border-color: var(--teal-mid); color: var(--teal-deep); }
.cq-vote-btn.is-active { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }
.cq-vote-btn:disabled { opacity: .4; cursor: not-allowed; }
.cq-vote-score { font-weight: 700; font-size: 1.0625rem; }

.cq-answers { margin-top: var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-4); }
.cq-answers > h2, .cq-reply h2, .cq-section-title { font-size: 1.375rem; }
.cq-answer { scroll-margin-top: 90px; }
.cq-answer:target { box-shadow: 0 0 0 3px rgba(240,146,94,.45); }
.cq-answer--best { border-color: #9fd3b0; box-shadow: 0 0 0 1px #9fd3b0; }
.cq-best-badge { display: inline-block; margin-bottom: var(--sp-3); padding: .2rem .7rem; border-radius: 999px; background: #eef8f1; color: #1f5e36; font-size: .8125rem; font-weight: 700; }
.cq-status { margin-bottom: var(--sp-4); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); font-size: .8125rem; font-weight: 600; }
.cq-status--pending { background: #fff6e0; color: #7a5300; }
.cq-status--hidden { background: #fdf0ec; color: #8a3517; }
.cq-pill { display: inline-block; margin-left: var(--sp-2); padding: 0 .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.cq-pill--pending { background: #fff6e0; color: #7a5300; }
.cq-pill--hidden { background: #fdf0ec; color: #8a3517; }

.cq-report summary { cursor: pointer; font-size: .8125rem; color: var(--text-muted); list-style: none; }
.cq-report summary::-webkit-details-marker { display: none; }
.cq-report summary:hover { color: #b83a1f; }
.cq-report[open] form { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); padding: var(--sp-3); background: var(--bg-card); border-radius: var(--r-md); min-width: 240px; }
.cq-report label { font-size: .8125rem; font-weight: 600; }

.cq-reply { margin-top: var(--sp-8); }
.cq-reply h2 { margin-bottom: var(--sp-4); }

@media (max-width: 560px) {
  .cq-post { padding: var(--sp-4); }
  .cq-post-row { gap: var(--sp-3); }
  .cq-vote { min-width: 36px; }
  .cq-vote-btn { width: 34px; height: 32px; }
}

/* ---------- Form ---------- */
.cq-card-form { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.cq-card-form > .btn { align-self: flex-start; }
.cq-card-form > .cq-btn-block { align-self: stretch; }
.cq-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.cq-form > .btn { align-self: flex-start; }
.cq-form > .cq-btn-block { align-self: stretch; }
.cq-field { display: flex; flex-direction: column; gap: 6px; border: 0; }
.cq-field label, .cq-field legend { font-weight: 700; font-size: .9375rem; }
.cq-field input[type=text], .cq-field input[type=email], .cq-field input[type=password], .cq-field textarea, .cq-report select, .cq-search input {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text);
  padding: .7rem .85rem; border: 1.5px solid var(--border-mid); border-radius: var(--r-md); background: #fff;
  transition: border-color var(--t), box-shadow var(--t);
}
.cq-field textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.cq-field input:focus, .cq-field textarea:focus, .cq-report select:focus, .cq-search input:focus { outline: none; border-color: var(--teal-mid); box-shadow: 0 0 0 3px rgba(29,85,104,.15); }
.cq-field.has-error input, .cq-field.has-error textarea { border-color: #c2502b; }
.cq-optional { font-weight: 400; color: var(--text-muted); font-size: .8125rem; }
.cq-hint { font-size: .8125rem; color: var(--text-muted); }
.cq-hint a, .cq-check a, .cq-form-foot a, .cq-message a, .cq-plain-list a, .cq-admin-meta a, .cq-prose a, .cq-muted a { color: var(--teal-mid); text-decoration: underline; }
.cq-error { font-size: .8125rem; color: #b83a1f; font-weight: 600; }
.cq-error--box { padding: var(--sp-3); background: #fdf0ec; border-radius: var(--r-md); }
.cq-check { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: .9rem; line-height: 1.5; cursor: pointer; }
.cq-check input { margin-top: .25em; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--teal-deep); }
.cq-form-foot { font-size: .875rem; color: var(--text-muted); text-align: center; }
.cq-message p:first-child { font-size: 1.0625rem; }

.cq-check-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sp-2); }
.cq-check-tag { position: relative; cursor: pointer; }
.cq-check-tag input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cq-check-tag span { display: inline-block; padding: .35rem .8rem; border-radius: 999px; border: 1.5px solid var(--border-mid); font-size: .8125rem; font-weight: 600; color: var(--text-mid); transition: var(--t); user-select: none; }
.cq-check-tag input:checked + span { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }
.cq-check-tag input:focus-visible + span { box-shadow: 0 0 0 3px rgba(29,85,104,.3); }
.cq-check-tag input:disabled + span { opacity: .45; cursor: not-allowed; }

.cq-similar { margin-top: var(--sp-2); padding: var(--sp-3) var(--sp-4); background: #fff9f4; border: 1px solid #f6d3bd; border-radius: var(--r-md); font-size: .875rem; }
.cq-similar p { font-weight: 700; margin-bottom: var(--sp-1); }
.cq-similar a { color: var(--teal-mid); text-decoration: underline; }
.cq-similar li + li { margin-top: 4px; }

.cq-danger { border-color: #f3c7b5; }

/* ---------- Profilo ---------- */
.cq-profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.cq-profile-stats div { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); text-align: center; }
.cq-profile-stats strong { display: block; font-size: 1.5rem; }
.cq-profile-stats span { font-size: .8125rem; color: var(--text-muted); }
.cq-section-title { margin: var(--sp-6) 0 var(--sp-3); }
.cq-card-form .cq-section-title { margin: 0; }
.cq-plain-list { display: flex; flex-direction: column; gap: var(--sp-2); background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); }
.cq-plain-list li { font-size: .9375rem; overflow-wrap: anywhere; }

/* ---------- Admin ---------- */
.cq-admin-item { margin-bottom: var(--sp-3); }
.cq-admin-meta, .cq-admin-reasons { font-size: .8125rem; color: var(--text-muted); }
.cq-admin-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.cq-search { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); max-width: 480px; }
.cq-table-wrap { overflow-x: auto; }
.cq-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: .875rem; }
.cq-table th, .cq-table td { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); text-align: left; }
.cq-table a { color: var(--teal-mid); }

/* ---------- Testi lunghi (regolamento) ---------- */
.cq-prose { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-8); gap: var(--sp-3); max-width: 760px; }
.cq-prose h2 { font-size: 1.25rem; margin-top: var(--sp-4); }
.cq-prose ul { list-style: disc; padding-left: 1.25em; display: flex; flex-direction: column; gap: var(--sp-1); }
@media (max-width: 560px) { .cq-prose { padding: var(--sp-5); } }
