/* ===========================================
   Tabellen-Popup für Merkzettel-Funktion
   =========================================== */

/* Hover-Effekt für Tabellenzeilen */
.product-table-row {
    transition: background-color 0.2s ease;
}

.product-table-row:hover {
    background-color: #f0f8e8 !important;
}

/* Popup-Overlay - Desktop Standard
   Hinweis: Wir nutzen hier ID+Klasse für hohe Spezifität, damit wir weniger `!important` brauchen. */
.table-popup-overlay#tablePopupOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    z-index: 100003; /* Höher als alle anderen Elemente (Fancybox: 100002, Modal: 100001) */
    display: none; /* Versteckt wenn nicht aktiv */
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                background-color 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                visibility 0s 1.5s;
    pointer-events: none; /* Verhindert Blockierung wenn nicht sichtbar */
}

.table-popup-overlay#tablePopupOverlay.show {
    display: flex; /* Zeige Overlay wenn show-Klasse aktiv ist */
    opacity: 1;
    visibility: visible;
    background-color: rgba(0, 0, 0, 0.5);
    transition: opacity 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                background-color 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                visibility 0s 0s;
    pointer-events: auto; /* Erlaube Interaktion wenn sichtbar */
    z-index: 100003; /* Sicherstellen dass z-index gesetzt ist */
}

/* Popup-Fenster */
.table-popup {
    background: #faf3c9; /* Neue Hintergrundfarbe statt weiß */
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 1.2rem; /* Reduziert von 1.5rem (25% kleiner) */
    max-width: 300px; /* Reduziert von 400px (25% kleiner) */
    width: 90%;
    position: relative;
    z-index: 100004 !important; /* Höher als Overlay */
    cursor: default; /* Standard-Cursor, nur Header hat move */
    user-select: none; /* Verhindert Textauswahl beim Ziehen */
    /* Sanfte Öffnungsanimation */
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Tooltip z-index erhöhen, damit es über dem Popup erscheint */
.tooltip {
    z-index: 100005 !important; /* Höher als Popup (100004) */
}

/* Pop-3 (Randsteine): 25% breiter + kompakter in der Höhe (~90px weniger) */
.table-popup.popup-randsteine {
    max-width: 342px; /* weitere -3px: rechts noch weniger Leerraum */
    padding: 0.35rem; /* ~30px weniger Gesamthöhe durch weniger Innenabstand */
}

/* Pop-3 (Randsteine): Dimensionen + Stück sollen eng zusammenrücken.
   Wichtig: Auf manchen Seiten greift sonst das globale Flex-Layout der dimensions-row
   (mit flex: 1 pro Feld) und schiebt das Stück-Feld zu weit nach rechts. */
.table-popup.popup-randsteine #tablePopupDimensionsContainer .table-popup-dimensions-row {
    display: grid !important;
    grid-template-columns: 70px 70px 80px 70px; /* Höhe, Breite, Länge, Stück */
    gap: 10px !important;
    align-items: stretch;
    justify-content: center; /* gesamte Eingabefeld-Zeile im Popup zentrieren */
    justify-items: center;   /* Inhalte innerhalb der Grid-Zellen zentrieren */
}

/* Pop-3 (Randsteine): Labels/Infos/Inputs innerhalb der Spalten zentrieren */
.table-popup.popup-randsteine #tablePopupDimensionsContainer .table-popup-dimension-group {
    align-items: center;
    text-align: center;
}

.table-popup.popup-randsteine #tablePopupDimensionsContainer .table-popup-dimension-group .table-popup-label,
.table-popup.popup-randsteine #tablePopupDimensionsContainer .table-popup-dimension-group .table-popup-dimension-info {
    width: 100%;
    text-align: center;
}

/* Pop-3 (Randsteine): Höhe/Breite/Länge + "zw..." etwas weiter nach unten rücken */
.table-popup.popup-randsteine #tablePopupDimensionsContainer .table-popup-dimension-group .table-popup-label {
    margin-top: 40px !important;
}

