/* ═══════════════════════════════════════════════════════
   diagnostica.css — Widget Diagnostica Errori (frontend)
   Coerenza con tema Bravi Parts: bianco, rosso brand,
   grigio scuro, square corners, sans-serif industriale.
   ═══════════════════════════════════════════════════════
   @author    PublyGoo <ufficio@publygoo.it>
   @copyright 2026 PublyGoo
   @license   https://www.publygoo.it/
   ═══════════════════════════════════════════════════════ */

:root {
  --diag-red:       #c0392b;
  --diag-red-d:     #962d23;
  --diag-red-lt:    #fdf2f0;
  --diag-ink:       #111111;
  --diag-ink-2:     #2a2a2a;
  --diag-mute:      #555555;
  --diag-line:      #e6e6e6;
  --diag-line-2:    #d6d6d6;
  --diag-bg:        #ffffff;
  --diag-bg-2:      #f5f5f5;
  --diag-warn:      #c98a17;
  --diag-ok:        #1f8a4a;
  --diag-shadow:    0 1px 3px rgba(0,0,0,.04);
}

/* ───────── Card wrapper ───────── */
.diag-widget-card {
  background: var(--diag-bg);
  border: 1px solid var(--diag-line);
  box-shadow: var(--diag-shadow);
  font-family: inherit;
  color: var(--diag-ink);
  position: relative;
}

/* Red accent stripe top */
.diag-widget-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--diag-red);
}

/* ───────── Header ───────── */
.diag-widget-header {
  padding: 20px;
  border-bottom: 1px solid var(--diag-line);
}

.diag-widget-header__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--diag-mute);
  margin-bottom: 12px;
}

.diag-widget-header__bar {
  display: inline-block;
  width: 28px;
  height: 2px;
  background: var(--diag-red);
}

.diag-widget-header__title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--diag-ink);
  margin: 0 0 8px;
  line-height: 1.1;
}

.diag-widget-header__sub {
  font-size: 15px;
  color: var(--diag-mute);
  margin: 0;
  line-height: 1.5;
}

/* ───────── Body ───────── */
.diag-widget-body { padding: 20px; }

/* ───────── Labels ───────── */
.diag-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--diag-ink-2);
  margin-bottom: 8px;
}

.diag-label .fa-solid { color: var(--diag-red); }

/* ───────── Tooltip help ───────── */
.diag-tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0px;
  vertical-align: middle;
  top: -5px;
}

.diag-tooltip-btn {
  background: var(--diag-red);
  border: 0;
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  transition: background .15s ease;
  font-family: ui-monospace, monospace;
}

.diag-tooltip-btn:hover,
.diag-tooltip-btn:focus { background: var(--diag-red); outline: 0; }

.diag-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 280px;
  background: var(--diag-ink);
  color: #fff;
  padding: 12px 14px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.diag-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--diag-ink);
}

.diag-tooltip-wrap:hover .diag-tooltip,
.diag-tooltip-wrap.is-open .diag-tooltip {
  opacity: 1;
  pointer-events: auto;
}

.diag-tooltip__title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #fff;
  margin-bottom: 6px;
  line-height: normal;
}

.diag-tooltip__text {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255,255,255,.88);
}

.diag-tooltip__link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fff !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
}

.diag-tooltip__link:hover { color: var(--diag-red); }

/* ───────── Selects ───────── */
.diag-select-wrap {
  position: relative;
}

.diag-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--diag-bg);
  border: 1px solid var(--diag-line-2);
  border-radius: 0;
  padding: 12px 38px 12px 14px;
  font-size: 15px;
  color: var(--diag-ink);
  font-family: inherit;
  font-weight: 500;
  transition: border-color .18s ease, box-shadow .18s ease;
  cursor: pointer;
  line-height: 1.4;
}

.diag-select:hover:not(:disabled) {
  border-color: var(--diag-ink-2);
}

.diag-select:focus {
  outline: none;
  border-color: var(--diag-red);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, .12);
}

.diag-select:disabled {
  background: var(--diag-bg-2);
  color: var(--diag-mute);
  cursor: not-allowed;
}

/* ───────── Custom dropdown (modello / flash) ───────── */
.diag-custom-wrap {
  position: relative;
}

.diag-custom-trigger {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--diag-bg);
  border: 1px solid var(--diag-line-2);
  padding: 12px 44px 12px 14px;
  cursor: pointer;
  user-select: none;
  transition: border-color .18s ease, box-shadow .18s ease;
  min-height: 47px;
}

.diag-custom-trigger:focus,
.diag-custom-trigger.is-open {
  outline: none;
  border-color: var(--diag-red);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, .12);
}

.diag-custom-trigger--disabled {
  background: var(--diag-bg-2);
  cursor: not-allowed;
  pointer-events: none;
}

.diag-custom-val {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--diag-ink);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diag-custom-trigger--disabled .diag-custom-val {
  color: var(--diag-mute);
}

.diag-custom-trigger .diag-search-chevron i {
  transition: transform .18s ease;
}

.diag-custom-trigger.is-open .diag-search-chevron i {
  transform: rotate(180deg);
}

.diag-select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--diag-mute);
  font-size: 12px;
}

/* ───────── Search input (no-flash mode) ───────── */
.diag-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.diag-search {
  width: 100%;
  background: var(--diag-bg);
  border: 1px solid var(--diag-line-2);
  border-radius: 0;
  padding: 12px 44px 12px 40px;
  font-size: 15px;
  color: var(--diag-ink);
  font-family: inherit;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.diag-search:focus {
  outline: none;
  border-color: var(--diag-red);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, .12);
}

.diag-search-icon {
  position: absolute;
  left: 14px;
  color: var(--diag-mute);
  font-size: 14px;
  pointer-events: none;
}

