:root {
    --bg: #f2f3f5;
    --card: #ffffff;
    --text: #1f2933;
    --muted: #667085;
    --accent: #4f46e5;
    --border: #d0d5dd;

    --radius: 10px;
    --shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

main#app {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
}

button {
    font: inherit;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    background: #fff;
}

button.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    width: 100%;
    padding: 0.75rem;
    font-weight: 600;
}

button.secondary {
    width: 100%;
    background: #f9fafb;
}

.scenario-picker {
    display: grid;
    gap: 0.5rem;
}

.scenario-option {
    text-align: left;
}

.scenario-option.active {
    border-color: var(--accent);
    background: #eef2ff;
}

.preview-card {
    position: sticky;
    top: 3.5rem;
    z-index: 20;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.preview-background-toggle {
    display: flex;
    gap: 0.25rem;
}

.preview-background-toggle button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.preview-background-toggle button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

#preview {
    margin-top: 0.5rem;
    height: 30vh;
    max-height: 240px;
    min-height: 160px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview.neutral {
    background: #ddd;
}

.preview.light {
    background: #f7f7f7;
}

.preview.dark {
    background: #444;
}

#previewContent {
    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;
}

#previewContent svg {
    display: block;
    height: 100%;
    width: auto;
}

#text-fields {
    display: grid;
    gap: 0.75rem;
}

textarea,
input,
select {
    width: 100%;
    padding: 0.6rem;
    font: inherit;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.picker-toggle {
    width: 100%;
    text-align: left;
}

/* deaktivierter Font-Picker */
.picker-toggle.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.font-option {
    cursor: pointer;
}

.font-option.active {
    background: #eee;
}

/*************************************************
 * Farb-Picker – Grundstruktur
 *************************************************/

.picker {
    margin-top: 0.5rem;
    display: grid;
    gap: 0.75rem;
}

/* eingeklappt */
.picker.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.25s ease, opacity 0.2s ease;
}

/* ausgeklappt */
.picker:not(.collapsed) {
    max-height: 60vh;
    /* 🔑 scrollbar bei vielen Farben */
    overflow-y: auto;
    opacity: 1;
    pointer-events: auto;
}

/*************************************************
 * Aktive Farbe – immer sichtbar
 *************************************************/

#activeColorBar {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    position: sticky;
    top: 0;
    z-index: 10;

    background: #fff;
    padding: 0.5rem 0;

    border-bottom: 1px solid var(--border);
}

#activeColorSwatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: #fff;
    box-sizing: border-box;
}

/*************************************************
 * Farbgruppen
 *************************************************/

.color-group {
    margin-bottom: 1rem;
}

.color-group-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
}

/*************************************************
 * Grid für Farb-Swatches
 *************************************************/

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
}

/*************************************************
 * Farb-Swatch
 *************************************************/

.color-swatch {
    width: 100%;
    height: 44px;

    border-radius: 6px;
    cursor: pointer;

    border: 2px solid transparent;
    box-sizing: border-box;
    position: relative;
}

/* helle Farben sichtbar machen */
.color-swatch::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

/* aktive Farbe */
.color-swatch.active {
    border-color: #000;
}

/*************************************************
 * Mobile Feinschliff (optional, empfohlen)
 *************************************************/

@media (max-width: 600px) {
    .color-swatch {
        height: 48px;
    }

    .color-grid {
        gap: 0.6rem;
    }
}



.dimension-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.hint {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.5rem;
    line-height: 1.4;
}

.text-item {
    display: grid;
    gap: 0.4rem;
}

.mirror-option {
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.inactive {
    opacity: 0.5;
}

.dimension-warning {
    margin-top: 4px;
    font-size: 12px;
    color: #b00020;
}

.text-item {
    position: relative;
}

.text-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;

    background: transparent;
    border: none;
    cursor: pointer;

    font-size: 1rem;
    line-height: 1;
    color: #900;
}

