body {
    font-family: sans-serif;
    margin: 20px;
    background-color: #f4f4f4;
}

h1, h2 {
    color: #333;
    text-align: center;
}

.controls {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.controls label {
    font-weight: bold;
}

.controls input[type="date"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.controls button {
    padding: 10px 15px;
    background-color: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

.controls button:hover {
    background-color: #4cae4c;
}

#loading {
    text-align: center;
    padding: 15px;
    font-style: italic;
    color: #555;
}

.error-message {
    color: #d9534f;
    background-color: #f2dede;
    border: 1px solid #ebccd1;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: center;
}

#summary {
    background-color: #fff;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#summary div {
    margin-bottom: 5px;
}

#summary span {
    font-weight: bold;
}

.table-container {
    overflow-x: auto; /* Add horizontal scroll for small screens */
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    white-space: nowrap; /* Prevent wrapping within cells initially */
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
    position: relative; /* Needed for absolute positioning of pseudo-elements */
    cursor: pointer; /* Indicate clickable */
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #f1f1f1;
}

/* Allow specific columns to wrap if needed */
td:nth-child(6), td:nth-child(7) { /* Landing Site, Referring Site */
    white-space: normal;
    word-break: break-all;
}

/* Arrows for sorting indicators */
th::after {
    content: '\00a0\2195'; /* Default up/down arrow, non-breaking space before */
    opacity: 0.3;
    position: absolute;
    right: 8px; /* Adjust spacing as needed */
    top: 50%;
    transform: translateY(-50%);
}

th.sort-asc::after {
    content: '\00a0\25B2'; /* Up arrow */
    opacity: 1;
}

th.sort-desc::after {
    content: '\00a0\25BC'; /* Down arrow */
    opacity: 1;
}
