/*
* Revamped Stylesheet for Spritzguss Konfigurator
* Version: 2.2 (Mobile & Modal Fixes)
* Description: A complete style overhaul to a modern, clean, light theme.
*/

/* --- Theme & Base Variables --- */
.konfigurator-wrapper {
    border-radius: 12px;
    padding: 2rem;
    color: var(--spritz-text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    border: 1px solid var(--spritz-border-color);
}


/* --- Main App Layout --- */
.spritz-app {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 2rem;
    align-items: stretch;
}

/* --- Summary Panel (Left Column) --- */
.spritz-summary {
    background-color: var(--spritz-surface-color);
    border: 1px solid var(--spritz-border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 2rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.summary-header label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--spritz-text-secondary);
    margin-bottom: 0.5rem;
    display: block;
}

.summary-header .order-name-input {
    width: 100%;
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.5rem;
    margin-bottom: 1.5rem;
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--spritz-text-primary);
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
}

.summary-header .order-name-input:hover,
.summary-header .order-name-input:focus {
    border-color: var(--spritz-border-color);
    background-color: var(--spritz-bg-color);
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.summary-chart-container {
    max-width: 180px;
    margin: 1rem auto;
}

.summary-list {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.summary-list li {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--spritz-text-secondary);
    font-weight: 500;
}

.summary-list li::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.75rem;
    background-color: var(--product-color, var(--spritz-border-color));
}

.summary-total {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--spritz-border-color);
}

.summary-total .total-label {
    font-size: 1rem;
    color: var(--spritz-text-secondary);
    margin: 0;
}

.summary-total .total-price {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--spritz-text-primary);
    margin: 0.25rem 0 0 0;
}

.spritz-products {
    background-color: var(--spritz-surface-color);
    border: 1px solid var(--spritz-border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    min-width: 0;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.spritz-products::before {
    content: '';
    width: 100%;
    display: block;
}

.products-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 0 1.5rem 0.75rem 1.5rem;
    border-bottom: 1px solid var(--spritz-border-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--spritz-text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.summary-list-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--spritz-text-secondary);
    text-transform: uppercase;
    margin: 1.5rem 0 0.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--spritz-border-color);
}

/* --- Product Card (Display Mode) --- */
.product-card {
    background: var(--spritz-surface-color);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--spritz-border-color);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    display: grid;
    grid-template-columns: 30px 1fr auto;
    grid-template-areas:
        "index info    toggle"
        "details details details"
        "actions actions actions";
    gap: 0.5rem 1.5rem;
    align-items: center;
}

.product-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.product-card .index {
    grid-area: index;
    align-self: start;
    color: var(--spritz-text-secondary);
    font-weight: 600;
    font-size: 1rem;
}

.product-info {
    grid-area: info;
}

.product-info h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--spritz-text-primary);
}

.product-info .price-total {
    margin: 0.25rem 0 0 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--spritz-accent-color);
}

.details-toggle {
    grid-area: toggle;
    background: none;
    border: none;
    color: var(--spritz-text-secondary);
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 0.9rem;
}

.details-toggle:hover {
    color: var(--spritz-accent-color);
    background-color: #f3f4f6;
}

.product-details-display {
    grid-area: details;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding-top 0.3s ease-out, margin-top 0.3s ease-out;
    padding-top: 0;
    margin-top: 0;
    border-top: none;
}

.product-details-display.open {
    max-height: 200px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--spritz-border-color);
}

.product-card .actions {
    grid-area: actions;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--spritz-border-color);
}

.detail-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1rem;
    font-size: 0.9rem;
}

.detail-row .detail-label {
    font-weight: 500;
    color: var(--spritz-text-secondary);
    text-align: right;
}

.detail-row .detail-value {
    color: var(--spritz-text-primary);
    font-weight: 500;
    word-break: break-word;
}

/* --- Product Card (Editing Mode) --- */
.product-card.editing {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--spritz-bg-color);
}

.step-content-wrapper {
    padding: 1.5rem;
    border: 1px solid var(--spritz-border-color);
    border-radius: 8px;
    min-height: 380px;
    width: 100%;
    box-sizing: border-box;
}

.step-content {
    display: none;
}

.step-content.active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.step-content .form-field-full {
    grid-column: 1 / -1;
}

.step-content h3 {
    grid-column: 1 / -1;
    margin: 0 0 1rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--spritz-border-color);
    font-size: 1.1rem;
}

.step-content label {
    display: flex;
    align-items: center;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--spritz-text-secondary);
}

.step-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--spritz-border-color);
}

/* --- General Form Elements --- */
.product-card.editing input,
.product-card.editing select,
.product-card.editing textarea,
.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--spritz-border-color);
    border-radius: 6px;
    margin-top: 0.5rem;
    background-color: var(--spritz-surface-color);
    color: var(--spritz-text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.product-card.editing input:focus,
.product-card.editing select:focus,
.product-card.editing textarea:focus,
.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
    outline: none;
    border-color: var(--spritz-accent-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--spritz-accent-color) 20%, transparent);
}


/* --- Buttons --- */
button,
.button,
.confirm-btn,
.secondary-btn,
.action-btn-quote,
.action-btn-order {
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.spritz-products>button {
    background: none;
    border: 1px solid var(--spritz-border-color);
    color: var(--spritz-text-secondary);
    padding: 1rem;
}

.spritz-products>button:hover {
    border-color: var(--spritz-accent-color);
    color: var(--spritz-accent-color);
    background-color: #f3f4f6;
}

.spritz-summary>button.feedback-btn {
    background-color: var(--spritz-bg-color);
    color: var(--spritz-text-secondary);
    border-color: var(--spritz-border-color);
    margin-top: 1.5rem;
}

.spritz-summary>button.feedback-btn:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
    color: var(--spritz-text-primary);
}

