/* Dieses Stylesheet lädt nur auf Konfigurator-Seiten. Das Modul begrenzt und
   zentriert sich selbst – unabhängig vom Theme-Layout (voll- oder schmalbreit).
   Zusätzlich Block-Themes höflich die gewünschte Content-Breite mitgeben. */
:root { --wp--style--global--content-size: 1300px; --wp--style--global--wide-size: 1300px; }

/* Look & Feel identisch zum alten Chiptuning-Plugin. */
.ctc {
    --ct-primary: #e30613;
    --ct-max: 1300px;
    width: 100%;
    max-width: var(--ct-max);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}
.ctc *, .ctc *::before, .ctc *::after { box-sizing: border-box; }

.ctc .detail-page {
    position: relative;
    width: 100%;
    margin: 20px auto;
    box-sizing: border-box;
}

.ctc .stage-header {
    position: relative;
    padding: 30px 20px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--ct-primary);
    background: #f2f2f2;
}
.ctc .configurator-title {
    position: relative; z-index: 1; margin: 0;
    color: #000; font-size: 32px; font-weight: 600;
}
@media (min-width: 35rem) {
    .ctc .detail-page { margin: 40px auto; }
    .ctc .stage-header { padding: 40px; }
}

/* Schritt 1: Typ-Kacheln */
.ctc .ct_type_box { display: flex; flex-direction: column; }
.ctc .config_list_box { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 35rem) { .ctc .config_list_box { flex-direction: row; } }

