/*
 * Bestellformular - Bestellformular-Seite, Popup im Tool, Produktkatalog
 *
 * Aufbau wie das Reichert-Webformular (Kategorien und Suche oben,
 * Varianten-Knoepfe, Bestellung daneben bzw. als Fenster), Farben und Flaechen
 * wie im SVE-Tool (Navy #2E4358, Orange #E17A00).
 */

.sve-order-widget {
    --o-navy: #2E4358;
    --o-navy-2: #3B566F;
    --o-orange: #E17A00;
    --o-orange-700: #B96300;
    --o-orange-soft: #FDF0DF;
    --o-line: #DEE3E9;
    --o-line-2: #C5CDD7;
    --o-sunk: #F6F7F9;
    --o-ink: #1D2835;
    --o-ink-2: #4A5767;
    --o-ink-3: #7B8795;
    --o-ok-bg: #D4EEDD;
    --o-ok-fg: #0F6636;
    --o-bad-bg: #F7D1CC;
    --o-bad-fg: #8B1C14;
    --o-r: 10px;
    color: var(--o-ink);
    font-size: 15px;
    line-height: 1.45;
}

.sve-order-widget *,
.sve-order-widget *::before,
.sve-order-widget *::after {
    box-sizing: border-box;
}

.sve-order-widget button,
.sve-order-widget input,
.sve-order-widget select {
    font: inherit;
    color: inherit;
}

.sve-order-widget button {
    cursor: pointer;
}

.sve-order-widget [hidden] {
    display: none !important;
}

/* ---------- Oeffnen-Knopf (Popup, Katalog) ---------- */

.sve-order-open-btn {
    min-height: 44px;
    padding: 10px 18px;
    border: 0;
    border-radius: var(--o-r);
    background: var(--o-orange);
    color: #fff !important;
    font-weight: 700;
}

.sve-order-open-btn:hover {
    background: var(--o-orange-700);
}

/* ---------- Modal ---------- */

.sve-order-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
}

.sve-order-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(29, 40, 53, 0.55);
}

.sve-order-modal-dialog {
    position: relative;
    width: min(1240px, calc(100vw - 32px));
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    margin: 16px auto;
    overflow: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
    padding: 0 20px 20px;
}

.sve-order-modal-close {
    position: sticky;
    top: 10px;
    float: right;
    z-index: 6;
    width: 40px;
    height: 40px;
    /* Negativer Rand: Der Knopf schwebt und nimmt dem Inhalt keine Breite */
    margin: 10px -8px -50px -40px;
    border: 1px solid var(--o-line);
    border-radius: 50%;
    background: #fff;
    font-size: 22px;
    line-height: 1;
    color: var(--o-ink-2);
}

.sve-order-modal-close:hover {
    color: var(--o-ink);
    border-color: var(--o-line-2);
}

body.sve-order-modal-open,
html.sve-order-sheet-lock {
    overflow: hidden;
}

.sve-order-widget-modal .sve-order-shop-head {
    padding-right: 46px;
}

.sve-order-widget-modal .sve-order-cart-panel {
    margin-top: 62px;
    top: 62px;
}

/* ---------- Inline (Bestellformular-Seite) ---------- */

.sve-order-inline-panel {
    background: #fff;
    border: 1px solid var(--o-line);
    border-radius: 14px;
    padding: 0 20px 20px;
}

/* ---------- Aufbau ---------- */

.sve-order-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 22px;
    align-items: start;
}

.sve-order-shop {
    min-width: 0;
}

.sve-order-shop-head {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    padding: 16px 0 10px;
    border-bottom: 1px solid var(--o-line);
}

.sve-order-title {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 800;
    color: var(--o-ink);
}

.sve-order-search {
    width: 100%;
    min-height: 46px;
    padding: 8px 14px;
    border: 1px solid var(--o-line-2);
    border-radius: var(--o-r);
    background: var(--o-sunk);
}

.sve-order-search:focus {
    outline: none;
    border-color: var(--o-orange);
    background: #fff;
    box-shadow: 0 0 0 3px var(--o-orange-soft);
}

.sve-order-cats {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 0 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.sve-order-cats button {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 6px 14px;
    border: 1px solid var(--o-line-2);
    border-radius: 999px;
    background: #fff;
    font-weight: 600;
    white-space: nowrap;
    color: var(--o-ink-2);
}

.sve-order-cats button:hover {
    border-color: var(--o-navy-2);
    color: var(--o-ink);
}

.sve-order-cats button.is-on {
    background: var(--o-navy);
    border-color: var(--o-navy);
    color: #fff;
}

.sve-order-cats .n {
    margin-left: 6px;
    font-weight: 400;
    opacity: 0.75;
}

.sve-order-hint {
    margin: 12px 0 0;
    color: var(--o-ink-3);
    font-size: 13px;
}

.sve-order-empty {
    padding: 24px;
    text-align: center;
    color: var(--o-ink-3);
}

/* ---------- Katalog ---------- */

.sve-order-ch {
    margin: 22px 0 10px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--o-ink-3);
}

