/* =========================================================
   IWO Bau Konfigurator – Modern Design
   Behält alle Klassen-/ID-Namen, die script.js voraussetzt
   ========================================================= */

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: #1e293b;
    margin: 0;
    padding: 0 0 100px 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ---------- Step-Titel ---------- */
#step-title {
    margin: 0 0 1.5rem;
    letter-spacing: -0.02em;
}

/* ---------- Step-Progress Indikator ---------- */
#step-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.step-dot {
    height: 6px;
    width: 28px;
    border-radius: 999px;
    background: #e2e8f0;
    transition: background-color .3s, width .3s;
}
.step-dot.active { background: #1778f2; width: 48px; }
.step-dot.done   { background: #93c5fd; }

/* ---------- Containers ---------- */
.container {
    width: 92%;
    max-width: 1280px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    margin: 0 auto 24px;
}
/* Verschachtelte Container (z.B. step2-kunststoff in step2) sollen volle Breite nutzen */
.container .container {
    width: 100%;
    max-width: none;
    margin: 0;
}

/* ---------- Cards ---------- */
.card {
    position: relative;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 16px 16px;
    cursor: pointer;
    text-align: center;
    flex: 1 1 220px;
    max-width: 280px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .03);
    transition: transform .25s cubic-bezier(.2,.8,.2,1),
                box-shadow .25s ease,
                border-color .2s ease;
    overflow: hidden;
}
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(23,120,242,.06), rgba(23,120,242,0));
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
}
.card:hover {
    transform: translateY(-4px);
    border-color: #93c5fd;
    box-shadow: 0 10px 25px -8px rgba(23, 120, 242, .25),
                0 4px 8px -4px rgba(15, 23, 42, .08);
}
.card:hover::before { opacity: 1; }
.card img {
    width: 100%;
    max-width: 200px;
    height: 160px;
    object-fit: contain;
    display: block;
    margin: 0 auto 12px;
    background: #f8fafc;
    border-radius: 10px;
    padding: 8px;
}
.card .title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 4px 0 6px;
    line-height: 1.3;
}
.card .details {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

/* ---------- Selected States ---------- */
.card.selected,
.card.laststepselected {
    border-color: #1778f2;
    box-shadow: 0 0 0 4px rgba(23, 120, 242, .18),
                0 10px 25px -8px rgba(23, 120, 242, .35);
    transform: translateY(-2px);
}
.card.selected::after,
.card.laststepselected::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    background: #1778f2;
    color: #fff;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(23, 120, 242, .35);
    z-index: 2;
}

