/**
 * Dynamic Table Styles
 * Styles für die wiederverwendbare Tabellen-Komponente
 */

/* Wrapper */
.dynamic-table-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
}

/* Table + Footer (Pagination / Server-Info) als verbundene Einheit */
.dt-table-section {
    display: flex;
    flex-direction: column;
}

/* Search Bar */
.dt-search-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.dt-search-bar .search-box {
    flex: 1;
    max-width: 400px;
}

/* Actions Bar */
.dt-actions-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Global Search Bar (NEW!) */
.dt-global-search {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    width: 100%;
}

/* Actions Dropdown (left) */
.dt-actions-dropdown {
    position: relative;
    flex-shrink: 0;
    width: 100%; /* Full width on mobile */
    max-width: 200px; /* Limit on desktop */
}

.dt-actions-btn {
    height: 38px; /* Kompakter */
    min-width: 44px;
    width: 100%; /* Full width of container */
    padding: 0 0.75rem; /* Reduziert */
    display: flex;
    align-items: center;
    justify-content: flex-start; /* LINKSBÜNDIG */
    gap: 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9375rem; /* Slightly larger for better readability */
    font-weight: 500;
    white-space: nowrap;
}

.dt-actions-btn span[data-icon] {
    flex-shrink: 0;
}

.dt-actions-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.dt-actions-btn span[data-icon] {
    width: 18px;
    height: 18px;
}

.dt-actions-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 320px;
    width: max-content;
    max-width: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.dt-actions-menu.active {
    display: block;
}

.dt-actions-menu-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.dt-actions-menu-item:last-child {
    border-bottom: none;
}

.dt-actions-menu-item:hover {
    background: var(--primary-color);
    color: white;
}

.dt-actions-menu-item span[data-icon] {
    width: 18px;
    height: 18px;
}

/* Hover-Effekt für gesamte Gruppe */
.dt-search-controls:hover .dt-search-input:not(:focus),
.dt-search-controls:hover .dt-search-column:not(:focus) {
    border-color: var(--primary-color);
}

.dt-search-controls {
    display: flex;
    align-items: center;
    gap: 1px;
    flex: 1;
    max-width: none;
}

/* Refresh Button (right) */
.dt-refresh-btn {
    height: 38px; /* Kompakter */
    min-width: 38px;
    width: 38px; /* Square button */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.dt-refresh-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.dt-refresh-btn:active {
    transform: translateY(0);
}

.dt-refresh-btn span[data-icon] {
    width: 18px;
    height: 18px;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dt-refresh-btn:active span[data-icon] {
    transform: rotate(180deg);
}

.dt-refresh-btn.spinning span[data-icon] {
    animation: spin-refresh 0.6s linear;
}

.dt-refresh-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.dt-refresh-picker {
    position: relative;
}

.dt-refresh-picker-btn {
    height: 38px;
    min-width: 4.75rem;
    padding: 0 0.55rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
}

.dt-refresh-picker-btn:hover,
.dt-refresh-picker-btn:focus {
    border-color: var(--primary-color);
    outline: none;
}

.dt-refresh-picker-btn span[data-icon] {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.dt-refresh-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 7.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    overflow: hidden;
    padding: 0.25rem 0;
}

.dt-refresh-menu.active {
    display: block;
}

.dt-refresh-menu-item {
    display: block;
    width: 100%;
    padding: 0.4rem 0.85rem;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    font-size: 0.8125rem;
    line-height: 1.3;
    cursor: pointer;
}

.dt-refresh-menu-item:hover,
.dt-refresh-menu-item.is-active {
    background: var(--bg-hover);
}

.dt-refresh-menu-item.is-active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Spinning animation for action menu items */
.dt-actions-menu-item [data-icon].spinning {
    animation: spin-continuous 1s linear infinite;
}

@keyframes spin-refresh {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes spin-continuous {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Column Selector Wrapper mit Icon */
.dt-search-column-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 180px;
    flex-shrink: 0;
}

.dt-search-column-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    z-index: 3;
}

.dt-search-column {
    width: 100%;
    height: 38px; /* Kompakter */
    padding: 0 28px 0 40px;
    border: 1px solid var(--border-color);
    border-radius: 0 6px 6px 0;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem; /* Prevents iOS zoom */
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    text-align: left;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

.dt-search-column:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-hover);
}

.dt-search-column:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 59, 130, 246), 0.1);
    z-index: 2;
    position: relative;
}

