/* Nowoczesne styles dla tabeli JSON na ciemnym tle (#000080) */
.json-table-container {
    margin: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #ffffff;
}

/* Pole wyszukiwania */
.json-table-search {
    margin-bottom: 20px;
    width: 300px;
}

.json-table-search-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.2);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* Style dla górnego paska kontrolnego DataTables */
.dataTables_wrapper .dataTables_length {
    margin-bottom: 15px;
    color: #ffffff;
    display: inline-block;
    width: 400px;
}

.dataTables_wrapper .dataTables_length label {
    display: flex;
    align-items: center;
    margin: 0;
    white-space: nowrap;
}

.dataTables_wrapper .dataTables_length select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.2);
    color: #333333 !important;
    margin: 0 5px;
    width: 80px;
}

.dataTables_wrapper .dataTables_length select option {
    color: #333333;
    background-color: #ffffff;
}

/* Układ elementów kontrolnych */
.dataTables_wrapper .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Tabela główna */
#json-data-table {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
    color: #ffffff;
    background-color: transparent;
}

#json-data-table thead th {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 600;
    padding: 16px;
    text-align: left;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#json-data-table tbody tr {
    transition: background-color 0.2s ease;
}

#json-data-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.05);
}

#json-data-table tbody tr:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.1);
}

#json-data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

#json-data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    vertical-align: middle;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal !important;
    hyphens: auto;
}

/* Style dla komórki z ikoną na desktopie */
#json-data-table td.json-table-icon-cell {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    padding: 10px;
}

/* Style dla ikony */
.json-table-icon {
    width: 150px;
    height: 150px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background: transparent;
}

.json-table-no-icon {
    width: 150px;
    height: 150px;
    background: transparent;
    margin: 0 auto;
    position: relative;
}

/* Paginacja */
.dataTables_paginate {
    margin-top: 15px;
    text-align: right;
}

/* Style dla przycisków paginacji */
.dataTables_paginate .paginate_button,
.dataTables_paginate .paginate_button.previous,
.dataTables_paginate .paginate_button.next,
.dataTables_paginate .paginate_button.current {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    padding: 6px 12px !important;
    margin-left: 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dataTables_paginate .paginate_button:hover,
.dataTables_paginate .paginate_button.previous:hover,
.dataTables_paginate .paginate_button.next:hover,
.dataTables_paginate .paginate_button.current:hover {
    color: #000080 !important;
    background: #ffffff !important;
    border-color: #ffffff !important;
}

.dataTables_paginate .paginate_button.current {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #000080 !important;
}

/* Informacje o ilości rekordów */
.dataTables_info {
    margin-top: 15px;
    color: rgba(255, 255, 255, 0.7);
}

/* Komunikaty o błędach */
.json-table-error {
    padding: 16px;
    background-color: rgba(220, 53, 69, 0.2);
    border-left: 5px solid #dc3545;
    margin-bottom: 20px;
    color: #ffffff;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Usunięcie tła i wskaźników sortowania */
#json-data-table thead th.sorting,
#json-data-table thead th.sorting_asc,
#json-data-table thead th.sorting_desc,
#json-data-table thead th.sorting_1,
#json-data-table thead th.sorting_1:after,
#json-data-table thead th.sorting_1:before {
    background: rgba(255, 255, 255, 0.1) !important;
    position: relative !important;
    padding-right: 16px !important;
    border: none !important;
    box-shadow: none !important;
}

#json-data-table thead th.sorting:after,
#json-data-table thead th.sorting_asc:after,
#json-data-table thead th.sorting_desc:after,
#json-data-table thead th.sorting_1:after {
    display: none !important;
    content: none !important;
}

#json-data-table thead th.sorting:before,
#json-data-table thead th.sorting_asc:before,
#json-data-table thead th.sorting_desc:before,
#json-data-table thead th.sorting_1:before {
    display: none !important;
    content: none !important;
}

/* Nadpisanie tła dla sorting_1 z DataTables */
table.dataTable.display tbody tr > .sorting_1,
#json-data-table tbody tr > .sorting_1 {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Zapobieganie łamaniu słów w nazwie */
#json-data-table td[data-label="Nazwa"] {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: normal !important;
    word-wrap: break-word !important;
    max-width: none !important;
    hyphens: none !important;
}

/* Wyrównanie tekstu w opisie do lewej */
#json-data-table td[data-label="Opis"] {
    text-align: left !important;
    padding-left: 15px !important;
}

@media screen and (max-width: 768px) {
    .json-table-icon {
        width: 50px;
        height: 50px;
        background: transparent;
    }

    .json-table-no-icon {
        width: 50px;
        height: 50px;
        background: transparent;
    }
    
    #json-data-table td, 
    #json-data-table th {
        padding: 10px;
    }

    #json-data-table {
        display: block;
        border: none;
    }

    #json-data-table thead {
        display: none;
    }

    #json-data-table tbody {
        display: block;
        border: none;
    }

    #json-data-table tr {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        margin-bottom: 15px;
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        overflow: hidden;
        border: none;
        padding: 10px;
        position: relative;
    }

    /* Ikona */
    #json-data-table tr > td:nth-child(1) {
        width: 50px;
        min-width: 50px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: none;
    }

    /* Nazwa */
    #json-data-table tr > td:nth-child(2) {
        flex: 1;
        min-width: 0;
        padding: 0 10px;
        padding-right: 40px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex;
        align-items: center;
        justify-content: flex-start; /* wyrównanie do lewej */
        text-align: left;
        border: none;
    }

    /* Opis - rozwijany */
    #json-data-table td:nth-child(3) {
        display: none;
        background-color: rgba(0, 0, 0, 0.2);
        margin: 0;
        padding: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        text-align: left;
        width: 100%;
    }

    /* Przycisk rozwijania */
    #json-data-table tr:after {
        content: '+';
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 20px;
        color: #ffffff;
        cursor: pointer;
        transition: transform 0.3s ease;
        width: 24px;
        height: 24px;
        line-height: 24px;
        text-align: center;
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 50%;
    }

    #json-data-table tr.expanded:after {
        transform: translateY(-50%) rotate(45deg);
    }

    #json-data-table tr.expanded td:nth-child(3) {
        display: block;
        width: 100%;
        margin-top: 10px;
    }
    
    /* Style dla komórki z ikoną na mobile */
    #json-data-table td.json-table-icon-cell {
        width: 50px;
        min-width: 50px;
        max-width: 50px;
        padding: 0;
    }
}