.text-delete-btn:hover {
    color: #c00;
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.confirm-overlay.hidden {
    display: none;
}

.confirm-dialog {
    background: #fff;
    padding: 1.25rem;
    border-radius: 8px;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.confirm-dialog p {
    margin-bottom: 1rem;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-secondary {
    background: #eee;
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.btn-danger {
    background: #c00;
    color: #fff;
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

#fontReferenceHint {
    font-size: 0.85rem;
    color: #666;
    margin-top: 4px;
}

.quantity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.text-quantity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.text-quantity-row label {
    flex: 1;
    /* Text nimmt Rest */
}

.text-quantity-row input {
    width: 25%;
    max-width: 120px;
    /* Optional */
}

.text-mirror-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.text-mirror-row label {
    flex: 1;
}

.text-mirror-row input {
    width: 25%;
    max-width: 120px;
}

.addon-item {
    margin-bottom: 10px;
}

.addon-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.addon-row {
    display: grid;
    grid-template-columns: 60px 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.addon-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.addon-name {
    font-size: 14px;
}

.addon-price {
    font-weight: 600;
    white-space: nowrap;
}

.addon-checkbox {
    transform: scale(1.2);
}

.addon-card {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    margin-bottom: 12px;
}

.addon-card:hover {
    border-color: #999;
}

.addon-card.selected {
    border-color: #000;
    background: #f5f5f5;
}

.addon-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.addon-content {
    display: flex;
    flex-direction: column;
}

.addon-name {
    font-weight: 600;
    font-size: 14px;
}

.addon-description {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.addon-price {
    font-weight: 600;
    white-space: nowrap;
}

.addon-checkbox {
    display: none;
}

.addon-card {
    position: relative;
}

.addon-check-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #000;
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

.addon-card.selected .addon-check-icon {
    opacity: 1;
    transform: scale(1);
}

.price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.price-row span:last-child {
    font-weight: 500;
}

.price-total {
    margin-top: 12px;
    font-size: 1.2rem;
}

.price-info {
    margin: 6px 0;
    font-size: 0.9rem;
    color: #555;
}

.price-discount {
    font-size: 0.85rem;
    color: #2e7d32;
    margin-bottom: 8px;
}

.price-shipping-note {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #666;
}

/* deaktivierte Maßfelder */
#widthInput:disabled,
#heightInput:disabled {
    background: #f3f3f3;
    color: #777;
    border-color: #ddd;
    cursor: default;
}

/* noch stärker ausgegraut wenn zusätzlich "inactive" */
#widthInput.inactive:disabled,
#heightInput.inactive:disabled {
    background: #f7f7f7;
    color: #999;
}

/* verhindert Focus-Style */
#widthInput:disabled:focus,
#heightInput:disabled:focus {
    outline: none;
    box-shadow: none;
}

/* Referenztext hervorheben */
.text-item.reference-text {
    border: 2px solid #4da3ff;
    background: #f2f7ff;
    border-radius: 6px;
    padding: 8px;
}

/* Hinweis im Größenfeld */
.dimension-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #2c5ea8;
    background: #f2f7ff;
    padding: 4px 8px;
    border-radius: 4px;
}

.cart-link {

    position: relative;

    display: flex;

    align-items: center;

    justify-content: center;

    width: 36px;
    height: 36px;

    text-decoration: none;

}

.cart-icon {

    width: 26px;
    height: 26px;
    fill: #000;

}

.cart-count {

    position: absolute;

    top: -4px;
    right: -6px;

    background: red;
    color: white;

    font-size: 11px;

    padding: 2px 5px;

    border-radius: 10px;

}

.cart-notice {

    position: fixed;

    bottom: 20px;
    left: 50%;

    transform: translateX(-50%);

    background: black;
    color: white;

    padding: 12px 18px;

    border-radius: 8px;

    font-size: 14px;

    display: flex;
    gap: 12px;

    z-index: 999;

}

.cart-notice a {

    color: #fff;
    text-decoration: underline;

}

.cart-wrapper {
    position: relative;
}

.mini-cart {

    position: absolute;
    right: 0;
    top: 40px;

    width: 260px;

    background: white;

    border: 1px solid #ddd;
    border-radius: 8px;

    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);

    padding: 14px;

    display: none;

    z-index: 1000;

}

.cart-wrapper:hover .mini-cart {
    display: block;
}

.mini-cart-item {

    display: flex;
    justify-content: space-between;

    font-size: 14px;

    margin-bottom: 6px;

}

.mini-cart-total {

    margin-top: 8px;

    font-weight: 600;

    border-top: 1px solid #eee;

    padding-top: 6px;

}

.mini-cart-link {

    display: block;

    margin-top: 10px;

    text-align: center;

    padding: 8px;

    background: black;
    color: white;

    border-radius: 6px;

    text-decoration: none;

    font-size: 14px;

}

.strategy-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 2px;
}

