/* ==========================================================================
   TABLE CONTAINER & WRAPPER
   ========================================================================== */
.table-wrapper, 
.dataTables_wrapper {
    background: var(--card-bg) !important;
    color: var(--text-main);
    border-radius: var(--radius-md);
    padding: 15px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-flat);
    border: 1px solid var(--border-color);
}

/* ==========================================================================
   BASE TABLE STRUCTURE
   ========================================================================== */
table.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed;
    background-color: transparent !important;
    margin: 15px 0 !important;
}

/* Nagłówki */
table.dataTable thead th {
    background-color: var(--bg-color) !important;
    color: var(--text-muted) !important;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 18px 15px !important;
    border-bottom: 2px solid var(--accent-color) !important;
    white-space: nowrap;
}

/* Komórki i Wiersze */
table.dataTable td {
    padding: 8px 10px !important; /* Stały padding naprawia skoki wysokości */
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    word-wrap: break-word;
    vertical-align: middle;
}

/* Efekt kart (jednakowy dla obu trybów, by zachować wysokość) */
table.dataTable tbody tr {
    background-color: var(--card-bg) !important;
    transition: background-color 0.2s;
}

table.dataTable tbody tr:hover {
    background-color: var(--bg-color) !important;
}

/* ==========================================================================
   DEVICE INFO & ACTION BUTTONS
   ========================================================================== */
.device-info {
    font-size: 0.85rem;
    line-height: 1.2;
}

.device-info .label {
    font-weight: bold;
    color: var(--text-muted);
    display: inline-block;
    /*width: 15px; /* Stała szerokość etykiet P:, IP:, S/N: */
}

.device-info .ip-addr {
    font-family: 'Courier New', Courier, monospace;
    color: var(--accent-color);
}

[data-theme="dark"] .device-info .ip-addr {
    color: #60a5fa;
}

.action-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.action-btn:hover {
    transform: scale(1.2);
}

/* ==========================================================================
   STATUS INDICATORS (GLOWING DOTS)
   ========================================================================== */
.status-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.dot {
    height: 10px;
    width: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Zielony - Active */
.dot-active {
    background-color: #4ade80;
    box-shadow: 0 0 5px #4ade80, 0 0 15px rgba(74, 222, 128, 0.5);
    animation: glow-active 2s infinite ease-in-out;
}

/* Czerwony - Inactive */
.dot-inactive {
    background-color: #f87171;
    box-shadow: 0 0 5px #f87171, 0 0 15px rgba(248, 113, 113, 0.5);
    animation: glow-inactive 2s infinite ease-in-out;
}

.text-active { color: #16a34a; }
.text-inactive { color: #dc2626; }

[data-theme="dark"] .text-active { color: #4ade80; }
[data-theme="dark"] .text-inactive { color: #f87171; }

@keyframes glow-active {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); box-shadow: 0 0 8px #4ade80, 0 0 20px rgba(74, 222, 128, 0.7); }
}

@keyframes glow-inactive {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); box-shadow: 0 0 8px #f87171, 0 0 20px rgba(248, 113, 113, 0.7); }
}

/* ==========================================================================
   DATATABLES UI ELEMENTS (SEARCH, PAGINATION)
   ========================================================================== */
.dataTables_length select,
.dataTables_filter input {
    border: 1px solid var(--border-color) !important;
    background-color: var(--bg-color) !important;
    color: var(--text-main) !important;
    border-radius: var(--radius-sm) !important;
    padding: 6px 12px !important;
    margin-bottom: 15px;
    outline: none;
    transition: all 0.3s ease;
}

/* Ensure the arrows on the select are visible */
.dataTables_length select {
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) calc(1em + 2px), calc(100% - 15px) calc(1em + 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    appearance: none;
    padding-right: 30px !important;
}

.dataTables_info, 
.dataTables_length, 
.dataTables_filter label {
    color: var(--text-muted) !important;
    font-size: 0.9rem;
}

.dataTables_paginate .paginate_button {
    color: var(--text-muted) !important;
    border-radius: 5px !important;
}

.dataTables_paginate .paginate_button.current {
    background: var(--accent-color) !important;
    color: white !important;
    border: none !important;
}