/* ==========================================================================
   NINJA TABLES ORDER TABLE - CSS
   Schwebendes Bestellnotiz-Icon mit Overlay
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Farben anpassbar)
   -------------------------------------------------------------------------- */
:root {
    --nt-order-primary: #8c1c1c;
    --nt-order-primary-dark: #6b1515;
    --nt-order-accent: #c4a64c;
    --nt-order-accent-light: #d4b65c;
    --nt-order-text: #ffffff;
    --nt-order-text-muted: rgba(255, 255, 255, 0.7);
    --nt-order-anrufen: #27ae60;
    --nt-order-danger: #c0392b;
    --nt-order-shadow: rgba(0, 0, 0, 0.3);
    --nt-order-radius: 12px;
}

/* --------------------------------------------------------------------------
   PRODUKT-AUSWAHL-OVERLAY (beim Klick auf Zeile)
   -------------------------------------------------------------------------- */
#nt-order-product-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#nt-order-product-backdrop.active {
    opacity: 1;
    visibility: visible;
}

#nt-order-product-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 90%;
    max-width: 360px;
    background: linear-gradient(135deg, var(--nt-order-primary) 0%, var(--nt-order-primary-dark) 100%);
    border-radius: 16px;
    z-index: 100001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--nt-order-accent);
    overflow: hidden;
}

#nt-order-product-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.nt-order-product-content {
    padding: 25px;
    position: relative;
}

.nt-order-product-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--nt-order-text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.nt-order-product-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nt-order-product-info {
    text-align: center;
    margin-bottom: 25px;
    padding-top: 10px;
}

.nt-order-product-nr {
    display: inline-block;
    background: var(--nt-order-accent);
    color: #000;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 1rem;
    margin-bottom: 12px;
}

.nt-order-product-name {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--nt-order-text);
    margin-bottom: 8px;
    line-height: 1.4;
}

.nt-order-product-preis {
    display: block;
    font-size: 1rem;
    color: var(--nt-order-text-muted);
}

.nt-order-product-qty-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--nt-order-radius);
    padding: 8px;
}

.nt-order-product-qty-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--nt-order-text);
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.nt-order-product-qty-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.nt-order-product-qty-btn.minus:hover {
    background: var(--nt-order-danger);
}

.nt-order-product-qty-btn.plus:hover {
    background: #27ae60;
}

.nt-order-product-qty {
    min-width: 60px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--nt-order-text);
}

.nt-order-product-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--nt-order-text);
}

.nt-order-product-total-row strong {
    color: var(--nt-order-accent);
    font-size: 1.3rem;
}

.nt-order-product-merken {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    background: var(--nt-order-accent);
    border: none;
    border-radius: var(--nt-order-radius);
    color: #000;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nt-order-product-merken:hover {
    background: var(--nt-order-accent-light);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(196, 166, 76, 0.4);
}

.nt-order-product-merken:active {
    transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Backdrop (Hintergrund-Overlay für Warenkorb)
   -------------------------------------------------------------------------- */
#nt-order-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#nt-order-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* --------------------------------------------------------------------------
   Floating Button (schwebendes Warenkorb-Icon)
   -------------------------------------------------------------------------- */
#nt-order-floating-btn {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--nt-order-primary) 0%, var(--nt-order-primary-dark) 100%) !important;
    border: none !important;
    color: var(--nt-order-text) !important;
    cursor: pointer !important;
    z-index: 2147483647 !important; /* Maximaler z-index Wert */
    box-shadow: 0 4px 20px var(--nt-order-shadow) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    /* Verhindere dass Divi oder andere Elemente den Button überdecken */
    isolation: isolate !important;
    contain: layout !important;
}

#nt-order-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px var(--nt-order-shadow);
}

#nt-order-floating-btn:active {
    transform: scale(0.95);
}

#nt-order-floating-btn.pulse {
    animation: nt-order-pulse 0.6s ease;
}

@keyframes nt-order-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Badge (Anzahl-Anzeige) */
#nt-order-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--nt-order-accent);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* SVG und andere Kind-Elemente sollen keine Klicks abfangen */
#nt-order-floating-btn svg,
#nt-order-floating-btn path {
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Overlay (Bestellliste)
   -------------------------------------------------------------------------- */
#nt-order-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    background: linear-gradient(135deg, var(--nt-order-primary) 0%, var(--nt-order-primary-dark) 100%);
    border-radius: 16px;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.4);
    border: 2px solid var(--nt-order-accent);
    overflow: hidden;
}