/* Stück-Gruppe (Label + Input) in Pop-3 ebenfalls zentrieren */
.table-popup.popup-randsteine .table-popup-stueck-group {
    align-items: center;
    text-align: center;
}

.table-popup.popup-randsteine .table-popup-stueck-group .table-popup-label {
    width: 100%;
    text-align: center;
}

/* Oberseite-Gruppe in Pop-3 zentrieren (Label + Dropdown) */
.table-popup.popup-randsteine .table-popup-oberflaeche-group {
    align-items: center;
    text-align: center;
}

.table-popup.popup-randsteine .table-popup-oberflaeche-group label {
    width: 100%;
    text-align: center;
}

.table-popup.popup-randsteine .table-popup-header {
    margin-bottom: 0.35rem;
}

.table-popup.popup-randsteine .table-popup-body {
    margin-bottom: 0.25rem;
}

.table-popup.popup-randsteine .table-popup-info {
    padding: 0.25rem !important;
    margin-bottom: 0.25rem !important;
    font-size: 0.82rem;
}

.table-popup.popup-randsteine #tablePopupDimensionsContainer {
    margin-top: 0.15rem !important;
}

.table-popup.popup-randsteine .table-popup-buttons {
    margin-top: 0.2rem;
}

/* Pop-2 Groß (Mauersteine G2115-G2117): Breiter für einzeilige Eingabe */
.table-popup.popup-mauersteine-gross {
    max-width: 510px;
}