.sve-order-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 12px;
}

.sve-order-card {
    background: #fff;
    border: 1px solid var(--o-line);
    border-radius: 12px;
    padding: 14px;
}

.sve-order-card.is-tone {
    grid-column: 1 / -1;
}

.sve-order-pname {
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--o-ink);
}

.sve-order-pname .je {
    margin-left: 8px;
    font-weight: 400;
    color: var(--o-ink-3);
}

.sve-order-vars {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sve-order-tones {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
}

.sve-order-vb {
    position: relative;
    min-width: 92px;
    min-height: 54px;
    padding: 6px 12px;
    border: 1px solid var(--o-line-2);
    border-radius: var(--o-r);
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    transition: border-color 0.12s, background 0.12s;
}

.sve-order-tones .sve-order-vb {
    min-width: 0;
    min-height: 48px;
    align-items: center;
    text-align: center;
}

.sve-order-vb:hover {
    border-color: var(--o-navy-2);
}

.sve-order-vb:active {
    transform: translateY(1px);
}

.sve-order-vb .vv {
    font-weight: 600;
    color: var(--o-ink);
}

.sve-order-vb .vp {
    font-size: 13px;
    color: var(--o-ink-3);
}

.sve-order-vb.is-sel {
    background: var(--o-orange-soft);
    border-color: var(--o-orange);
}

.sve-order-vb .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 12px;
    background: var(--o-orange);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Bestellung ---------- */

.sve-order-cart-panel {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    margin-top: 16px;
    background: var(--o-sunk);
    border: 1px solid var(--o-line);
    border-radius: 14px;
    padding: 18px;
}

.sve-order-widget-modal .sve-order-cart-panel {
    max-height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px);
}

.sve-order-cart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sve-order-cart-head h4 {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    color: var(--o-ink);
}

.sve-order-sheet-close {
    display: none;
    min-height: 42px;
    padding: 6px 14px;
    border: 1px solid var(--o-line-2);
    border-radius: var(--o-r);
    background: #fff;
    font-weight: 600;
}

.sve-order-sec {
    margin-top: 16px;
}

.sve-order-sec h5 {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--o-ink-3);
}

.sve-order-free-all-toggle {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid #F2C7EE;
    border-radius: var(--o-r);
    background: #FDF4FF;
    font-size: 14px;
    font-weight: 600;
}

.sve-order-free-all-toggle input {
    width: 20px;
    height: 20px;
    margin: 0;
    flex: 0 0 20px;
    accent-color: var(--o-navy);
}

.sve-order-cart-items {
    background: #fff;
    border: 1px solid var(--o-line);
    border-radius: 12px;
    padding: 0 12px;
}

.sve-order-cart-empty {
    margin: 0;
    padding: 14px 0;
    color: var(--o-ink-3);
}

.sve-order-line {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--o-line);
}

.sve-order-line:last-child {
    border-bottom: 0;
}

.sve-order-line.is-free {
    background: linear-gradient(90deg, #FDF4FF, transparent);
}

.sve-order-line-info {
    flex: 1;
    min-width: 0;
    font-size: 14px;
}

.sve-order-line-info b {
    font-weight: 700;
}

.sve-order-line-price {
    font-size: 13px;
    color: var(--o-ink-3);
}

.sve-order-line-free {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
    font-size: 12px;
    color: var(--o-ink-2);
}

.sve-order-qty {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.sve-order-qty button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--o-line-2);
    background: #fff;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
}

.sve-order-qty button:first-child {
    border-radius: 8px 0 0 8px;
}

.sve-order-qty button:last-child {
    border-radius: 0 8px 8px 0;
}

.sve-order-qty input {
    width: 44px;
    height: 38px;
    border: 1px solid var(--o-line-2);
    border-left: 0;
    border-right: 0;
    text-align: center;
    font-weight: 700;
    padding: 0;
}

.sve-order-line-del {
    flex: 0 0 auto;
    width: 34px;
    height: 38px;
    border: 0;
    background: transparent;
    color: var(--o-ink-3);
    font-size: 20px;
}

.sve-order-line-del:hover {
    color: var(--o-bad-fg);
}

.sve-order-cart-summary {
    margin-top: 10px;
}

.sve-order-sum-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 3px 2px;
    font-size: 14px;
    color: var(--o-ink-2);
}