.strategy-title {
    font-weight: 600;
}

.strategy-description {
    font-size: 0.85em;
    opacity: 0.7;
    line-height: 1.2;
}

/* Container */
.picker {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-top: 6px;

    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* einzelne Optionen */
.strategy-option {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: none;
    background: transparent;
    cursor: pointer;

    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Hover */
.strategy-option:hover {
    background: #f5f7fa;
}

/* Aktive Auswahl */
.strategy-option.active {
    background: #eaf2ff;
}

/* Titel */
.strategy-title {
    font-weight: 600;
    font-size: 14px;
}

/* Beschreibung */
.strategy-description {
    font-size: 12px;
    color: #666;
}

.strategy-option+.strategy-option {
    border-top: 1px solid #eee;
}

.font-style-controls {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.font-style-controls button {
    padding: 4px 8px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
}

.font-style-controls button.active {
    background: #111;
    color: #fff;
}

.font-warning {
    margin-top: 6px;
    font-size: 12px;
    color: #b00020;
}

/*************************************************
 * HEADER MOBILE
 *************************************************/

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card);
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
}

/* Logo */
.logo img {
    height: 32px;
    display: block;
}

/* Burger */
.menu-toggle {
    font-size: 20px;
    background: none;
    border: none;
    padding: 6px;
}

/* Mobile Navigation */
.mobile-nav {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-top: 1px solid var(--border);
}

/* eingeklappt */
.mobile-nav.collapsed {
    display: none;
}

/* Links */
.mobile-nav a {
    padding: 14px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid #eee;
}

/* Hover */
.mobile-nav a:hover {
    background: #f5f7fa;
}

.mobile-nav {
    transition: all 0.25s ease;
}

/*************************************************
 * Intro / Einstieg
 *************************************************/

.intro-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.intro-title {
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

.intro-lead {
    font-size: 0.95rem;
    color: var(--muted);
    line-height: 1.4;
    margin: 0;
}

.intro-points {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 4px;
}

.intro-point {
    font-size: 0.9rem;
    line-height: 1.4;
}

.intro-hint {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 6px;
}

.intro-hint a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.intro-hint a:hover {
    text-decoration: underline;
}

.scenario-intro {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.4;
    margin-bottom: 0.6rem;
}

.scenario-intro-details {
    display: grid;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.4;
    margin-bottom: 0.6rem;
}

.scenario-intro-details strong {
    color: var(--text);
    font-weight: 600;
}

/*************************************************
 * Szenario Vorschau (PNG)
 *************************************************/

.scenario-preview {
    width: 100%;
    margin-top: 10px;

    border-radius: 8px;
    overflow: hidden;

    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.scenario-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/*************************************************
 * Desktop Layout – rechte Spalte fixieren
 *************************************************/

@media (min-width: 1024px) {

    body.configurator #fixedSummary {
        position: fixed;
        top: calc(var(--header-height) + 2px);
        right: 0;

        width: 45vw;
        padding: 0 2vw;

        display: flex;
        flex-direction: column;
        gap: 5px;

        max-height: calc(100vh - var(--header-height) - 40px);
        overflow-y: auto;
        box-sizing: border-box;
    }

    /* Platz für rechte Seite schaffen */


    body.configurator main,
    body.configurator #app,
    body.configurator .config-layout {

        max-width: none !important;
        margin: 0 !important;
        width: 50vw;
        box-sizing: border-box;
    }

    .preview-card {
        top: 0;
    }
}

.footer-nav a {
    margin-right: 20px;
    text-decoration: none;
}

.config-start {
    margin: 30px 0 10px;
    padding: 14px 18px;
    background: #f8f8f8;
    border-left: 4px solid #D5B36A;
    line-height: 1.4;
}