.table-popup-overlay.show .table-popup {
    opacity: 1;
    transform: scale(1) translateY(0);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.table-popup * {
    user-select: text; /* Erlaubt Textauswahl in Input-Feldern */
}

.table-popup input,
.table-popup textarea,
.table-popup button {
    cursor: default; /* Normale Cursor für interaktive Elemente */
}

.table-popup-header {
    font-size: 1rem; /* Reduziert von 1.1rem */
    font-weight: bold;
    color: #000000; /* Schwarze Schrift statt grün */
    margin-bottom: 0.8rem; /* Reduziert von 1rem */
    text-align: center;
    line-height: 1.4;
    position: relative;
    cursor: move; /* Desktop: move-Cursor für Drag */
    padding-right: 2rem; /* Platz für Close-Button */
}

/* Mobile: Kein move-Cursor, da Drag deaktiviert ist */
@media (max-width: 768px) {
    .table-popup-header {
        cursor: default; /* Mobile: Standard-Cursor, da Drag deaktiviert */
    }
}

.table-popup-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.table-popup-header-content > div:first-child {
    font-weight: bold;
}

.table-popup-header-content > div:last-child {
    font-weight: normal;
    font-size: 0.85em; /* Reduziert von 0.9em */
    margin-top: 0.2em;
}

.table-popup-close-btn {
    position: absolute;
    top: 0.5rem; /* Etwas Abstand vom Rand */
    right: 0.5rem; /* Etwas Abstand vom Rand */
    background: #000000 !important; /* Schwarzer Hintergrund */
    border: none;
    border-radius: 6px; /* Abgerundete Ecken */
    color: #ffffff !important; /* Weiße Schrift */
    font-size: 0.85rem; /* Schriftgröße */
    font-weight: 600;
    line-height: 1.2;
    width: 30px !important; /* Feste Breite 30px */
    height: 30px !important; /* Feste Höhe 30px */
    min-width: 30px !important; /* Mindestbreite 30px */
    min-height: 30px !important; /* Mindesthöhe 30px */
    max-width: 30px !important; /* Maximale Breite 30px */
    max-height: 30px !important; /* Maximale Höhe 30px */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important; /* Schwarzer Schatten */
    box-sizing: border-box;
}

.table-popup-close-btn:hover {
    background: #333333 !important; /* Dunkleres Schwarz beim Hover */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4) !important; /* Stärkerer Schatten */
    transform: translateY(-1px); /* Leicht nach oben */
}

.table-popup-close-btn:active {
    transform: translateY(0); /* Zurück beim Klicken */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

.table-popup-close-btn span {
    display: block;
    line-height: 1;
    font-size: 1.2rem;
}

.table-popup-body {
    margin-bottom: 0.8rem; /* Reduziert von 1rem */
}

.table-popup-info {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.6rem; /* Reduziert von 0.75rem */
    margin-bottom: 0.8rem; /* Reduziert von 1rem */
    font-size: 0.85rem; /* Reduziert von 0.9rem */
}

.table-popup-info-item {
    margin-bottom: 0.4rem; /* Reduziert von 0.5rem */
    color: #333;
    font-size: 0.85rem; /* Etwas kleiner */
}

.table-popup-info-item:last-child {
    margin-bottom: 0;
}

.table-popup-info-item strong {
    color: #333;
    margin-right: 0.5rem;
}

.table-popup-article-number {
    color: #333;
    font-weight: bold;
}

.table-popup-label {
    font-weight: 600;
    margin-bottom: 0.4rem; /* Reduziert von 0.5rem */
    display: block;
    color: #333;
    font-size: 0.9rem; /* Etwas kleiner */
}

.table-popup-input {
    width: 50%; /* 50% schmaler (von 100% auf 50%) */
    margin-left: auto;
    margin-right: auto;
    padding: 0.6rem; /* Reduziert von 0.75rem */
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem; /* Reduziert von 1rem */
    margin-bottom: 0.8rem; /* Reduziert von 1rem */
    text-align: center;
    box-sizing: border-box;
    display: block;
}

.table-popup-input:focus {
    outline: none;
    border-color: #70A91E;
}

/* Pop-2: Kürzeres Eingabefeld für Stück (50% kürzer als Pop-1) */
.table-popup-input-stueck {
    width: 37.5% !important; /* 25% größer als vorher (25% -> 37.5%) */
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    padding: 0.6rem !important;
    border: 2px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 0.9rem !important;
    margin-bottom: 0.8rem !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

.table-popup-input-stueck:focus {
    outline: none !important;
    border-color: #70A91E !important;
}

/* Eingabefelder für Dimensionen (Höhe, Breite, Länge) */
.table-popup-dimension-input {
    width: 100%;
    padding: 0.6rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    box-sizing: border-box;
}

.table-popup-dimension-input:focus {
    outline: none;
    border-color: #70A91E;
}

.table-popup-calculated-weight {
    text-align: center;
}

/* Pop-5 (Platten): Wie Randsteine */
.table-popup.popup-platten {
    max-width: 375px;
}

/* Pop-4 (Stufen): Kompaktere Darstellung */
.table-popup.popup-stufen {
    max-width: 500px; /* Etwas schmaler */
    padding: 0.65rem; /* noch kompakter (spart Höhe ~50px über mehrere Bereiche) */
}

/* Pop-4: Innenabstände reduzieren (nur Stufen) */
.table-popup.popup-stufen .table-popup-info {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.table-popup.popup-stufen #tablePopupDimensionsContainer {
    margin-top: 0.5rem !important;
}

.table-popup.popup-stufen .table-popup-dimensions-row {
    margin-bottom: 0.5rem;
}

.table-popup.popup-stufen .table-popup-header {
    margin-bottom: 0.55rem;
}

/* Spezifische Styles für Pop-4 Inputs (kompakter) */
.table-popup.popup-stufen .table-popup-dimension-input {
    width: 90px !important; /* Schmaler für ca. 8 Zahlen */
    padding: 0.4rem; /* Weniger Padding */
    font-size: 0.85rem; /* Kleinere Schrift */
}

.table-popup.popup-stufen .table-popup-dimension-group {
    flex: 0 0 auto; /* Verhindert das Strecken */
    width: auto;
    margin-right: 0.5rem; /* Kleiner fixer Abstand */
    /* Überschriften/Infos zentrieren (nur Pop-4) */
    align-items: center;
    text-align: center;
}

.table-popup.popup-stufen .table-popup-dimension-info {
    text-align: center !important;
}

/* "Stück:" Label in Pop-4 zentrieren */
.table-popup.popup-stufen .table-popup-stueck-group label {
    text-align: center;
}

.table-popup.popup-stufen .table-popup-dimensions-row {
    justify-content: flex-start; /* Links bündig statt space-between */
    gap: 0; /* Gap über margin-right geregelt */
    position: relative; /* Für Positioning */
}

/* Layout für Stufen-Oberflächen (4 Dropdowns) */
#tablePopupStufenOberflaechen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem; /* Kleinerer Abstand */
    justify-content: space-between;
    margin-top: 0.8rem;
}

/* Override für Stufen-Dropdown-Gruppen */
#tablePopupStufenOberflaechen .table-popup-oberflaeche-group {
    margin-left: 0 !important;
    width: 48% !important; /* 2 pro Zeile */
    margin-bottom: 0;
}

/* Pop-4 (Stufen): Oberflächen-Dropdown-Blöcke komplett zentrieren (Label + Select) */
.table-popup.popup-stufen #tablePopupStufenOberflaechen .table-popup-oberflaeche-group {
    align-items: center;
    text-align: center;
}

