table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

.table-container {
    border: 2px solid black;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
    overflow: hidden;
    background-color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    word-break: break-word;
}

.table-container table {
    margin-bottom: 0;
    width: 100%;
}

.table-container table:not(:last-child) {
    margin-bottom: 0;
    border-bottom: 1px solid black;
    position: relative;
    z-index: 2;
}

th, td {
    padding: 0.6em 0.8em;
    text-align: center;
}

th {
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 2px solid var(--primary);
}

td.flex-td {
    display: flex;
    align-items: center;
    text-align: left;
    font-size: 0.9em;
}

td a {
    display: block;
    width: 100%;
    height: 100%;
    padding: inherit;
    margin: -0.6em -0.8em;
}

.map-table {
    margin: 0;
}

.map-table td:nth-of-type(1), .map-table td:nth-of-type(1) * {
    font-weight: bold;
}

.map-table td:nth-of-type(2), .map-table td:nth-of-type(2) * {
    font-weight: normal;
}

.pollutant-table {
    table-layout: fixed;
    font-weight: bold;
}

.pollutant-table th {
    background: #fafafa;
}

.pollutant-table th,
.pollutant-table td {
    padding: 8px 12px;
    text-align: center;
}

.pollutant-table th:first-child,
.pollutant-table td:first-child {
    text-align: left;
    width: 20%;
}

.pollutant-table th:not(:first-child),
.pollutant-table td:not(:first-child) {
    width: 20%;
}

.pollutant-table th:first-of-type, .pollutant-table td:first-of-type {
    text-align: left;
}

.pollutant-table tr {
    height: 2.4em;
}

.pollutant-table .loading-wheel img {
    width: 1em;
}

.pollutant-table tr:hover td {
    filter: brightness(0.85);
}

.pollutant-table tr:hover {
    filter: none;
}

.pollutant-table td {
    font-size: 12pt;
}

.pollutant-table td:first-of-type {
    font-weight: bold;
}

.pollutant-table td a {
    font-size: 12pt;
}

.colour-info-table tbody {
    font-size: 0.9em;
    text-align: center;
}

.colour-info-table td {
    width: 50%;
}

.colour-info-table th {
    border-bottom: 1px solid black;
    background-color: #f2f2f2;
    border-top: none;
}

.files-table {
    width: auto;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    background: var(--white);
}

.files-table td:last-child:hover {
    background: var(--lighter-primary);
}

/* Remove top border for th that was causing double thickness */
.pollutant-table th {
    border-top: none;
}

.pollutant-table tr[style*="border-bottom"] {
    border-bottom: 2px solid black;
}

.pollutant-table tr[style*="border-bottom"] td {
    border-bottom: 2px solid black;
}

/* Ensure table header borders are never covered by hover effects */
.pollutant-table tr:hover th {
    filter: none;
}

.pollutant-table tr:hover + tr td {
    border-top: inherit;
}

/* Make sure the hover effect doesn't override border visibility */
.pollutant-table tr:last-child:hover td {
    border-bottom: inherit;
}

@media (max-width: 500px) {
    .table-container, .pollutant-table, .pollutant-table td, .pollutant-table td a {
        font-size: 9pt;
    }
}