.diag-search-clear,
.diag-search-chevron {
  position: absolute;
  right: 14px;
  background: transparent;
  border: 0;
  color: var(--diag-mute);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
}

/* Clear e chevron condividono stessa posizione: si alternano */
.diag-search-clear:hover { color: var(--diag-red); }

/* ───────── Suggestions dropdown ───────── */
.diag-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--diag-bg);
  border: 1px solid var(--diag-line-2);
  border-top: 2px solid var(--diag-red);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}

.diag-suggestions li {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--diag-ink);
  cursor: pointer;
  transition: background .12s ease;
  border-bottom: 1px solid var(--diag-bg-2);
}

.diag-suggestions li:last-child { border-bottom: 0; }

.diag-suggestions li:hover,
.diag-suggestions li.is-active {
  background: var(--diag-red-lt);
  color: var(--diag-red-d);
}

.diag-suggestions mark {
  background: transparent;
  color: var(--diag-red);
  font-weight: 700;
  padding: 0;
}

/* ───────── Result card ───────── */
.diag-result-wrap {
  margin-top: 24px;
  animation: diagFadeIn .35s ease;
}

@keyframes diagFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.diag-card {
  background: var(--diag-bg);
  border: 1px solid var(--diag-line);
  position: relative;
}

/* Hero header inside result */
.diag-card__hero {
  padding: 22px 24px 20px;
  border-bottom: 1px solid var(--diag-line);
  background:
    linear-gradient(180deg, #fff 0%, #fafafa 100%);
  position: relative;
}

.diag-card__hero::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--diag-red);
}

.diag-card__code-lbl {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--diag-mute);
  margin-bottom: 4px;
}

.diag-card__code {
  display: inline-block;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--diag-red);
  font-size: 18px;
  line-height: 1;
  letter-spacing: -.01em;
  margin-bottom: 10px;
}

.diag-card__title {
  display: block;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--diag-red);
  font-size: 18px;
  line-height: 1;
  letter-spacing: -.01em;
  margin: 0;
}

/* Description row */
.diag-card__row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--diag-line);
  font-size: 14.5px;
  line-height: 1.55;
}

.diag-card__key {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--diag-mute);
}

.diag-card__val {
  color: var(--diag-ink);
  word-break: break-word;
  white-space: pre-line;
}

/* Resolution block (dark) */
.diag-card__fix {
  background: var(--diag-ink);
  color: #fff;
  padding: 22px 24px;
  position: relative;
}

.diag-card__fix-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.diag-card__fix-mark {
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
  opacity: 1;
}

.diag-card__fix-lbl {
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: #fff;
}

.diag-card__fix-txt {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.35);
  white-space: pre-line;
  padding-left: 38px;
}

/* CTA row */
.diag-card__bottom {
  display: flex;
  border-bottom: 1px solid var(--diag-line);
  background: #f5f5f5;
  justify-content: space-between;
  padding: 20px;
  align-items: center;
}

.diag-card__contact {
  text-align: center;
}

.diag-btn-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: var(--diag-red);
  color: #fff !important;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-decoration: none;
  transition: background .2s ease;
  border: 0;
  font-family: inherit;
}

.diag-btn-link:hover,
.diag-btn-link:focus {
  background: var(--diag-red-d);
  color: #fff !important;
  text-decoration: none;
}

.diag-btn-link:hover .diag-btn-link__arrow,
.diag-btn-link:focus .diag-btn-link__arrow {
  transform: translateX(4px);
}

.diag-btn-link__arrow {
  display: inline-block;
  font-size: 16px;
  line-height: 1;
  transition: transform .22s cubic-bezier(.2,.7,.2,1);
}

.diag-btn-link__inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.diag-btn-link__text {
  display: block;
}

.diag-btn-link__model {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .14em;
  opacity: 1;
  text-transform: uppercase;
  color: rgba(255,255,255,.95);
  white-space: normal;
}


.diag-contact-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--diag-ink);
  margin-bottom: 5px;
}

.diag-contact-text .fa-solid {
  color: var(--diag-red);
  font-size: 16px;
  flex-shrink: 0;
}

.diag-btn-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #fff;
  border: 2px solid var(--diag-red);
  color: var(--diag-red) !important;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.diag-btn-contact:hover,
.diag-btn-contact:focus {
  background: var(--diag-red);
  color: #fff !important;
}


/* ───────── Empty state ───────── */
.diag-widget-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: var(--diag-bg);
  border: 1px solid var(--diag-line);
  border-left: 3px solid var(--diag-warn);
  color: var(--diag-ink-2);
  font-size: 14px;
}

.diag-widget-empty .fa-solid {
  color: var(--diag-warn);
  font-size: 20px;
}

/* ───────── Responsive ───────── */
/* Card dentro diagResult perde bordo inferiore: continua nella contact-section */
#diagCards .diag-card { border-bottom: 0; }

@media (max-width: 767.98px) {
  .diag-widget-header,
  .diag-widget-body { padding-left: 20px; padding-right: 20px; }
  .diag-widget-header__title { font-size: 22px; }
  .diag-card__hero,
  .diag-card__row,
  .diag-card__fix,
  .diag-card__cta,
  .diag-card__contact { padding-left: 18px; padding-right: 18px; }
  .diag-card__code,
  .diag-card__title { font-size: 20px; }
  .diag-card__fix-txt { font-size: 15px; }

  /* Bottom section: stack verticale su mobile */
  .diag-card__bottom { flex-direction: column; }
  .diag-card__contact {
    border-left: 0;
    border-top: 1px solid var(--diag-line);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 28px;
    padding-bottom: 28px;
  }
  .diag-contact-text { font-size: 13px; }
}