.dt-search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 300px;
}

.dt-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    z-index: 3;
}

.dt-search-input {
    width: 100%;
    height: 38px; /* Kompakter */
    padding: 0 40px 0 40px;
    border: 1px solid var(--border-color);
    border-radius: 6px 0 0 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem; /* Prevents iOS zoom */
    transition: all 0.2s;
}

.dt-search-input:hover {
    border-color: var(--primary-color);
}

.dt-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 59, 130, 246), 0.1);
    z-index: 2;
    position: relative;
}

.dt-search-clear {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 3;
    border-radius: 4px;
    transition: all 0.2s;
}

.dt-search-clear:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dt-search-clear:active {
    transform: scale(0.95);
}

/* Table Container */
.dt-table-container {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    margin: 0;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.dt-loading-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 5;
    overflow: hidden;
    pointer-events: none;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.dt-loading-bar.is-active {
    opacity: 1;
    transition: opacity 0.12s ease;
}

.dt-loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 55%;
    background: linear-gradient(90deg,
        rgba(var(--primary-color-rgb, 222, 12, 21), 0) 0%,
        rgba(var(--primary-color-rgb, 222, 12, 21), 0.85) 40%,
        var(--primary-color) 50%,
        rgba(var(--primary-color-rgb, 222, 12, 21), 0.85) 60%,
        rgba(var(--primary-color-rgb, 222, 12, 21), 0) 100%);
    box-shadow: 0 0 8px rgba(var(--primary-color-rgb, 222, 12, 21), 0.55);
    transform: translateX(-120%);
    animation: dt-loading-bar 1.8s cubic-bezier(0.45, 0, 0.25, 1) infinite;
    animation-play-state: paused;
}

.dt-loading-bar.is-active::after {
    animation-play-state: running;
}

@keyframes dt-loading-bar {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(200%); }
}

@media (prefers-reduced-motion: reduce) {
    .dt-loading-bar::after {
        width: 100%;
        animation: none;
        transform: none;
        opacity: 0.8;
    }
}

.dt-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    border-spacing: 0;
    line-height: 1.2;
}

/* fixedLayout: true — column widths stay stable when rows are appended */
.dt-table.dt-table--fixed {
    table-layout: fixed;
}

