/* ==========================================================================
   TABLE & MOBILE VIEW (Strict Mockup Parity - Final Polish)
   ========================================================================== */

.eem-data-view.table-mode {
    width: 100%;
    margin-top: 30px;
}

.eem-table-outer-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    overflow-x: auto;
    /* Enable horizontal scroll */
    border: 1px solid var(--eem-border);
    -webkit-overflow-scrolling: touch;
}

.eem-app-wrapper .eem-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    border: none;
}

/* Header */
.eem-table thead tr {
    border-bottom: 2px solid var(--eem-border);
}

.eem-app-wrapper .eem-table th {
    padding: 18px 20px;
    text-align: left;
    color: #444;
    font-weight: 700;
    font-size: 15px;
    border: none;
    background-color: var(--eem-bg-light, #f5f5f5);
}

/* Rows */
.eem-app-wrapper .eem-table td {
    padding: 15px 20px;
    vertical-align: middle;
    color: #1d2327;
    font-size: 14px;
    border-bottom: 1px solid var(--eem-border);
    border: none;
    /* No vertical lines on desktop */
    text-align: left;
}

.eem-table tbody tr {
    border-bottom: 1px solid var(--eem-border);
    transition: background-color 0.2s;
}

.eem-table-actions-cell {
    text-align: right;
    min-width: 90px;
    white-space: nowrap;
}

.eem-table td:first-child {
    position: relative;
    padding-left: 20px;
}

.eem-table td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background-color: transparent;
    z-index: 10;
}

.eem-table tbody tr:last-child td:first-child .eem-row-stripe {
    border-bottom-left-radius: 11px;
}

/* Column Width Adjustments (Desktop & Tablet only) */
@media (min-width: 800px) {
    .eem-app-wrapper .eem-table th {
        word-break: normal !important;
        overflow-wrap: normal !important;
    }
    
    .eem-app-wrapper .eem-table th:nth-child(1), /* Logo */
    .eem-app-wrapper .eem-table td:nth-child(1) {
        width: 80px;
        min-width: 80px;
    }
    /* Aussteller 24 % statt 29 %: Der Name brauchte die Breite nicht, rechts
       davon blieb viel Leerraum. Die 5 % gehen an die Kategorie-Spalte. */
    .eem-app-wrapper .eem-table th:nth-child(2), /* Aussteller */
    .eem-app-wrapper .eem-table td:nth-child(2) {
        width: 24%;
        min-width: 160px;
    }
    /* 15 % statt 18 %: Die Standort-Pille (nowrap) braucht weniger - reicht
       ein Name nicht, waechst die Spalte ohnehin. Die 3 % gehen an Kategorie. */
    .eem-app-wrapper .eem-table th:nth-child(3), /* Standort */
    .eem-app-wrapper .eem-table td:nth-child(3) {
        width: 15%;
        min-width: 100px;
    }
    .eem-app-wrapper .eem-table th:nth-child(4), /* Stand/Booth */
    .eem-app-wrapper .eem-table td:nth-child(4) {
        min-width: 65px;
        width: 65px;
        white-space: nowrap;
    }
    .eem-app-wrapper .eem-table th:nth-child(5), /* Type */
    .eem-app-wrapper .eem-table td:nth-child(5) {
        width: 10%;
        min-width: 90px;
    }
    /* Kategorie bewusst OHNE width: Als einzige Spalte ohne feste Breite
       bekommt sie in der Tabelle den gesamten Restplatz - damit moeglichst
       viele Pillen nebeneinander passen. Frueher war das die Aktionsspalte,
       die dadurch ~200px breit war, obwohl dort nur noch das Herz steht.
       Das fruehere max-width: 140px ist entfallen - Browser ignorieren es an
       Tabellenzellen ohnehin. */
    .eem-app-wrapper .eem-table th:nth-child(6), /* Category */
    .eem-app-wrapper .eem-table td:nth-child(6) {
        min-width: 120px;
    }

    /* Aktionsspalte nur so breit wie das Herz (36px, siehe .eem-table-heart).
       min-width 0 hebt die 90px/70px aus der Zeit auf, als Pin und Herz
       nebeneinander standen; links nur 8px, rechts bleibt der Zellabstand. */
    .eem-app-wrapper .eem-table .eem-table-actions-cell {
        width: 36px;
        min-width: 0;
        padding-left: 8px;
    }
}