/* ---------- Buttons ---------- */
.button {
    color: white;
    padding: 12px 26px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: .01em;
    transition: transform .15s, box-shadow .2s, filter .2s;
    display: none;
}
.button:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}
.button:active { transform: translateY(0); filter: brightness(.95); }
.button:disabled,
.button.disabled {
    opacity: .55;
    cursor: not-allowed;
    filter: grayscale(.4);
    transform: none !important;
}
.button-primary {
    background: linear-gradient(135deg, #1778f2, #0d4fa3);
    box-shadow: 0 6px 16px -6px rgba(23, 120, 242, .55);
}
.button-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.button-submit {
    background: linear-gradient(135deg, #16a34a, #15803d);
    box-shadow: 0 6px 16px -6px rgba(22, 163, 74, .5);
}
/* Fallback für alte .button-Aufrufe ohne Variante */
.button:not(.button-primary):not(.button-secondary):not(.button-submit) {
    background: linear-gradient(135deg, #1778f2, #0d4fa3);
    box-shadow: 0 6px 16px -6px rgba(23, 120, 242, .55);
}

/* Selected-Checkmark muss über dem Hover-Gradient liegen */
.card.selected::before,
.card.laststepselected::before { opacity: 0; }

/* ---------- Accordion (Step 6) ---------- */
.accout {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
/* Section-Heading "Weitere Optionen" oben in .accout */
.accout > .title {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 4px 4px 8px;
    padding: 0;
    text-align: left;
}

/* Akkordeon-Wrapper (button + content gruppiert in einem Wrapper-Div wie
   #dichtung-options, #eingangstuer-options, #balkontuer-options, ...)
   müssen volle Breite haben, damit innenliegende Buttons (width: 100%) korrekt strecken.
   WICHTIG: .accordion-content ausschließen, sonst wird dessen display:none / display:flex überschrieben! */
.accordion,
.accordion > div:not(.accordion-content),
.accordion > div > div:not(.accordion-content):not(.card) {
    width: 100%;
    display: block;
}
/* Sichtbare Wrapper, die per JS auf "none" gesetzt werden, dürfen das überschreiben */
.accordion > div[style*="display: none"],
.accordion > div[style*="display:none"],
.accordion > div > div[style*="display: none"],
.accordion > div > div[style*="display:none"] { display: none !important; }
/* Buttons direkt im Akkordeon-Wrapper bekommen weiterhin korrekten Abstand */
.accordion > .accordion-btn,
.accordion > div > .accordion-btn {
    margin-bottom: 0;
}
.accordion > .accordion-btn + .accordion-btn,
.accordion > div > .accordion-btn + .accordion-btn,
.accordion > div + div > .accordion-btn:first-child,
.accordion > .accordion-content + .accordion-btn,
.accordion > div > .accordion-content + .accordion-btn {
    margin-top: 10px;
}
.accordion > div + div,
.accordion > div + .accordion-btn,
.accordion > .accordion-content + div {
    margin-top: 10px;
}
.accordion-btn {
    width: 100%;
    background: #ffffff;
    color: #0f172a;
    padding: 16px 22px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transition: background-color .2s, border-color .2s, color .2s, box-shadow .2s;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.accordion-btn:hover {
    border-color: #93c5fd;
    background: #f8fafc;
}
.accordion-btn::after {
    content: "▾";
    font-size: 14px;
    color: #64748b;
    transition: transform .25s ease, color .2s;
}
.accordion-btn.active::after,
.accordion-btn.selected::after { transform: rotate(180deg); }

.accordion-btn.selected {
    background: linear-gradient(135deg, #1778f2, #0d4fa3);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 8px 20px -8px rgba(23, 120, 242, .55);
}
.accordion-btn.selected::after { color: #ffffff; }

.accordion-content {
    display: none;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 6px;
    animation: accIn .25s ease;
}
.accordion-content.active { display: flex; }
@keyframes accIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Untergeordnete Karten in Accordion etwas kompakter */
.accordion-content .card {
    flex: 0 1 200px;
    padding: 12px 10px 10px;
}
.accordion-content .card img {
    max-width: 140px;
    height: 120px;
    margin-bottom: 8px;
}
.accordion-content .card .title { font-size: 13px; }
.accordion-content .card .details { font-size: 12px; }

/* ---------- Form-Elemente in Akkordeons (Inputs, Selects, Labels) ---------- */
/* Sub-Label-Titel innerhalb Accordion-Content (z.B. "Links/Rechts/Oben/Unten") */
.accordion-content > .title {
    flex: 0 0 100%;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin: 8px 0 -4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.accordion-content > .title:first-child { margin-top: 0; }

/* Form-Layout: Breite/Höhe sowie Rahmenverbreiterungen */
.accordion-breite-hoehe,
.accordion-rahmenverbreiterungen {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 22px;
    max-width: 480px;
    margin: 0 auto;
}
.accordion-breite-hoehe label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 6px;
}
.accordion-breite-hoehe label:first-child { margin-top: 0; }

.accordion-content input[type="number"],
.accordion-content input[type="text"],
.accordion-content select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #0f172a;
    background: #ffffff;
    transition: border-color .15s ease, box-shadow .15s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.accordion-content input[type="number"]:hover,
.accordion-content select:hover { border-color: #cbd5e1; }
.accordion-content input[type="number"]:focus,
.accordion-content input[type="text"]:focus,
.accordion-content select:focus {
    outline: none;
    border-color: #1778f2;
    box-shadow: 0 0 0 3px rgba(23, 120, 242, .18);
}
.accordion-content select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3e%3cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.06l3.71-3.83a.75.75 0 1 1 1.08 1.04l-4.25 4.39a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z' clip-rule='evenodd'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 38px;
    cursor: pointer;
}
.accordion-content select::-ms-expand { display: none; }

/* ---------- Summary ---------- */
#summaryPage h3 {
    color: #1778f2;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 6px;
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 700;
}
#summaryPage .summary-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
#summaryPage .summary-item:last-child { border-bottom: none; }
#summaryPage .summary-item .sum-label {
    color: #64748b;
    font-weight: 500;
}
#summaryPage .summary-item .sum-value {
    color: #0f172a;
    font-weight: 600;
    text-align: right;
}

/* ---------- Nav-Buttons Bereich ---------- */
.nav-buttons {
    box-shadow: 0 -4px 20px -10px rgba(15, 23, 42, .15);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .card { flex: 1 1 100%; max-width: 100%; }
    .container { width: 96%; gap: 12px; }
    .accordion-btn { padding: 14px 16px; font-size: 14px; }
    #step-title { font-size: 1.5rem; }
    .accout { width: 96%; }
}

/* ---------- Sticky Bottom Nav: korrekte Padding-Reserve ---------- */
.nav-buttons { z-index: 50; }