/* columns[].maxWidth — clamp overflowing cell content */
.dt-table th.dt-cell-clamp,
.dt-table td.dt-cell-clamp {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dt-table td.dt-cell-clamp > .dt-cell-text,
.dt-table td.dt-cell-clamp > strong,
.dt-table td.dt-cell-clamp > span:not(.dt-cell-value) {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Keep copyable icon + value on one row inside clamped cells */
.dt-table td.dt-cell-clamp > .dt-cell-copyable {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.dt-table td.dt-cell-clamp > .dt-cell-copyable .dt-cell-value {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

/* Column Headers */
.dt-table th {
    padding: 0 0.5rem !important;
    height: var(--dt-header-height, 24px);
    vertical-align: middle;
    line-height: 1.2;
    font-size: 0.8125rem;
}

.dt-table td {
    padding: 0 0.5rem !important;
    height: var(--dt-row-height, 18px);
    vertical-align: middle;
    font-size: 0.8125rem;
    white-space: nowrap;
    line-height: 1.2;
    border-bottom: 1px solid var(--border-color);
}

/* Override admin-table defaults */
table.admin-table.dt-table th {
    padding: 0 0.5rem !important;
    font-size: 0.8125rem;
}

table.admin-table.dt-table td {
    padding: 0 0.5rem !important;
    font-size: 0.8125rem;
}

/* Compact badges inside table */
.dt-table .badge {
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1;
    vertical-align: middle;
}

/* Compact action buttons inside table (sizing: icons.css .btn-table-action) */
.dt-table .btn-icon {
    padding: 1px 3px;
    font-size: 0.85rem;
}

/* Shared row-actions flex wrapper — use instead of inline gap styles */
.dt-row-actions,
.dt-actions-col .actions,
.dt-table td > div:has(> .btn-table-action) {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    align-items: center;
}

/* Text-Wrapper — single line, no wrapping */
.dt-cell-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

/* Copyable Cell Wrapper */
.dt-cell-copyable {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Text innerhalb von copyable cells ebenfalls mit Line-Clamp */
.dt-cell-value {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    line-height: 1.3;
    max-height: 1.3em;
    flex: 1;
}

/* Clickable cell value */
.dt-cell-clickable {
    cursor: pointer;
    transition: color 0.2s;
}

.dt-cell-clickable:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.dt-copy-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.dt-copy-btn:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.dt-copy-success {
    color: var(--success-color, #10b981) !important;
}

/* Badges innerhalb von dt-cell-text normal anzeigen */
.dt-cell-text .badge,
.dt-cell-value .badge {
    display: inline-block !important;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
}

/* ========== COPY MODAL ========== */

.dt-copy-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.dt-copy-modal-overlay.active {
    opacity: 1;
}

.dt-copy-modal {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 550px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease;
    border: 1px solid var(--border-color);
}

.dt-copy-modal-overlay.active .dt-copy-modal {
    transform: scale(1);
}

.dt-copy-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.dt-copy-modal-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dt-copy-modal-title span[data-icon] {
    color: var(--primary-color);
}

.dt-copy-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.dt-copy-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dt-copy-modal-body {
    padding: 1.5rem;
}

.dt-copy-modal-hint {
    margin: 0 0 0.75rem 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
    text-align: left;
}

.dt-copy-modal-hint kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
    font-family: monospace;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dt-copy-modal-input-wrapper {
    position: relative;
}

.dt-copy-modal-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    transition: all 0.2s;
    cursor: text;
}

.dt-copy-modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 59, 130, 246), 0.1);
}

.dt-copy-modal-input::selection {
    background: var(--primary-color);
    color: white;
}

.dt-copy-modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.dt-copy-modal-btn {
    border-radius: 8px !important;
    padding: 0.625rem 1.5rem !important;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.dt-copy-modal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.dt-copy-modal-btn:active {
    transform: translateY(0);
}

.dt-copy-modal-footer .btn-primary.success {
    background: #10b981 !important;
    border-color: #10b981 !important;
}

/* Dark Mode */
[data-theme="dark"] .dt-copy-modal {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .dt-copy-modal-hint kbd {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.dt-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
}

.dt-sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.dt-sortable:hover {
    background-color: var(--bg-hover);
}

.dt-sort-icon {
    font-size: 0.75rem;
    color: var(--primary-color);
    min-width: 12px;
    text-align: center;
    opacity: 1;
}

.dt-sort-icon:empty {
    opacity: 0;
    visibility: hidden;
}

/* Filter Row */
.dt-filter-row th {
    padding: 0.15rem 0.5rem !important;
    height: var(--dt-filter-height, 30px);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    vertical-align: middle;
}

.dt-filter {
    width: 100%;
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.75rem;
    transition: all 0.2s;
    height: calc(var(--dt-filter-height, 30px) - 0.5rem);
}

.dt-filter:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(222, 12, 21, 0.1);
}

/* Selection Column */
.dt-select-col {
    text-align: center;
}

.dt-select-all,
.dt-row-select {
    cursor: pointer;
    width: 14px;
    height: 14px;
    accent-color: var(--primary-color);
}

/* Actions Column */
.dt-actions-col {
    text-align: center;
}

/* Compact Actions columns — same left inset as the other cells */
.dt-table th[data-key="_actions"],
.dt-table td:has(> .dt-row-actions),
.dt-table td:has(> div > .btn-table-action) {
    padding: 0 0.5rem !important;
    text-align: left;
}

.dt-table th[data-key="_actions"] .dt-header-content {
    justify-content: flex-start;
}

/* Prevent scale transform in table buttons to avoid scrollbar */
.dt-actions-col .btn-icon:hover,
.dt-row-actions .btn-icon:hover {
    transform: none;
}

/* Clickable Rows */
.dt-row-clickable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.dt-row-clickable:hover {
    background-color: var(--bg-hover);
}

/* Pagination */
.dt-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 34px;
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    margin-top: -1px;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Tabelle bekommt unten keine Rundung wenn Pagination drunter hängt */
.dt-table-section .dt-table-container {
    border-radius: 8px 8px 0 0;
}

.dt-pagination-info {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.3;
}

.dt-pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.dt-page-size {
    padding: 0.15rem 0.5rem;
    min-height: 22px;
    height: 22px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
}

.dt-page-btn {
    padding: 0;
    min-height: 22px;
    min-width: 22px;
    width: 22px;
    height: 22px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dt-page-btn span[data-icon] {
    width: 13px;
    height: 13px;
}

.dt-page-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.dt-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dt-page-info {
    padding: 0 0.375rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    /* Global Search responsive */
    .dt-search-controls {
        flex-direction: column;
        max-width: 100%;
        gap: 0.75rem;
    }
    
    .dt-search-input-wrapper {
        width: 100%;
        min-width: 100%;
    }
    
    .dt-search-input {
        border-radius: 6px;
        border-right: 1px solid var(--border-color);
        height: 44px; /* Touch-friendly auf mobile */
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .dt-search-column-wrapper {
        width: 100%;
        min-width: 100%;
    }
    
    .dt-search-column {
        border-radius: 6px;
        height: 44px; /* Touch-friendly auf mobile */
        font-size: 16px; /* Prevents iOS zoom */
    }

    .dt-search-bar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .dt-search-bar .search-box {
        max-width: 100%;
    }
    
    /* Global Search Bar - Mobile */
    .dt-global-search {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
    }
    
    /* Actions Dropdown - Full width on mobile */
    .dt-actions-dropdown {
        width: 100%;
        max-width: 100%;
    }
    
    /* Actions Button - Full width on mobile */
    .dt-actions-btn {
        width: 100%;
        height: 44px;
        font-size: 1rem;
        padding: 0 0.75rem;
        justify-content: flex-start; /* LINKSBÜNDIG auf Mobile */
    }
    
    /* Refresh Button - Larger on mobile */
    .dt-refresh-btn,
    .dt-refresh-picker-btn {
        height: 44px;
    }

    .dt-refresh-btn {
        width: 44px;
        min-width: 44px;
    }
    
    /* Search controls container */
    .dt-search-controls {
        width: 100%;
    }
    
    /* Actions Menu - Better positioning on mobile */
    .dt-actions-menu {
        left: 0;
        right: auto;
        min-width: 100%;
        max-width: 100%;
    }

    /* Pagination - Mobile Layout mit CSS Grid */
    .dt-pagination {
        display: flex;
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.5rem;
        min-height: auto;
    }
    
    /* Info Text (zentriert, kleiner) */
    .dt-pagination-info {
        width: 100%;
        font-size: 0.75rem;
        line-height: 1.3;
        text-align: center;
    }

    /* Controls Container - Grid Layout */
    .dt-pagination-controls {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, 1fr); /* 4 Spalten für Buttons */
        grid-template-rows: auto auto auto;
        gap: 0.25rem 0.25rem;
        row-gap: 0.5rem;
    }
    
    /* Zeile 1: Page Size Dropdown - über alle 4 Spalten */
    .dt-page-size {
        grid-column: 1 / -1; /* Spannt über alle Spalten */
        grid-row: 1;
        width: 100%;
        font-size: 0.875rem;
        padding: 0.5rem;
        min-height: 42px;
        text-align: center;
    }
    
    /* Zeile 2: Navigation Buttons - je 1 Spalte */
    .dt-page-btn:nth-of-type(1) { /* «« */
        grid-column: 1;
        grid-row: 2;
    }
    .dt-page-btn:nth-of-type(2) { /* ‹ */
        grid-column: 2;
        grid-row: 2;
    }
    .dt-page-btn:nth-of-type(3) { /* › */
        grid-column: 3;
        grid-row: 2;
    }
    .dt-page-btn:nth-of-type(4) { /* »» */
        grid-column: 4;
        grid-row: 2;
    }
    
    .dt-page-btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.25rem;
        min-height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Zeile 3: Page Info - über alle 4 Spalten */
    .dt-page-info {
        grid-column: 1 / -1; /* Spannt über alle Spalten */
        grid-row: 3;
        width: 100%;
        font-size: 0.8125rem;
        padding: 0.25rem 0 0 0;
        text-align: center;
        white-space: nowrap;
    }

    .dt-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dt-table {
        min-width: 800px;
    }
}

/* Extra small mobile */
@media (max-width: 480px) {
    /* Pagination - Noch kompakter */
    .dt-pagination {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .dt-pagination-info {
        font-size: 0.7rem;
        line-height: 1.3;
    }
    
    .dt-pagination-controls {
        row-gap: 0.5rem;
        gap: 0.25rem;
    }
    
    /* Page Size bleibt volle Breite */
    .dt-page-size {
        font-size: 0.8125rem;
        padding: 0.5rem;
        min-height: 40px;
    }
    
    /* Buttons kompakter */
    .dt-page-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.8125rem;
        min-height: 40px;
    }
    
    /* Page Info */
    .dt-page-info {
        font-size: 0.75rem;
        padding: 0.25rem 0 0 0;
    }
    
    /* Table - smaller minimum width on tiny screens */
    .dt-table {
        min-width: 600px;
    }
    
    /* Global Search - Compact */
    .dt-global-search {
        padding: 0.75rem 0;
        gap: 0.75rem;
    }
    
    /* Actions Button - Full width */
    .dt-actions-btn {
        height: 40px;
        font-size: 0.9375rem;
    }
    
    /* Refresh Button */
    .dt-refresh-btn,
    .dt-refresh-picker-btn {
        height: 40px;
    }

    .dt-refresh-btn {
        width: 40px;
    }
    
    /* Search controls */
    .dt-search-controls {
        gap: 0.75rem;
    }
    
    .dt-search-input,
    .dt-search-column {
        height: 40px;
        font-size: 16px; /* Prevents iOS zoom */
    }
}

/* Landscape Mobile optimization (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) and (orientation: landscape) {
    /* Pagination - Horizontal Layout für echtes Landscape */
    .dt-pagination {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0.75rem;
        min-height: 40px;
    }
    
    .dt-pagination-info {
        width: auto;
        text-align: left;
        font-size: 0.75rem;
    }
    
    /* Landscape: Zurück zu Flexbox statt Grid */
    .dt-pagination-controls {
        display: flex; /* Override Grid */
        width: auto;
        flex-wrap: nowrap;
        gap: 0.375rem;
    }
    
    /* Page Size schmaler im Landscape */
    .dt-page-size {
        grid-column: auto; /* Reset Grid */
        grid-row: auto;
        width: 90px;
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
        min-height: 38px;
    }
    
    /* Buttons - Reset Grid */
    .dt-page-btn {
        grid-column: auto;
        grid-row: auto;
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
        min-width: 36px;
        min-height: 38px;
    }
    
    /* Page Info inline - Reset Grid */
    .dt-page-info {
        grid-column: auto;
        grid-row: auto;
        width: auto;
        font-size: 0.75rem;
        padding: 0 0.5rem;
    }
}

/* Dark Mode Support */
[data-theme="dark"] .dt-filter,
[data-theme="dark"] .dt-page-size,
[data-theme="dark"] .dt-page-btn {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .dt-sortable:hover {
    background-color: var(--bg-hover);
}

/* ================================================
 * SERVER-SIDE INFINITE SCROLL
 * ================================================ */

/* "Lade weitere Einträge..." Indikator */
.dt-loading-more {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0;
}

.dt-loading-more-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.dt-loading-more-inner .loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: dt-spin 0.8s linear infinite;
}

@keyframes dt-spin {
    to { transform: rotate(360deg); }
}

/* Server Info Bar (z.B. "50 von 1000 Einträgen geladen") */
.dt-server-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 34px;
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Server-Side Elemente: Border-Overlap mit Tabelle */
.dt-table-section .dt-server-info,
.dt-table-section .dt-loading-more {
    margin-top: -1px;
}

.dt-server-info-text {
    color: var(--text-secondary);
    font-weight: 500;
}

.dt-server-info-hint {
    color: var(--primary-color);
    font-size: 0.75rem;
    font-style: italic;
    opacity: 0.85;
}

.dt-server-info-complete {
    color: var(--success-color, #22c55e);
    font-weight: 500;
    font-size: 0.75rem;
}

/* Mobile Anpassungen */
@media (max-width: 768px) {
    .dt-server-info {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.5rem;
        font-size: 0.75rem;
        min-height: 36px;
    }
    
    .dt-loading-more {
        padding: 0.75rem;
    }
    
    .dt-loading-more-inner {
        font-size: 0.8125rem;
    }
}
