:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --border-color: #333333;
    --hover-color: #1bdf09b4;
    --header-bg: #252525;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}
.container {
    text-align: center;
}
.total {
    font-size: 3em;
    margin: 20px 0;
    cursor: pointer;
    position: relative;
    padding: 20px;
}
.total:hover::after {
    content: 'Click for details';
    font-size: 0.3em;
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.7;
}
.details {
    display: none;
    margin-top: 30px;
}
.details.visible {
    display: block;
}
.table-container {
    resize: vertical;
    min-height: 200px;
    height: 300px;
    overflow-y: auto;
    margin: 20px auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 500px;
}
.table-container:hover {
    border-bottom-width: 3px;  /* Makes the resize handle more visible */
}
table {
    border-collapse: collapse;
    width: 100%;
}
th, td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
}
th {
    background-color: var(--header-bg);
    cursor: pointer;
    user-select: none;
}
th:hover {
    background-color: var(--hover-color);
}
th::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8px;
    vertical-align: middle;
}
th.sort-asc::after {
    content: '▲';
    font-size: 0.8em;
}
th.sort-desc::after {
    content: '▼';
    font-size: 0.8em;
}
tr:hover {
    background-color: var(--hover-color);
}
.history-controls {
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.date-display {
    min-width: 300px;
    display: inline-block;
}
button {
    padding: 8px 16px;
    min-width: 100px;
    background-color: var(--header-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
}
button:hover {
    background-color: var(--hover-color);
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
#output {
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
/* Make the header stick to the top while scrolling */
thead {
    position: sticky;
    top: 0;
    background: var(--header-bg);
}
/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--hover-color);
}
td.percentage {
    text-align: right;
    color: #888;  /* Slightly dimmed percentage */
}
.period-selector {
    margin: 10px 0;
}
.period-selector button {
    min-width: 60px;
}
.period-selector button.active {
    background-color: var(--hover-color);
    border-color: var(--text-color);
}
.total-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.update-button {
    font-size: 0.4em;
    padding: 4px 8px;
    min-width: auto;
    opacity: 0.7;
}
.update-button:hover {
    opacity: 1;
}
.view-toggle {
    margin: 10px 0;
    display: flex;
    gap: 10px;
    justify-content: center;
}
.view-toggle button {
    min-width: 120px;
}
.view-toggle button.active {
    background-color: var(--hover-color);
    border-color: var(--text-color);
}
.n-selector {
    display: none;
}
.view-toggle[data-view="history"] .n-selector {
    display: inline-block;
}
.view-format {
    margin: 5px 0;
    display: flex;
    gap: 10px;
    justify-content: center;
}
.view-format button {
    min-width: 60px;
    padding: 4px 8px;
}
.chart-container {
    height: 300px;
    width: 500px;
    margin: 20px auto;
    resize: vertical;
    min-height: 200px;
    background: var(--bg-color);
}
.device-controls {
    margin: 10px 0;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}
.devices-chart-option {
    display: none;
}

.view-toggle[data-view="history"] ~ .view-format .devices-chart-option,
.view-toggle[data-view="hours"] ~ .view-format .devices-chart-option {
    display: inline-block;
}
.settings-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    justify-content: center;
    font-size: 0.9em;
}

.settings-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

button.active {
    background-color: var(--hover-color);
    border-color: var(--text-color);
}



table.sortable th {
    position: relative;
    padding-right: 18px;
}

.sort-indicator {
    margin-left: 5px;
}

table.sortable th:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