@media (max-width: 799px) {

    .eem-table td:first-child::before,
    .eem-row-stripe {
        display: none;
    }
}

/* Logo & Link */
.eem-table-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 45px;
    text-decoration: none;
    border-radius: 4px;
    overflow: hidden;
    background: #f9f9f9;
    border: 1px solid #eee;
    transition: all 0.2s ease;
}

.eem-table-logo-link:hover {
    border-color: var(--eem-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Eintrag ohne Logo: Aussteller-Icon als dezentes Wasserzeichen hinter dem
   Namen - gleiche Loesung wie beim Kachel-Platzhalter in eem-core.css.
   Gilt fuer Tabelle und mobile Kartenansicht; die Groesse folgt dem Kasten. */
.eem-table-logo-link .eem-table-logo-placeholder {
    position: relative;
}

.eem-table-logo-link .eem-table-logo-placeholder::before {
    content: "";
    position: absolute;
    inset: 12%;
    background-color: #f9f9fa;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 width=%22240%22 height=%22240%22 fill=%22none%22 stroke=%22currentColor%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E %3Ctitle%3EAussteller %28Messestand%29%3C/title%3E %3Cpath d=%22M3 9l1.5-5h15L21 9H3z%22/%3E %3Cpath d=%22M3 9a3 3 0 0 0 6 0a3 3 0 0 0 6 0a3 3 0 0 0 6 0%22/%3E %3Cpath d=%22M5 12v8h14v-8%22/%3E %3Cpath d=%22M10 20v-5h4v5%22/%3E %3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 width=%22240%22 height=%22240%22 fill=%22none%22 stroke=%22currentColor%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E %3Ctitle%3EAussteller %28Messestand%29%3C/title%3E %3Cpath d=%22M3 9l1.5-5h15L21 9H3z%22/%3E %3Cpath d=%22M3 9a3 3 0 0 0 6 0a3 3 0 0 0 6 0a3 3 0 0 0 6 0%22/%3E %3Cpath d=%22M5 12v8h14v-8%22/%3E %3Cpath d=%22M10 20v-5h4v5%22/%3E %3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    pointer-events: none;
}

.eem-table-logo-link .eem-table-logo-placeholder .eem-placeholder-name {
    position: relative;
}

.eem-app-wrapper .eem-table .eem-table-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    border-radius: 0;
}

/* Groesseres Logo auf breiten Bildschirmen: Die Logo-Spalte ist ohnehin
   100px breit (60px Logo + 2 x 20px Abstand). Mit weniger Innenabstand
   passt ein 76 x 57px-Logo (4:3) in dieselbe Spalte, und die Zeilenhoehe
   bleibt praktisch gleich (10 + 57 + 10 statt 15 + 45 + 15).
   Links 12px, damit das Logo nicht an den 6px-Farbstreifen stoesst.
   Erst ab 1101px - darunter ist die Tabelle schon knapp (siehe
   "Medium Screen Optimization"), dort bleibt es bei 60 x 45px. */
@media (min-width: 1101px) {
    .eem-app-wrapper .eem-table td.eem-col-thumb {
        padding: 10px 12px;
    }

    .eem-col-thumb .eem-table-logo-link {
        width: 76px;
        height: 57px;
    }
}


/* Badges */
.eem-badge-blue,
.eem-mobile-type-badge {
    background: var(--eem-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

/* Desktop-Tabelle: Standort als Karten-Button (Pille mit Pin), sofern der
   Aussteller auf der Karte zugeordnet ist - ersetzt den Pin in der
   Aktionsspalte. Umriss in der Primaerfarbe, beim Hover gefuellt wie der
   "Mehr laden"-Button. text-decoration mit !important, weil Themes Links in
   Inhaltsbereichen sonst unterstreichen (siehe .eem-table-pin in eem-core.css).
   nowrap: Die Pille bricht nie um - bei schmaler Tabelle zerriss der Name
   sonst mitten im Wort. Die Standort-Spalte waechst dafuer auf die volle
   Laenge; zwischen 800 und 1100px wird die Pille wie der Typ kleiner. */
.eem-app-wrapper .eem-table a.eem-table-location-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    padding: 4px 12px 4px 8px;
    border: 1px solid var(--eem-primary, #f76b15);
    border-radius: 6px;
    background: #fff;
    color: var(--eem-primary, #f76b15);
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.eem-app-wrapper .eem-table a.eem-table-location-pill:hover,
.eem-app-wrapper .eem-table a.eem-table-location-pill:focus-visible {
    background: var(--eem-primary, #f76b15);
    color: #fff;
}

.eem-table-location-pill .dashicons {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    font-size: 18px;
    line-height: 1;
}

.eem-table-heart {
    background: transparent;
    border: none;
    color: #5a5a5a;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    padding: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    opacity: 1;
    /* Ensure solid on desktop */
}

/* Das Herz ist eine CSS-Maske (.eem-icon-heart, siehe eem-core.css). Die
   svg-Regel bleibt fuer aelteres Markup stehen. Hoehe 32px statt 36px, weil
   das SVG mit 122.88 : 107.41 leicht querformatig ist - so fuellt das Motiv
   die Flaeche, statt von mask-size: contain kleiner gerechnet zu werden. */
.eem-table-heart svg {
    width: 36px;
    height: 36px;
}

.eem-table-heart .eem-icon-heart {
    width: 36px;
    height: 32px;
}

/* Tabellenansicht (Desktop-Zeile und mobile Karte): Herz und Karten-Pin auf ein
   gemeinsames optisches Mass bringen. Die Maske zeichnet ueber ihre volle
   Breite, das Pin-Glyph nur einen Teil seiner Schriftgroesse - deshalb wird das
   Herz hier kleiner und der Pin in eem-core.css groesser.
   Bewusst ueber die Aktions-Container eingegrenzt: Dieselbe Klasse
   .eem-table-heart nutzen auch die Kacheln, die unveraendert bleiben. */
.eem-desktop-actions .eem-table-heart .eem-icon-heart,
.eem-mobile-actions .eem-table-heart .eem-icon-heart {
    width: 28px;
    height: 25px;
}

.eem-table-heart:hover {
    color: #999;
    transform: scale(1.15);
}

.eem-table-heart.active {
    color: var(--eem-primary);
    /* Standardized with Grid view */
}

.eem-badge-gray {
    background: #f0f0f1;
    color: #555;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 6px;
    margin-bottom: 4px;
    border: 1px solid #e0e0e0;
    text-transform: uppercase;
    display: inline-block;
    white-space: nowrap;
}

/* Metadata Display Control */
.eem-mobile-meta-block,
.eem-only-mobile {
    display: none;
}

.eem-mobile-type-badge {
    display: none;
}

.eem-only-desktop {
    display: table-cell;
}

/* Medium Screen Optimization */
@media (max-width: 1100px) and (min-width: 800px) {

    .eem-app-wrapper .eem-table th,
    .eem-app-wrapper .eem-table td {
        padding: 12px 10px;
        font-size: 13px;
    }

    .eem-table-actions-cell {
        min-width: 70px;
    }

    .eem-badge-blue,
    .eem-mobile-type-badge {
        padding: 3px 8px;
        font-size: 11px;
    }

    .eem-badge-gray {
        padding: 2px 7px;
        font-size: 10px;
        margin-right: 4px;
    }

    /* Standort-Pille wie der Typ verkleinern, damit die volle Laenge
       (nowrap) auch in der schmalen Tabelle Platz findet. */
    .eem-app-wrapper .eem-table a.eem-table-location-pill {
        gap: 3px;
        padding: 3px 8px 3px 5px;
        font-size: 11px;
    }

    .eem-table-location-pill .dashicons {
        width: 14px;
        height: 14px;
        font-size: 14px;
    }
}

/* ==========================================================================
   MOBILE VIEW (CARD MOCKUP - Corrected)
   
   WICHTIGER HINWEIS ZUR BEARBEITUNG:
   Dieser Bereich wandelt die klassische Tabelle auf kleinen Bildschirmen
   (unter 800px) in eine kartenbasierte Ansicht um. 
   
   - Alle Tabellenzellen (td, tr, tbody) werden zu Block-Elementen (display: block; width: 100%;).
   - ACHTUNG: Es ist absolut tabu, hier oder global feste Spaltenbreiten 
     (wie z.B. width: 30% oder min-width: 150px für td:nth-child(X)) zu definieren, 
     ohne sie in eine Desktop-Media-Query (@media (min-width: 800px)) einzuschließen! 
     Wenn Desktop-Breiten auf diese Kartenansicht vererbt werden, zerstört das 
     sofort das Layout (Elemente werden extrem schmal zusammengequetscht).
   - Die Kartenansicht nutzt Floats und absolutes Positionieren, um Logo, 
     Texte und Buttons (Herz, Karte) kartenartig anzuordnen.
   ========================================================================== */

@media (max-width: 799px) {
    .eem-table-heart svg {
        width: 32px;
        height: 32px;
    }

    .eem-view-toggles {
        display: none;
    }

    .eem-table-outer-card {
        background: transparent;
        border: none;
        box-shadow: none;
        overflow: visible;
    }

    .eem-table,
    .eem-table tbody,
    .eem-table tr,
    .eem-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .eem-app-wrapper .eem-table thead,
    .eem-app-wrapper .eem-table tfoot {
        display: none;
    }

    .eem-app-wrapper .eem-table tbody {
        display: block;
        border: none;
    }

    .eem-app-wrapper .eem-table {
        border: none;
        border-collapse: separate;
        border-spacing: 0 15px;
        background: transparent;
    }

    .eem-app-wrapper .eem-table tr {
        display: block;
        /* Default background, but NO to allow inline tinting */
        background-color: #fff;
        border-radius: 16px;
        /* Specific borders to allow border-left-color from inline styles */
        border-top: 1px solid var(--eem-border);
        border-right: 1px solid var(--eem-border);
        border-bottom: 1px solid var(--eem-border);
        /* Allow border-left-color from inline styles while forcing width/style */
        border-left-width: 6px;
        border-left-style: solid;
        border-left-color: transparent;

        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.05);
        margin-bottom: 15px;
        padding: 15px;
        position: relative;
        overflow: hidden;
    }

    .eem-app-wrapper .eem-table td {
        border: none;
        background: transparent;
        padding: 0;
        width: auto;
        box-shadow: none;
    }

    /* 1. Logo Column */
    .eem-app-wrapper .eem-table td.eem-col-thumb {
        float: left;
        width: 100px;
        margin-right: 12px;
        margin-bottom: 8px;
    }

    .eem-mobile-logo-wrapper {
        position: relative;
        display: block;
        width: 100px;
    }

    .eem-table-logo-link {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 90px;
        height: 90px;
        border-radius: 12px;
    }

    .eem-mobile-type-badge {
        display: inline-block;
        position: absolute;
        top: -5px;
        /* Offset to look like mockup */
        left: -5px;
        z-index: 10;
        font-size: 10px;
        padding: 3px 8px;
        border-radius: 6px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    /* 2. Content Column */
    .eem-table td.eem-col-content {
        display: block;
        border: none;
        padding-left: 0;
        text-align: left;
    }

    .eem-table-main-info {
        display: block;
        margin-left: 0;
        /* Remove from container to allow children more flow control */
    }

    .eem-table-title,
    .eem-mobile-meta-block {
        display: block;
        margin-left: 112px;
        /* Keep text next to logo */
    }

    .eem-table-title {
        margin-bottom: 6px;
        margin-top: 0;
    }

    .eem-table-name-link {
        font-size: 16px;
        line-height: 1.2;
        word-break: break-word;
        overflow-wrap: break-word;
        display: block;
        max-width: 100%;
    }

    .eem-unclickable-title {
        color: inherit !important;
        text-decoration: none !important;
        cursor: default;
    }

    .eem-mobile-meta-block {
        display: block;
        font-size: 14px;
        color: #646970;
        margin-bottom: 8px;
        line-height: 1.3;
    }

    .eem-badge-wrapper {
        display: flex;
        flex-wrap: wrap;
        gap: 5px 6px;
        margin-top: 5px;
        padding-right: 0;
        line-height: normal;
    }

    .eem-badge-gray,
    .eem-badge {
        display: inline-flex;
        align-items: center;
        margin: 0;
        font-size: 9px;
        padding: 2px 8px;
        line-height: 14px;
        height: 20px;
        box-sizing: border-box;
        border-radius: 50px;
        white-space: nowrap;
    }

    /* Mobile Category Display Limiting */
    .eem-app-wrapper[data-mobile-cats="1"] .eem-badge-wrapper {
        max-height: 20px;
        overflow: hidden;
    }

    .eem-app-wrapper[data-mobile-cats="2"] .eem-badge-wrapper {
        max-height: 45px;
        overflow: hidden;
    }

    .eem-app-wrapper[data-mobile-cats="none"] .eem-badge-wrapper,
    .eem-app-wrapper[data-mobile-cats="0"] .eem-badge-wrapper {
        display: none;
    }

    /* 3. Actions Column - Floating & Semi-Transparent */
    .eem-table td.eem-table-actions-cell {
        position: absolute;
        bottom: 15px;
        right: -15px;
        /* Closer to the right edge */
        top: auto;
        transform: none;
        width: auto;
        height: auto;
        z-index: 30;
        float: none;
        display: flex;
        justify-content: center;
        align-items: center;
        opacity: 0.85;
        /* Slightly more visible */
        transition: opacity 0.3s;
        pointer-events: none;
    }

    .eem-table td.eem-table-actions-cell button,
    .eem-table td.eem-table-actions-cell a {
        pointer-events: auto;
        /* Only buttons are clickable */
    }

    .eem-table tr:hover td.eem-table-actions-cell {
        opacity: 1;
        /* Full opacity on hover */
    }

    .eem-table td.eem-col-content {
        padding-right: 0;
        /* Full width for name and meta */
    }

    .eem-mobile-actions {
        display: flex;
        flex-direction: column;
        /* Map first (top), Heart second (bottom) */
        gap: 8px;
        align-items: center;
    }



    /* Visibility handled within media query */
    .eem-only-mobile {
        display: block;
    }

    .eem-only-desktop {
        display: none;
    }
}

/* =========================================
   SCROLL NAVIGATION ARROWS (Global im Body)
   ========================================= */
html body .eem-scroll-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    z-index: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    color: #333;
}

html body .eem-scroll-arrow.visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

html body .eem-scroll-arrow:hover {
    background-color: var(--eem-primary, #e43d1f);
    color: #fff;
    border-color: var(--eem-primary, #e43d1f);
    transform: translateY(-50%) scale(1.1);
}

html body .eem-scroll-arrow-left {
    left: 20px;
}

html body .eem-scroll-arrow-right {
    right: 20px;
}

html body .eem-scroll-arrow-left::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    border-left: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    transform: rotate(45deg);
    margin-left: 4px;
}

html body .eem-scroll-arrow-right::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    border-right: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    transform: rotate(-45deg);
    margin-right: 4px;
}

/* =========================================
   TABLE ZOOM BUTTON (Global im Body)
   ========================================= */
html body .eem-data-view.eem-table-zoomed {
    zoom: 0.85;
}

html body .eem-table-zoom-btn {
    display: none;
    position: fixed;
    right: 20px;
    top: 50%;
    /* Oberhalb des rechten Navigationspfeils */
    margin-top: -105px;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    padding: 0;
    background-color: #ffffff;
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    z-index: 500;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

html body .eem-table-zoom-btn.eem-zoom-btn-visible {
    display: flex;
}

html body .eem-table-zoom-btn .eem-zoom-icon {
    display: block;
    width: 26px;
    height: 26px;
    pointer-events: none;
}

html body .eem-table-zoom-btn .eem-zoom-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

html body .eem-table-zoom-btn:hover {
    background-color: var(--eem-primary, #e43d1f);
    color: #fff;
    border-color: var(--eem-primary, #e43d1f);
    transform: translateY(-50%) scale(1.1);
}

/* Zoom-Button ausblenden, solange ein Modal offen ist */
html.eem-modal-open .eem-table-zoom-btn,
body.eem-modal-open .eem-table-zoom-btn {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}


