/* Ensure uniform table layout */
table.dataTable {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
}

/* Sticky first column */
table.dataTable tbody td:first-child,
table.dataTable thead th:first-child,
table.dataTable tfoot td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background-color: #ffffff;
    box-shadow: 1px 0 2px rgba(0, 0, 0, 0.1);
}

/* Scrollable table container */
.table-container {
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px; /* added buffer on edges */
}

/* Remove unnecessary scrollbars */
.dataTables_wrapper {
    overflow: hidden !important;
}

.dataTables_scrollBody {
    overflow-x: auto !important; /* Ensure horizontal scroll */
    overflow-y: hidden !important; /* Hide vertical scroll */
}

.dataTables_scrollFoot {
    overflow: hidden !important;
}

/* Table cells styling */
table.dataTable th,
table.dataTable td {
    max-width: 175px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 10px 10px; /* changed from 8px */
    border: 2px solid #ddd;
}

/* Header cell adjustments */
table.dataTable thead th {
    border-bottom: none !important;
    padding: 5px !important;
    margin: 5px !important;
}
/* Combine header row 2 properties */
table.dataTable thead tr:nth-child(2) th {
    border-bottom: 1px solid #ddd !important;
    border-top: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Save button styling */
#saveCsvButton {
    margin-top: 15px;
    display: block;
    width: 150px;
    padding: 10px;
    background-color: #007BFF;
    color: white;
    text-align: center;
    font-size: 14px;
    text-decoration: none;
    border-radius: 5px;
}
#saveCsvButton:hover {
    background-color: #0056b3;
}

/* Hide the default DataTables button container */
.dt-buttons {
    display: none;
}

.climate-flag {
    background-color: #e0f7fa !important; /* Very light blue */
}

/* Remove sorting arrows */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    background-image: none !important;
    cursor: default;
}

/* Last row styling */
#dataTable tbody tr:last-child {
    background-color: #f8f9fa;
    border-top: 2px solid #dee2e6;
}

/* Toggle buttons container */
.toggle-buttons {
    margin: 15px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center; /* center vertically */
}
.toggle-buttons button {
    margin-right: 10px;
    margin-bottom: 10px;
    padding: 8px 16px;
    border: none;
    background-color: #007BFF;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s, border 0.3s;
}
.toggle-buttons button:hover {
    background-color: #0056b3;
}
/* Selected toggle button */
.toggle-buttons button.active {
    background-color: #004080;
    color: #ffffff;
    font-weight: bold;
    border: 2px solid #002f5f;
}
/* Fixed height and vertical centering for buttons */
.toggle-buttons button,
.save-button {
    height: 40px !important;
    box-sizing: border-box;
    padding: 0 16px !important;
    line-height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Select element container */
.select-wrapper {
    position: relative;
    display: inline-block;
    margin: 10px;
}
/* Custom select styling */
.custom-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #007BFF;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    font-size: 16px;
    text-align: center;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.3s ease;
}
.custom-select:hover {
    background-color: #0056b3;
}
/* Remove default arrow */
.select-wrapper::after {
    display: none;
}
.custom-select::-ms-expand {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .select-wrapper {
        width: 100%;
        margin: 5px 0;
    }
    .custom-select {
        font-size: 14px;
        padding: 8px 12px;
    }
    /* Override table container for mobile */
    .table-container {
        white-space: normal;
        padding: 0;
    }
    table.dataTable th,
    table.dataTable td {
        white-space: normal;
        word-break: break-word;
    }
}

/* Global layout */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}
.top-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
}
.left-controls, .center-controls, .right-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.left-controls {
    flex: 1;
    justify-content: flex-start;
}
.center-controls {
    flex: 1;
    justify-content: center;
}
.right-controls {
    flex: 1;
    justify-content: flex-end;
}
.station-wrapper {
    flex: 1 1 100%;
    text-align: center;
}
.table-container {
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px;
}