/* Pop-4 (Stufen): Labels der 4 Oberflächen-Dropdowns zentrieren */
.table-popup.popup-stufen #tablePopupStufenOberflaechen .table-popup-oberflaeche-group label {
    display: block;
    width: 100%;
    text-align: center !important;
}

/* Kompakteres Dropdown für Stufen (40% schmaler) */
#tablePopupStufenOberflaechen .table-popup-select-small {
    width: 60% !important; /* Reduziert auf 60% */
    padding: 0.4rem !important; /* Kompakteres Padding */
    font-size: 0.85rem !important; /* Kleinere Schrift */
}

/* Pop-4 (Stufen): Select in der Gruppe mittig ausrichten */
.table-popup.popup-stufen #tablePopupStufenOberflaechen .table-popup-select-small {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Pop-4 (Stufen): "Fase an" Label zentrieren */
.table-popup.popup-stufen #tablePopupFaseContainer .table-popup-label {
    display: block;
    width: 100%;
    text-align: center !important;
}

/* Container für Dimensionen-Felder nebeneinander (Pop-3) */
.table-popup-dimensions-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.table-popup-dimension-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.table-popup-dimension-group label {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #333;
    font-size: 0.9rem;
}

.table-popup-dimension-group .table-popup-dimension-input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 0;
    box-sizing: border-box;
    min-width: 0; /* Wichtig für Flexbox */
}

.table-popup-dimension-group .table-popup-dimension-input:focus {
    outline: none;
    border-color: #70A91E;
}

/* Info-Text über Dimensionen-Eingabefeldern */
.table-popup-dimension-info {
    font-size: 0.75rem;
    color: #666;
    font-weight: normal;
    margin-bottom: 0.25rem;
    text-align: left;
}

/* Stück-Eingabefeld und Oberseite-Dropdown nebeneinander (Pop-3) */
.table-popup-stueck-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

/* Stück-Gruppe (Label + Eingabefeld) */
.table-popup-stueck-group {
    display: flex;
    flex-direction: column;
    width: 135px; /* 25% kleiner als 180px */
}

/* Spezifisch für Stufen: Schmalere Stück-Gruppe, OBEN RECHTS */
.table-popup.popup-stufen .table-popup-stueck-group {
    width: auto !important;
    position: absolute;
    top: 260px; /* 0.2rem weiter nach unten (von 257px auf 260px) */
    right: 2.5rem;   /* 0.5rem weiter nach links (von 2rem auf 2.5rem) */
    margin: 0;
    align-items: center;
    flex-direction: row; /* Nebeneinander */
    gap: 0.5rem;
    z-index: 100005; /* Sicherstellen, dass es über anderen Elementen liegt */
}