.sve-order-cart-total {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--o-line-2);
    font-size: 20px;
    font-weight: 800;
    color: var(--o-ink);
}

/* Kundendaten */
.sve-order-customer-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}

.sve-order-field-row {
    min-width: 0;
}

.sve-order-field-row:has(.sve-order-customer-address),
.sve-order-field-row:has(.sve-order-customer-email) {
    grid-column: 1 / -1;
}

.sve-order-field-row label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--o-ink-2);
}

.sve-order-field-row input {
    display: block;
    width: 100%;
    margin-top: 4px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--o-line-2);
    border-radius: var(--o-r);
    background: #fff;
    font-weight: 400;
    color: var(--o-ink);
}

.sve-order-field-row input:focus {
    outline: none;
    border-color: var(--o-orange);
    box-shadow: 0 0 0 3px var(--o-orange-soft);
}

.sve-order-field-row input.sve-order-input-error {
    border-color: var(--o-bad-fg);
    background: #FFF6F5;
}

.sve-order-required {
    color: var(--o-bad-fg);
}

.sve-order-customer-note {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 12px;
    color: var(--o-ink-3);
}

.sve-order-info-note {
    margin-top: 16px;
    padding: 10px 12px;
    border-left: 3px solid var(--o-orange);
    border-radius: 6px;
    background: var(--o-orange-soft);
    font-size: 13px;
    color: var(--o-ink);
}

.sve-order-feedback:empty {
    display: none;
}

.sve-order-feedback {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--o-r);
    background: #fff;
    border: 1px solid var(--o-line);
    font-size: 14px;
    font-weight: 600;
}

.sve-order-feedback.success {
    background: var(--o-ok-bg);
    border-color: var(--o-ok-bg);
    color: var(--o-ok-fg);
}

.sve-order-feedback.error {
    background: var(--o-bad-bg);
    border-color: var(--o-bad-bg);
    color: var(--o-bad-fg);
}

.sve-order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.sve-order-submit-btn,
.sve-order-download-btn {
    flex: 1 1 100%;
    min-height: 50px;
    padding: 10px 16px;
    border: 0;
    border-radius: var(--o-r);
    background: var(--o-orange);
    color: #fff !important;
    font-weight: 700;
    font-size: 16px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sve-order-submit-btn:hover {
    background: var(--o-orange-700);
}

.sve-order-submit-btn:disabled {
    background: var(--o-line-2);
    cursor: not-allowed;
}

.sve-order-submit-btn.loading {
    opacity: 0.75;
    cursor: progress;
}

.sve-order-download-btn {
    background: var(--o-navy);
}

.sve-order-download-btn:hover {
    background: var(--o-navy-2);
}

.sve-order-clear-btn {
    flex: 1 1 100%;
    min-height: 42px;
    border: 1px solid var(--o-line-2);
    border-radius: var(--o-r);
    background: #fff;
    font-weight: 600;
    color: var(--o-ink-2);
}

.sve-order-clear-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sve-order-clear-btn.is-confirm {
    border-color: var(--o-bad-fg);
    color: var(--o-bad-fg);
}

/* ---------- Leiste unten (schmal) ---------- */

.sve-order-bar {
    display: none;
}

.sve-order-widget.is-narrow .sve-order-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--o-navy);
    color: #fff;
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.2);
}

.sve-order-widget-modal:not(.is-modal-open) .sve-order-bar {
    display: none !important;
}

.sve-order-bar-sum {
    flex: 1;
    font-weight: 600;
}

.sve-order-bar-sum strong {
    font-size: 18px;
}

.sve-order-sheet-open {
    min-height: 46px;
    padding: 8px 16px;
    border: 0;
    border-radius: var(--o-r);
    background: var(--o-orange);
    color: #fff;
    font-weight: 700;
}

.sve-order-bar:not(.has-items) .sve-order-sheet-open {
    background: var(--o-navy-2);
}

/* ---------- Schmale Ansicht: Bestellung als Fenster ---------- */

.sve-order-widget.is-narrow .sve-order-layout {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 80px;
}

.sve-order-widget.is-narrow .sve-order-cart-panel {
    display: none;
}

.sve-order-widget.is-narrow.is-sheet-open .sve-order-cart-panel {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100001;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 16px 16px 40px;
    overflow: auto;
}

.sve-order-widget.is-narrow .sve-order-sheet-close {
    display: inline-block;
}

@media (max-width: 640px) {
    .sve-order-modal-dialog {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
        padding: 0 14px 14px;
    }

    .sve-order-inline-panel {
        padding: 0 14px 14px;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .sve-order-customer-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}