#nt-order-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Header */
.nt-order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nt-order-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--nt-order-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nt-order-title svg {
    color: var(--nt-order-accent);
}

.nt-order-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--nt-order-text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.nt-order-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Content */
.nt-order-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

/* Leerer Zustand */
#nt-order-leer {
    text-align: center;
    padding: 40px 20px;
    color: var(--nt-order-text-muted);
}

#nt-order-leer svg {
    margin-bottom: 15px;
    opacity: 0.4;
}

#nt-order-leer p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Bestellliste */
#nt-order-liste {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nt-order-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--nt-order-radius);
    border-left: 3px solid var(--nt-order-accent);
    transition: background 0.2s ease;
}

.nt-order-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nt-order-item-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}

.nt-order-item-nr {
    font-weight: 700;
    color: var(--nt-order-accent-light);
    min-width: 40px;
    font-size: 1.5rem;
}

.nt-order-item-name {
    flex: 1;
    color: var(--nt-order-text);
    min-width: 120px;
}

.nt-order-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

/* Mengensteuerung */
.nt-order-item-quantity {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.nt-order-qty-btn {
    background: transparent;
    border: none;
    color: var(--nt-order-text);
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nt-order-qty-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nt-order-qty-btn.minus:hover {
    background: var(--nt-order-danger);
}

.nt-order-qty-value {
    min-width: 30px;
    text-align: center;
    font-weight: 700;
    font-size: 1.3rem;
    color: #27ae60;
}

.nt-order-item-preis {
    font-weight: 600;
    color: var(--nt-order-accent-light);
    min-width: 70px;
    text-align: right;
}

.nt-order-item-remove {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--nt-order-text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nt-order-item-remove:hover {
    background: var(--nt-order-danger);
    color: var(--nt-order-text);
}

/* Footer */
.nt-order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 15px;
    flex-wrap: wrap;
}

#nt-order-summe {
    font-size: 1.1rem;
    color: var(--nt-order-text);
}

#nt-order-summe strong {
    color: var(--nt-order-accent);
    font-size: 1.3rem;
}

.nt-order-footer-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nt-order-btn-anrufen,
.nt-order-btn-anrufen:link,
.nt-order-btn-anrufen:visited,
.nt-order-btn-anrufen:active {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--nt-order-anrufen) !important;
    border: none;
    border-radius: var(--nt-order-radius) !important;
    color: #ffffff !important;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.nt-order-btn-anrufen svg {
    fill: #ffffff !important;
}

.nt-order-btn-anrufen:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.nt-order-btn-leeren {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--nt-order-radius);
    color: var(--nt-order-text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nt-order-btn-leeren:hover {
    background: var(--nt-order-danger);
}

/* --------------------------------------------------------------------------
   Ninja Tables Zeilen-Styling
   -------------------------------------------------------------------------- */
.ninja_table_wrapper tbody tr {
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.ninja_table_wrapper tbody tr:hover {
    background: rgba(196, 166, 76, 0.1) !important;
}

.ninja_table_wrapper tbody tr.nt-order-selected {
    background: rgba(196, 166, 76, 0.2) !important;
    box-shadow: inset 4px 0 0 var(--nt-order-accent);
}

.ninja_table_wrapper tbody tr.nt-order-just-added {
    animation: nt-order-added 0.5s ease;
}

@keyframes nt-order-added {
    0%, 100% { background: rgba(196, 166, 76, 0.2); }
    50% { background: rgba(196, 166, 76, 0.4); }
}

/* --------------------------------------------------------------------------
   Body Lock (wenn Overlay offen)
   -------------------------------------------------------------------------- */
body.nt-order-overlay-open {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
    #nt-order-floating-btn {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }

    #nt-order-overlay {
        width: 95%;
        max-height: 85vh;
    }

    .nt-order-header {
        padding: 15px;
    }

    .nt-order-title {
        font-size: 1.1rem;
    }

    .nt-order-content {
        padding: 12px 15px;
    }

    .nt-order-item {
        padding: 12px;
    }

    .nt-order-item-controls {
        flex-wrap: wrap;
    }

    .nt-order-footer {
        padding: 15px;
        flex-direction: column;
        align-items: stretch;
    }

    #nt-order-summe {
        text-align: center;
    }

    .nt-order-btn-leeren {
        justify-content: center;
    }
}

/* --------------------------------------------------------------------------
   Print Styles (Overlay verstecken beim Drucken)
   -------------------------------------------------------------------------- */
@media print {
    #nt-order-floating-btn,
    #nt-order-overlay,
    #nt-order-backdrop {
        display: none !important;
    }
}