.ctc .ct_type_link {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px;
    flex: 1; padding: 30px 40px;
    background-color: #eaeaea; color: #000;
    text-decoration: none; text-align: center; cursor: pointer;
    transition: background-color .15s, color .15s;
}
.ctc .ct_type_link svg { height: 100px; width: auto; }
.ctc .ct_type_link span { font-size: 20px; font-weight: 600; }
.ctc .ct_type_link:hover { background-color: var(--ct-primary); color: #fff; }
.ctc .ct_type_link:hover svg { fill: #fff !important; }

/* Kaskade: mobil + Tablet nur die aktuelle Spalte (Spalten sind selbst die
   Navigation, dazu der Zurück-Button); ab Desktop (75rem) alle nebeneinander. */
.ctc .config_layout { margin: 10px 0; }
.ctc .config_box:not(.is-current) { display: none; }

@media (min-width: 75rem) {
    /* Festes 4-Spalten-Raster: jede Spalte immer 1/4 breit, auch wenn erst
       eine da ist (rechts bleibt frei, bis weitere Schritte dazukommen). */
    .ctc .config_layout {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        grid-gap: 10px;
        align-items: start;
    }
    .ctc .config_box:not(.is-current) { display: flex; }
}

.ctc .config_box, .ctc .config_engine {
    display: flex; flex-direction: column; gap: 3px;
    margin-bottom: 10px; background-color: #fff;
}
.ctc .config_box { border: 2px solid #42424226; }
.ctc .config_engine { border: 2px solid var(--ct-primary); background-color: #f8f8f8; }

.ctc .config_box_title {
    margin: 0; padding: 20px;
    background-color: #42424226; color: #000 !important;
    font-size: 18px; font-weight: 600;
}
.ctc .config_box.is-current > .config_box_title,
.ctc .config_engine > .config_box_title {
    color: #fff !important; background-color: var(--ct-primary);
}
.ctc .config_box_title span { display: block; margin-top: 5px; font-weight: 400; font-size: 15px; }

.ctc .config_list { list-style: none; margin: 0; padding: 0; }
.ctc .config_engine .config_list { padding-top: 3px; }

.ctc .config_item {
    display: flex; margin-bottom: 3px; padding: 0;
    background-color: #f3f4f5; border-left: 2px solid #e6e7e8;
    cursor: pointer; transition: color .15s, background-color .15s;
}
.ctc .config_item:hover { background-color: var(--ct-primary); }
.ctc .config_item:hover .config_link { color: #fff; }
.ctc .config_item.is-selected { background-color: var(--ct-primary); }
.ctc .config_item.is-selected .config_link { color: #fff; }

.ctc .config_link {
    display: inline-block; width: 100%; padding: 8px 12px;
    color: #000; font-size: 14px; text-decoration: none;
}
.ctc .ps_link { width: auto; white-space: nowrap; text-align: end; font-weight: 600; }

/* Ergebnis (Optionen/Boxen) als hervorgehobene Spalte */
.ctc .ctc-price { color: var(--ct-primary); font-weight: 700; }

/* Zurück-Button: in der Kaskade nur mobil, auf Detailseiten (.is-always) immer. */
.ctc .ct_back { margin: 10px 0; }
.ctc .ct_back .button {
    display: inline-block; padding: 8px 16px; cursor: pointer; border: 0;
    text-decoration: none; color: #fff; background-color: #000;
}
@media (min-width: 75rem) { .ctc .ct_back { display: none; } }
.ctc .ct_back.is-always { display: block; }

.ctc-loading, .ctc-error { padding: 12px; color: #6b7280; }
.ctc-error { color: var(--ct-primary); }

/* ---------- Detailseite ---------- */
.ctc .configurator-subtitle { position: relative; z-index: 1; margin: 10px 0 0; color: #000 !important; font-size: 18px; font-weight: 500; }

.ctc .stage-row { display: flex; flex-direction: column; gap: 15px; margin-bottom: 1.5rem; }

.ctc .stages { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 10px 0 5px; }
.ctc .stages li { display: inline-block; padding: 8px 12px; background-color: #F0ECEC; color: #000; cursor: pointer; font-size: 14px; font-weight: 600; }
.ctc .stages li.red, .ctc .stages li:hover { background-color: var(--ct-primary); color: #fff !important; }
.ctc .stages li p { margin: 0; display: flex; gap: 8px; align-items: center; }
.ctc .stages svg { height: 18px; width: auto; fill: #000; }
.ctc .stages li.red svg, .ctc .stages li:hover svg { fill: #fff; }

.ctc .ctuning_tables { margin: 5px 0; overflow-x: auto; }
.ctc .ctuning_tables table { width: 100%; text-align: right; border: none; border-spacing: 2px; border-collapse: separate; background-color: #fff; margin: 0; box-shadow: 0 0 20px 10px rgba(0,0,0,.05); }
.ctc .ctuning_tables th { background-color: #e3e3e3; color: #1b1b1b; }
.ctc .ctuning_tables th, .ctc .ctuning_tables td { border: none; padding: 8px 10px; font-size: 15px; }
.ctc .ctuning_tables th span { display: block; font-size: 12px; font-weight: 400; }
.ctc .ctuning_tables td { background-color: #f1f1f1; font-weight: 500; }
.ctc .gesamt { color: var(--ct-primary); font-size: 1.2rem; font-weight: 700; }
.ctc .strong-red { color: var(--ct-primary); font-weight: 700; }

.ctc .stage-content-container { display: flex; flex-direction: column; gap: 20px; }

.ctc .stage_button_container { display: flex; gap: 10px; justify-content: flex-end; margin-top: 15px; flex-wrap: wrap; }
.ctc .stage_button_container .button { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; text-decoration: none; border: 0; cursor: pointer; }
.ctc .ct_black { color: #fff; background-color: #000; }
.ctc .ct_red { color: #fff; background-color: var(--ct-primary); }
.ctc .ct_button svg { width: 20px; height: auto; fill: #fff; }

.ctc .stage-description { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.ctc .stage-description-item { width: 100%; border: 1px solid #dfdfdf; }
.ctc .stage-description-heading { margin: 0; padding: 16px 24px; color: #fff; background-color: var(--ct-primary); font-size: 18px; font-weight: 500; text-transform: uppercase; }
.ctc .descr_text { margin: 0; padding: 15px 24px 24px; }
.ctc .option_info .descr_text { padding: 15px 0; }
.ctc .stage-description .desc_list { margin: 0; padding: 15px 24px 24px; list-style: none; }
.ctc .stage-description .desc_list li { position: relative; padding-left: 1.2em; margin-bottom: 6px; }
.ctc .stage-description .desc_list li:last-child { margin-bottom: 0; }
.ctc .stage-description .desc_list li::before { content: "–"; position: absolute; left: 0; color: var(--ct-primary); font-weight: 700; }

@media (min-width: 60rem) {
    .ctc .stage-content-container { flex-direction: row; }
    .ctc .stage-description { flex-direction: row; }
    .ctc .stage-description-50 { width: 50%; }
}

/* Box-Detail: Karten nebeneinander (breiter, damit Serie → Box lesbar bleibt) */
.ctc .box-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
    margin: 10px 0;
}
.ctc .box-card {
    display: flex;
    flex-direction: column;
    border: 2px solid #42424226;
    background-color: #fff;
    box-shadow: 0 0 20px 8px rgba(0,0,0,.04);
}
.ctc .box-card__title {
    margin: 0;
    padding: 14px 18px;
    background-color: var(--ct-primary);
    color: #fff !important;
    font-size: 18px;
    font-weight: 600;
}
.ctc .box-card__table { width: 100%; border-collapse: collapse; }
.ctc .box-card__table th,
.ctc .box-card__table td { padding: 8px 18px; text-align: left; font-size: 14px; border-bottom: 1px solid #f0f0f0; }
.ctc .box-card__table th { color: #6b7280; font-weight: 500; width: 30%; white-space: nowrap; }
.ctc .box-card__table td { font-weight: 500; }
.ctc .box-serie { color: #6b7280; }
.ctc .box-arrow { color: #9ca3af; margin: 0 4px; }
.ctc .box-card__price { margin-top: auto; padding: 14px 18px; text-align: right; }

/* FAQ / Glossar (natives <details>, kein JS) */
.ctc .ctc-faq { margin: 34px 0 10px; }
.ctc .ctc-faq__title { margin: 0 0 12px; color: #000; font-size: 22px; font-weight: 600; }
.ctc .ctc-faq__item { border: 1px solid #dfdfdf; border-bottom: 0; background: #fff; }
.ctc .ctc-faq__item:last-child { border-bottom: 1px solid #dfdfdf; }
.ctc .ctc-faq__item > summary {
    position: relative; list-style: none; cursor: pointer; user-select: none;
    padding: 15px 46px 15px 18px;
    color: #000; font-size: 15px; font-weight: 600;
    outline: none; /* kein roter Fokus-Rahmen beim Klick … */
}
/* … Tastatur-Fokus bleibt sichtbar, aber neutral statt rot. */
.ctc .ctc-faq__item > summary:focus-visible { outline: 2px solid #000; outline-offset: -2px; }
.ctc .ctc-faq__item > summary::-webkit-details-marker { display: none; }
.ctc .ctc-faq__item > summary::after {
    content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    color: var(--ct-primary); font-size: 22px; font-weight: 700; line-height: 1;
}
.ctc .ctc-faq__item[open] > summary { color: var(--ct-primary); padding-bottom: 8px; }
.ctc .ctc-faq__item[open] > summary::after { content: "\2013"; }
.ctc .ctc-faq__body { padding: 4px 18px 18px; }
.ctc .ctc-faq__body p { margin: 0; color: #333; font-size: 14px; line-height: 1.6; }

/* Anfrage-/Lead-Formular (server-gerendert, kein JS) */
.ctc .ctc-anfrage { margin: 34px 0 10px; padding: 24px; border: 1px solid #dfdfdf; background: #fafafa; scroll-margin-top: 20px; }
.ctc .ctc-anfrage__title { margin: 0 0 6px; color: #000; font-size: 22px; font-weight: 600; }
.ctc .ctc-anfrage__sel { margin: 0 0 16px; color: #333; font-size: 14px; }
.ctc .ctc-anfrage__note { margin: 0 0 16px; padding: 12px 14px; font-size: 14px; border-left: 4px solid; }
.ctc .ctc-anfrage__note.is-ok { background: #eafbef; border-color: #1a9c4c; color: #14612f; }
.ctc .ctc-anfrage__note.is-err { background: #fdecec; border-color: var(--ct-primary); color: #8a1119; }
.ctc .ctc-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 45rem) { .ctc .ctc-grid { grid-template-columns: repeat(3, 1fr); } }
.ctc .ctc-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.ctc .ctc-field > span { font-size: 13px; font-weight: 600; color: #333; }
.ctc .ctc-field input,
.ctc .ctc-field select,
.ctc .ctc-field textarea {
    width: 100%; padding: 10px 12px; font-size: 14px;
    border: 1px solid #cfcfcf; background: #fff; border-radius: 0; box-sizing: border-box;
}
.ctc .ctc-field input:focus,
.ctc .ctc-field select:focus,
.ctc .ctc-field textarea:focus { outline: none; border-color: var(--ct-primary); }
.ctc .ctc-check { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 16px; font-size: 13px; color: #333; }
.ctc .ctc-check input { margin-top: 2px; }
.ctc .ctc-anfrage__actions { text-align: right; }
.ctc .ctc-anfrage__actions .button { display: inline-flex; align-items: center; padding: 11px 22px; border: 0; cursor: pointer; text-decoration: none; }
.ctc .ctc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* PDF-Button (Icon links neben Label) */
.ctc #pdf-create,
.ctc #box-pdf-create { display: inline-flex; align-items: center; gap: 8px; }
.ctc #pdf-create svg,
.ctc #box-pdf-create svg { width: 20px; height: auto; fill: #fff; }

/* PDF-Notiz-Dialog (portiert aus dem alten Plugin) */
.ct_overlay {
    position: fixed; inset: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.16); z-index: 99999;
}
.ct_popup {
    /* Popup hängt außerhalb von .ctc – Variable hier eigenständig definieren. */
    --ct-primary: #e30613;
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: flex; flex-direction: column; gap: 1rem;
    width: min(90vw, 500px); max-height: 90vh; overflow-y: auto;
    padding: clamp(1rem, 5vw, 2rem);
    background: rgba(255, 255, 255, 0.97); backdrop-filter: blur(10px);
    border-radius: 5px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); z-index: 999999;
}
.ct_popup #note { width: 100%; min-height: 100px; max-height: 30vh; padding: 10px 12px; border: 1px solid #cfcfcf; box-sizing: border-box; }
.ct_popup .button { display: inline-block; border: 0; cursor: pointer; padding: 11px 18px; font-size: 15px; font-weight: 600; border-radius: 3px; }
.ct_popup .ct_red { color: #fff !important; background-color: var(--ct-primary, #e30613) !important; }
.ct_popup .ct_close {
    position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0;
    background: transparent; color: #000; line-height: 0;
}
.ct_popup .ct_close svg { width: 100%; height: 100%; }

/* ---------- Hinweisfenster (Kachel-Klick bzw. Fahrzeugseite) ---------- */
.ctc-dialog {
    --ct-primary: #e30613;   /* liegt außerhalb von .ctc – Variable hier eigenständig */
    width: min(92vw, 560px);
    max-height: 85vh;
    padding: 0;
    border: 0;
    border-radius: 4px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
    color: #1b1b1b;
    font-size: 15px;
    line-height: 1.55;
}
.ctc-dialog::backdrop { background: rgba(0, 0, 0, .45); }

.ctc-dialog__head {
    padding: 18px 24px;
    background: var(--ct-primary);
}
.ctc-dialog__head h2 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.ctc-dialog__body {
    padding: 20px 24px;
    max-height: 55vh;
    overflow-y: auto;
}
.ctc-dialog__body p { margin: 0 0 12px; }
.ctc-dialog__body p:last-child { margin-bottom: 0; }
.ctc-dialog__body ul { margin: 0 0 14px; padding: 0; list-style: none; }
.ctc-dialog__body li { position: relative; padding-left: 1.2em; margin-bottom: 6px; }
.ctc-dialog__body li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: var(--ct-primary);
    font-weight: 700;
}

.ctc-dialog__foot {
    padding: 14px 24px 20px;
    text-align: right;
}
.ctc-dialog__foot .button {
    display: inline-block;
    padding: 11px 22px;
    border: 0;
    cursor: pointer;
    color: #fff;
    background-color: var(--ct-primary);
    font-size: 15px;
    font-weight: 600;
}

/* Rückfall ohne JavaScript: der Hinweis steht als Kasten auf der Seite. */
.ctc .ctc-notice {
    margin: 0 0 20px;
    padding: 16px 20px;
    border-left: 4px solid var(--ct-primary);
    background: #fdecec;
}
.ctc .ctc-notice p { margin: 0 0 10px; }
.ctc .ctc-notice p:last-child { margin-bottom: 0; }
.ctc .ctc-notice ul { margin: 0 0 10px; padding-left: 1.2em; }