.table-popup.popup-stufen .table-popup-stueck-group label {
    margin-bottom: 0; /* Kein Abstand nach unten bei row-layout */
    font-weight: 600; /* Fett wie andere Labels */
    white-space: nowrap; /* Kein Umbruch */
}

/* Oberseite-Gruppe (Label + Dropdown) */
.table-popup-oberflaeche-group {
    display: flex;
    flex-direction: column;
    width: 135px; /* 25% kleiner als 180px */
    margin-left: 3rem; /* Noch weiter nach rechts verschieben */
}

.table-popup-oberflaeche-group label {
    font-weight: normal; /* Keine Fettschrift */
    margin-bottom: 0.4rem;
    color: #333;
    font-size: 0.9rem;
}

/* Kleines Stück-Eingabefeld (gleiche Breite wie Oberseite-Dropdown) */
.table-popup-input-stueck-small {
    width: 135px !important;
    max-width: 135px !important;
    padding: 0.5rem !important;
    border: 2px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 0.9rem !important;
    text-align: center !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

/* Spezifisch für Stufen: Schmaleres Stück-Input (für ca. 6 Zahlen) */
.table-popup.popup-stufen .table-popup-input-stueck-small {
    width: 80px !important;
    max-width: 80px !important;
    padding: 0.4rem !important;
    font-size: 0.85rem !important;
}

.table-popup-input-stueck-small:focus {
    outline: none !important;
    border-color: #70A91E !important;
}

/* Oberseite-Dropdown (25% kleiner als vorher: 180px -> 135px) */
.table-popup-select-small {
    width: 135px !important;
    max-width: 135px !important;
    padding: 0.5rem !important;
    border: 2px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 0.9rem !important;
    background-color: white !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
}

.table-popup-select-small:focus {
    outline: none;
    border-color: #70A91E;
}

/* Styles für den Mauerrechner (G2115-G2117) */
.wall-calculator-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 1rem;
    width: 100%;
}

.wall-calculator-label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    margin-right: 1rem;
    white-space: nowrap;
    min-width: 180px;
}

.wall-calculator-input {
    width: 90px !important; /* Schmales Eingabefeld für ~8 Zahlen */
    padding: 0.5rem !important;
    border: 2px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 0.9rem !important;
    text-align: center !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    display: inline-block !important;
}

.wall-calculator-input:focus {
    outline: none !important;
    border-color: #70A91E !important;
}

.table-popup-buttons {
    display: flex;
    gap: 0.6rem; /* Reduziert von 0.75rem */
    justify-content: center;
}