/* Additional table styling */
.table {
    border-collapse: collapse;
    width: 100%;
}
/* Freeze first column */
.table th:first-child,
.table td:first-child {
    position: sticky;
    left: 0;
    background-color: #fff;
    z-index: 1;
}

/* Save button override */
.save-button {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    margin-left: 10px;
    line-height: 40px !important;
    text-align: center;
    border: none !important;
    background: #007BFF !important;
    color: white !important;
    border-radius: 4px !important;
    display: inline-block !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    vertical-align: middle;
    margin-top: 10px !important;
}
.save-button:hover {
    background: #0056b3 !important;
}

/* Dropdown view styling */
.dropdown-view {
    position: relative;
    display: inline-block;
}
.dropdown-view select.custom-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: none;
    background: #007BFF;
    color: white;
    border-radius: 4px;
    font-size: 14px;
    padding: 0 30px 0 16px;
    line-height: 40px;
    cursor: pointer;
    height: 40px;
}
.dropdown-view i.fa-caret-down {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    pointer-events: none;
    color: white;
}
.menu-selection {
    margin-top: 10px !important;
    /* ...existing styles... */
}

/* Grid layout for mobile */
@media screen and (max-width: 600px) {
    .top-controls {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "station"
            "left"
            "right";
        gap: 8px;
        align-items: center;
    }
    .center-controls {
        grid-area: station;
        width: 100%;
        text-align: center;
    }
    .left-controls {
        grid-area: left;
        justify-content: center;
        flex-wrap: nowrap;
    }
    .left-controls .select-wrapper {
        flex: 1 1 45%;
    }
    .left-controls .select-wrapper:first-child {
        margin-right: 5px;
    }
    .right-controls {
        grid-area: right;
        justify-content: center;
    }
    .select-wrapper {
        width: 100%;
    }
}

/* Sticky table header */
table.dataTable thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
}

/* Info button styling */
.info-button {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    margin-left: 10px;
    margin-top: 10px; /* Changed from 12px to 11px */
    color: #333;
}

/* Info popup overlay and content styling */
.info-popup {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}
.info-popup-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 5px;
    max-width: 400px;
    max-height: 90%;
    overflow-y: auto;
}
.info-popup-content h3 {
    margin-top: 0;
    font-size: 1.5em;
}
.info-popup-content ul {
    list-style-type: disc;
    margin-left: 20px;
}
.close-popup {
    background: #333;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 3px;
    cursor: pointer;
    float: right;
}

/* Summary title styling */
.summary-title {
    text-align: left;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
}
.summary-title-wrapper {
    text-align: left;
    font-size: 24px;
    font-weight: bold;
    padding: 20px;
    background: linear-gradient(to bottom, 
        #ffffff 0%,       /* top: white */
        #e6e6e6 50%,      /* half way: light grey */
        #bfbfbf 75%,      /* 3/4 down: medium grey */
        #7f7f7f 90%,      /* 90% down: darker grey */
        #000000 100%);    /* bottom: black */
    border-bottom: 2px solid #000000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
}

/* Banner container styling */
.summary-banner-container {
    /* Change layout to vertical stacking */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    /* Remove flex-wrap if present */
}
/* Add a bit of padding between the top row and the banner title */
.banner-title {
    margin-top: 10px;
    font-size: 32px; /* increased size */
}
.collapsed-banner {
    font-size: 16px;
}
.collapsed-banner a {
    color: #007BFF;
    text-decoration: none;
    cursor: pointer;
}
.expanded-banner {
    margin-top: 10px;
}
@media (max-width: 600px) {
    .summary-banner-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .banner-title {
        margin-bottom: 10px;
    }
}

/* Mobile adjustments for disabled header options */
@media (max-width: 600px) {
    select.custom-select option:disabled {
        -webkit-appearance: none;
        appearance: none;
        background: transparent;
        border: none;
        padding: 0;
    }
}