.actions button.edit {
    background-color: transparent;
    border-color: var(--spritz-border-color);
    color: var(--spritz-text-secondary);
}

.actions button.edit:hover {
    border-color: var(--spritz-accent-color);
    color: var(--spritz-accent-color);
    background-color: #f3f4f6;
}

.actions button.delete {
    background-color: var(--spritz-destructive-color);
    color: white;
}

.actions button.delete:hover {
    background-color: #b91c1c;
}

.action-btn-quote,
.action-btn-order {
    background-color: var(--spritz-accent-color);
    color: white;
}

.action-btn-quote:hover,
.action-btn-order:hover {
    background-color: var(--spritz-accent-hover);
}

.action-btn-quote.pending,
.action-btn-quote.ordered {
    background-color: var(--spritz-bg-color);
    border-color: var(--spritz-border-color);
    color: var(--spritz-text-secondary);
    cursor: not-allowed;
}

.action-btn-quote.pending:hover,
.action-btn-quote.ordered:hover {
    background-color: var(--spritz-bg-color);
}

.step-actions .cancel,
.step-actions .prev,
.secondary-btn {
    background-color: transparent;
    border-color: var(--spritz-border-color);
    color: var(--spritz-text-secondary);
}

.step-actions .cancel:hover,
.step-actions .prev:hover,
.secondary-btn:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
    color: var(--spritz-text-primary);
}

.step-actions .next,
.step-actions .save,
.confirm-btn {
    background-color: var(--spritz-accent-color);
    color: white;
}

.step-actions .next:hover,
.step-actions .save:hover,
.confirm-btn:hover {
    background-color: var(--spritz-accent-hover);
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.modal-content {
    background-color: var(--spritz-surface-color);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-content.large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--spritz-border-color);
    margin-bottom: 0.5rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--spritz-text-primary);
    flex-grow: 1;
}

.close-btn {
    background: none;
    border: none;
    color: var(--spritz-text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    color: var(--spritz-text-primary);
    background-color: var(--spritz-bg-color);
}


.modal-content p {
    color: var(--spritz-text-secondary);
    line-height: 1.6;
    margin: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--spritz-border-color);
}

/* --- Progress Indicator --- */
.progress-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.progress-step {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.progress-step:last-child {
    flex-grow: 0;
}

.step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--spritz-border-color);
    background-color: var(--spritz-surface-color);
    color: var(--spritz-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: all 0.3s ease;
}

.step-dot.completed {
    background-color: var(--spritz-accent-color);
    border-color: var(--spritz-accent-color);
    color: white;
}

.step-line {
    flex-grow: 1;
    height: 2px;
    background-color: var(--spritz-border-color);
    transition: all 0.3s ease;
}

.step-line.completed {
    background-color: var(--spritz-accent-color);
}

/* --- Toggle Switch & Choice Layouts --- */
.choice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--spritz-border-color);
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 28px;
}

.toggle-switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.toggle-switch-slider {
    background-color: var(--spritz-accent-color);
}

input:focus+.toggle-switch-slider {
    box-shadow: 0 0 1px var(--spritz-accent-color);
}

input:checked+.toggle-switch-slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}

/* --- Tooltip --- */
.tooltip-container {
    position: relative;
    display: inline-flex;
    cursor: help;
    margin-left: 0.5rem;
}

.tooltip-icon {
    color: var(--spritz-text-secondary);
}

.tooltip-container:hover .tooltip-icon {
    color: var(--spritz-accent-color);
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: 220px;
    background-color: var(--spritz-text-primary);
    color: var(--spritz-surface-color);
    text-align: center;
    border-radius: 6px;
    padding: 0.75rem;
    position: absolute;
    z-index: 1;
    bottom: 135%;
    left: 50%;
    margin-left: -110px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
    line-height: 1.5;
    font-weight: 400;
    transition: opacity 0.2s;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--spritz-text-primary) transparent transparent transparent;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .spritz-app {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .spritz-summary {
        position: static;
    }

    .spritz-products {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .konfigurator-wrapper {
        padding: 1rem;
    }

    .product-card {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "info    toggle"
            "details details"
            "actions actions";
        padding: 1rem;
        gap: 0 1rem;
    }

    .product-card .index {
        display: none;
    }

    .product-details-display {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }

    .detail-row {
        grid-template-columns: 100px 1fr;
    }

    .product-card .actions {
        margin-top: 1rem;
        padding-top: 1rem;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .product-card .actions button,
    .product-card .actions .action-btn-quote,
    .product-card .actions .action-btn-order {
        flex-grow: 1;
    }

    .step-content.active {
        grid-template-columns: 1fr;
    }
    
    .modal-form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 0 1rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .close-btn {
        font-size: 1.5rem;
    }

    .modal-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .modal-actions button,
    .modal-actions .button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .konfigurator-wrapper {
        padding: 0.5rem;
        border: none;
    }

    .spritz-app {
        gap: 1rem;
    }
    
    .spritz-summary, .spritz-products {
        padding: 1rem;
    }

    .summary-total .total-price {
        font-size: 1.75rem;
    }

    .modal-content {
        padding: 1rem;
        border-radius: 8px;
    }

    .modal-header {
        padding-bottom: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    .close-btn {
        font-size: 1.3rem;
    }

    .modal-actions {
        margin-top: 1rem;
        padding-top: 0.75rem;
    }
    
    .step-actions {
        flex-direction: column-reverse;
    }

    .step-actions button {
        width: 100%;
    }
}


@media screen and (min-width: 1024px) {
    .konfigurator-wrapper {
        width: 60vw;
    }
}