.table-popup-btn {
    padding: 0.6rem 1.2rem; /* Reduziert von 0.75rem 1.5rem */
    border: none;
    border-radius: 4px;
    font-size: 0.85rem; /* Reduziert von 1rem */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.table-popup-btn-submit {
    background-color: #70A91E;
    color: white;
}

.table-popup-btn-submit:hover {
    background-color: #5a8a16;
}

.table-popup-btn-cancel {
    background-color: #dc3545;
    color: white;
}

.table-popup-btn-cancel:hover {
    background-color: #c82333;
}

/* Mobile Anpassungen */
@media (max-width: 768px) {
    /* Popup-Overlay auf Mobile: nicht zentriert, sondern von oben mit Abstand */
    .table-popup-overlay {
        align-items: flex-start; /* Von oben statt zentriert */
        padding-top: 2.5rem; /* Ca. 2.5 cm Abstand von oben (0.5 cm mehr) */
        justify-content: center; /* Horizontal zentriert */
        z-index: 99999 !important; /* Sehr hoher z-index für Mobile */
        display: none !important; /* Versteckt wenn nicht aktiv - Mobile */
    }
    
    .table-popup-overlay.show {
        display: flex !important; /* Zeige Overlay wenn show-Klasse aktiv ist - Mobile */
        /* Verhindere Zoom durch Touch-Action */
        touch-action: manipulation;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important; /* Erlaube Interaktion wenn sichtbar - Mobile */
    }
    
    .table-popup {
        padding: 1.2rem; /* Größer für bessere Lesbarkeit */
        max-width: 90%; /* Größer auf Mobile (von 50% auf 90%) */
        width: 90%; /* Explizite Breite */
        font-size: 1.3rem !important; /* Größere Schrift (von 1.1rem auf 1.3rem erhöht) */
        margin-top: 0; /* Kein zusätzlicher Margin */
        z-index: 100000 !important; /* Sehr hoher z-index für Mobile */
        /* Animation auch auf Mobile sicherstellen - WICHTIG: Transition muss hier sein */
        opacity: 0;
        transform: scale(0.9) translateY(0); /* Keine vertikale Verschiebung */
        transition: opacity 0.6s ease-out, 
                    transform 0.6s ease-out;
        /* Bessere Touch-Interaktion auf Mobile */
        touch-action: manipulation;
        -webkit-overflow-scrolling: touch;
        /* Verhindere Verschiebung durch transform bei interaktiven Elementen */
        will-change: opacity, transform;
        /* Sicherstellen, dass Popup sichtbar ist */
        visibility: visible !important;
        display: block !important;
        /* Positionierung korrigieren */
        position: relative;
        box-sizing: border-box;
    }
    
    /* Mobile Anpassung für Mauerrechner */
    .wall-calculator-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .wall-calculator-label {
        margin-bottom: 0.5rem;
    }
    
    .wall-calculator-input {
        width: 100% !important;
    }
    
    .table-popup-overlay.show .table-popup {
        opacity: 1 !important;
        transform: scale(1) translateY(0) !important;
        visibility: visible !important;
    }
    
    /* Sicherstellen, dass interaktive Elemente korrekt positioniert sind */
    .table-popup input,
    .table-popup button {
        position: relative;
        z-index: 10;
        /* KEINE Transform - verhindert Verschiebung */
        transform: none !important;
        -webkit-transform: none !important;
        /* Korrekte Positionierung */
        box-sizing: border-box;
    }
    
    /* Close-Button Position korrigieren */
    .table-popup-close-btn {
        position: absolute !important;
        top: 0.5rem !important;
        right: 0.5rem !important;
        transform: none !important;
        -webkit-transform: none !important;
        z-index: 20 !important;
        background: #000000 !important; /* Schwarzer Hintergrund */
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important; /* Schwarzer Schatten */
    }
    
    .table-popup-close-btn:hover {
        background: #333333 !important; /* Dunkleres Schwarz beim Hover */
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4) !important;
    }
    
    .table-popup-header {
        font-size: 1.3rem !important; /* Größere Schrift (von 1.1rem auf 1.3rem erhöht) */
        margin-bottom: 1rem; /* Mehr Abstand */
    }
    
    .table-popup-header-content > div:last-child {
        font-size: 0.95em !important; /* Größer (von 0.85em auf 0.95em erhöht) */
    }
    
    .table-popup-body {
        margin-bottom: 1rem; /* Mehr Abstand */
    }
    
    .table-popup-info {
        padding: 0.6rem; /* Größer */
        margin-bottom: 1rem; /* Mehr Abstand */
        font-size: 1.15rem !important; /* Größere Schrift (von 0.95rem auf 1.15rem erhöht) */
    }
    
    .table-popup-label {
        font-size: 1.2rem !important; /* Größere Schrift (von 1rem auf 1.2rem erhöht) */
        margin-bottom: 0.8rem !important; /* MEHR Abstand nach unten (von 0.3rem auf 0.8rem erhöht) - verhindert Überdeckung durch Input */
    }
    
    .table-popup-input {
        padding: 0.1rem 0.6rem 0.9rem 0.6rem !important; /* WENIGER oben (0.1rem), MEHR unten (0.9rem) - Cursor nach oben verschieben */
        font-size: 18px !important; /* Kleinere Schrift für kleineren Cursor (von 22px auf 18px reduziert) - passt besser ins Fenster */
        margin-bottom: 0.6rem; /* Reduziert */
        margin-top: -0.5rem !important; /* Leichter negativer Margin - Cursor korrekt positioniert beim Start (nicht zu weit unten) */
        width: 50% !important; /* 50% schmaler */
        margin-left: auto; /* Zentriert */
        margin-right: auto; /* Zentriert */
        display: block; /* Block-Element für Zentrierung */
        /* Verhindere Zoom beim Fokus */
        -webkit-appearance: none;
        -moz-appearance: textfield;
        /* Bessere Touch-Interaktion */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        box-sizing: border-box;
        text-align: center !important; /* Text horizontal zentriert - WICHTIG für Cursor-Position */
        /* Positionierung korrigieren - verhindere Verschiebung - WICHTIG: Fixiert beim Drag */
        position: relative !important;
        transform: none !important;
        -webkit-transform: none !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        /* Verhindere Scroll-Offset */
        scroll-margin: 0 !important;
        scroll-padding: 0 !important;
        /* Cursor-Position korrigieren - WICHTIG: line-height 1.0 für bessere vertikale Position */
        line-height: 1.0 !important; /* 1.0 für bessere Cursor-Position (näher am oberen Rand) */
        height: auto !important; /* Automatische Höhe */
        /* Verhindere Layout-Verschiebung - WICHTIG: Fixiert beim Drag */
        will-change: auto !important;
        /* WICHTIG: Verhindere dass Popup-Transform die Cursor-Position beeinflusst */
        isolation: isolate !important; /* Erstellt neuen Stacking Context */
        contain: layout style paint !important; /* Verhindert Layout-Verschiebung */
        /* Cursor sichtbar machen */
        caret-color: #000 !important; /* Schwarzer Cursor für bessere Sichtbarkeit */
        color: #000 !important; /* Schwarzer Text */
        /* Cursor horizontal zentrieren */
        padding-left: 0.6rem !important;
        padding-right: 0.6rem !important;
        /* WICHTIG: Fixiere Position auch beim Drag des Popups */
        position: relative !important;
        z-index: 1 !important; /* Sicherstellen dass Input über anderen Elementen liegt */
    }
    
    /* Verhindere Zoom beim Fokus auf Input-Feld */
    .table-popup-input:focus,
    .table-popup-input:active {
        font-size: 18px !important; /* Kleinere Schrift für kleineren Cursor (von 22px auf 18px reduziert) */
        outline: 2px solid #70A91E;
        outline-offset: -2px;
        text-align: center !important; /* Text horizontal zentriert beim Fokus - WICHTIG für Cursor */
        /* Position bleibt stabil - KEINE Änderung beim Focus */
        position: relative !important;
        transform: none !important;
        -webkit-transform: none !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        margin-top: -0.5rem !important; /* Gleicher Margin wie normal */
        margin-bottom: 0.6rem !important; /* Stabil halten */
        padding: 0.2rem 0.6rem 0.8rem 0.6rem !important; /* Gleiches Padding wie normal */
        padding-left: 0.6rem !important; /* Cursor horizontal zentrieren */
        padding-right: 0.6rem !important; /* Cursor horizontal zentrieren */
        /* Cursor-Position stabil halten - WICHTIG: line-height 1.0 */
        line-height: 1.0 !important; /* 1.0 für korrekte Cursor-Position */
        height: auto !important; /* Automatische Höhe */
        /* Verhindere Layout-Verschiebung */
        will-change: auto !important;
        /* Cursor sichtbar machen beim Focus */
        caret-color: #000 !important; /* Schwarzer Cursor für bessere Sichtbarkeit */
        color: #000 !important; /* Schwarzer Text */
    }
    
    /* Verhindere Verschiebung beim Tippen */
    .table-popup-input:valid,
    .table-popup-input:invalid {
        position: relative !important;
        transform: none !important;
        -webkit-transform: none !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        margin-top: -0.8rem !important; /* Gleicher negativer Margin */
        margin-bottom: 0.6rem !important;
        padding: 0.2rem 0.6rem 0.8rem 0.6rem !important; /* Gleiches Padding */
        padding-left: 0.6rem !important; /* Cursor horizontal zentrieren */
        padding-right: 0.6rem !important; /* Cursor horizontal zentrieren */
        font-size: 18px !important; /* Kleinere Schrift für kleineren Cursor */
        text-align: center !important; /* Text horizontal zentriert */
        line-height: 1.0 !important; /* 1.0 für korrekte Cursor-Position */
        height: auto !important; /* Automatische Höhe */
    }
    
    /* Pop-2: Kürzeres Eingabefeld für Stück auf Mobile */
    .table-popup-input-stueck {
        width: 37.5% !important; /* 25% größer als vorher (25% -> 37.5%) */
        padding: 0.1rem 0.6rem 0.9rem 0.6rem !important;
        font-size: 18px !important;
        margin-bottom: 0.6rem;
        margin-top: -0.5rem !important;
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
        text-align: center !important;
        position: relative !important;
        transform: none !important;
        -webkit-transform: none !important;
        box-sizing: border-box !important;
        line-height: 1.0 !important;
        height: auto !important;
        caret-color: #000 !important;
        color: #000 !important;
    }
    
    .table-popup-input-stueck:focus,
    .table-popup-input-stueck:active {
        font-size: 18px !important;
        outline: 2px solid #70A91E;
        outline-offset: -2px;
        text-align: center !important;
        position: relative !important;
        transform: none !important;
        -webkit-transform: none !important;
        width: 25% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    .table-popup-buttons {
        flex-direction: column;
        gap: 1.4rem; /* Nochmal um 0.5 cm vergrößert (von 0.9rem auf 1.4rem) */
        /* Sicherstellen, dass Buttons korrekt positioniert sind */
        position: relative;
        z-index: 1;
        align-items: center; /* Buttons zentrieren */
    }
    
    .table-popup-btn {
        width: 50% !important; /* 50% schmaler */
        padding: 0.75rem 1rem; /* Größer für besseres Touch-Target (mindestens 44px Höhe) */
        font-size: 1.1rem !important; /* Größere Schrift (von 0.9rem auf 1.1rem erhöht) */
        /* Bessere Touch-Interaktion */
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        min-height: 44px; /* Mindesthöhe für Touch-Targets */
        box-sizing: border-box;
        /* Verhindere Verschiebung durch transform */
        position: relative;
        z-index: 2;
    }
    
    .table-popup-close-btn {
        top: 0.5rem !important; /* Angepasst */
        right: 0.5rem !important; /* Angepasst */
        width: 30px !important; /* Feste Breite 30px */
        height: 30px !important; /* Feste Höhe 30px */
        min-width: 30px !important; /* Mindestbreite 30px */
        min-height: 30px !important; /* Mindesthöhe 30px */
        max-width: 30px !important; /* Maximale Breite 30px */
        max-height: 30px !important; /* Maximale Höhe 30px */
        font-size: 0.85rem !important;
        padding: 0 !important;
        transform: none !important; /* Keine Transform */
        background: #000000 !important; /* Schwarzer Hintergrund */
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important; /* Schwarzer Schatten */
        box-sizing: border-box !important;
    }
    
    .table-popup-close-btn:hover {
        background: #333333 !important; /* Dunkleres Schwarz beim Hover */
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4) !important;
    }
    
    .table-popup-close-btn span {
        font-size: 1.3rem !important; /* Größere Icon-Größe (von 1.1rem auf 1.3rem erhöht) */
    }
}
