html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

body {
    background-color: #1c1e2a;
    color: #e3e3e4;
}

body.day-mode,
a.leaflet-control-zoom-in.day-mode,
a.leaflet-control-zoom-out.day-mode,
a.leaflet-control-zoom-in.day-mode:hover,
a.leaflet-control-zoom-out.day-mode:hover {
    background-color: #f9f9f9;
    color: #1c1e2a;
}

a.leaflet-control-zoom-in,
a.leaflet-control-zoom-out,
a.leaflet-control-zoom-in:hover,
a.leaflet-control-zoom-out:hover {
    background-color: #27303e;
    color: #e3e3e4;
}

a.leaflet-control-zoom-in.leaflet-disabled,
a.leaflet-control-zoom-out.leaflet-disabled {
    background-color: #a6a6a6;
    color: #e3e3e4;
}

#header {
    height: 5vh; /* 5% of the viewport height */
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes items to the ends */
    padding: 0 30px; /* Adds some padding to the sides */
    background-color: #0e151f;
}

#header.day-mode {
    background-color: #a6a6a6;
}

#header-right{
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 20px;
}

h1 {
    margin: 0;
    padding: 0;
    font-size: 4vh;
}

h2 {
    margin: 0;
    padding: 0;
    font-size: 2.5vh;
}

h3 {
    margin: 0;
    padding: 0;
}

p {
    margin: 0;
    padding: 0;
}

a:link, a:visited {
    color: #e3e3e4;
}

a.day-mode:link, a.day-mode:visited {
    color: #1c1e2a;
}

#selected-state:has(.state-entry) .default-state {
    display: none;
}

#contents {
    flex-grow: 1; /* Fills the remaining space (95% of viewport height) */
    display: flex;
    height: 95vh; /* This is optional with flex-grow, but adds clarity */
}

.state-label {
    display: flex; /* Enable flexbox */
    justify-content: center; /* Horizontal centering */
    align-items: center; /* Vertical centering */
    font-size: 14px; /* Adjust font size */
    font-weight: bold; /* Make text bold */
    color: gray; /* Text color */
    text-align: center; /* Ensure text alignment */

    /* Simulate text stroke using text-shadow */
    text-shadow: -1px -1px 0 white, /* Top-left */ 1px -1px 0 white, /* Top-right */ -1px 1px 0 white, /* Bottom-left */ 1px 1px 0 white; /* Bottom-right */
}

.info.legend {
    background: #27303e;
    padding: 10px;
    line-height: 1.5;
    border: 1px solid #ccc;
}

.info.legend.day-mode {
    background: white;
}

.legend-title {
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    font-size: 14px;
}

#health-map-wrapper {
    position: relative;
    width: 64%;
    height: 100%; /* Fills the entire height of #contents */
}

#health-map {
    width: 100%;
    height: 100%; /* Ensures map fills the wrapper */
}

#data-wrapper {
    width: 36%;
    height: 100%; /* Fills the entire height of #contents */
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 10px;
}

.relation-label {
    font-size: 12px;
    color: black;
    background-color: white;
}
#switch img {
    width: 20px; /* Adjust icon size */
    height: auto;
    vertical-align: middle;
}
#upper-wrapper {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 25%;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

#upper-right {
    width: 70%;
    height: 100%;
}

#graph-wrapper {
    position: relative;
    height: 72%;
}

#filter-wrapper {
    width: 30%;
    height: 100%;
}

#graph-wrapper, #filter-wrapper, #upper-right {
    display: flex;
    flex-direction: column; /* Ensures vertical alignment within */
    background-color: #27303e;
    border-radius: 10px; /* Adjust the value to control roundness */
    padding: 0; /* Optional: adds spacing inside the div for better appearance */
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.05);
}

#graph-wrapper.day-mode, #filter-wrapper.day-mode, #upper-right.day-mode {
    /*display: none;*/
    background-color: white;
}

#state-wrapper {
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: 36%;
    width: 100%;
}

#selected-state {
    display: flex;
    flex-wrap: wrap;
    padding: 10px 0 0 0;
}

.state-entry, .default-state {
    display: flex;
    flex-direction: row;
    align-items: center; /* Vertically centers items */
    gap: 10px; /* Adds space between <p> and <span> */
    background-color: #1c1e2a; /* Dark gray background */
    border-radius: 12px; /* Rounded corners */
    padding: 5px 10px; /* Adds spacing inside the container */
    margin: 0 5px 5px 5px;
}

.state-entry.day-mode, .default-state.day-mode {
    background-color: #dadada; /* Light gray background */
}

.close-btn {
    cursor: pointer;
}

#health-filter {
    height: 5%;
    width: 100%;
    padding: 0 10px;
}

#health-filter.day-mode {
    height: 30%;
    width: 100%;
    padding: 10px 10px 0 10px;
}

#health-dropdown {
    background-color: #1c1e2a;
}

#health-dropdown.day-mode {
    background-color: #f9f9f9;
}

#scatter {
    height: 65%;
    width: 100%;
}

#scatter.day-mode {
    display: none;
}

.x-axis-label {
    fill: #e3e3e4;
}

.x-axis-label.day-mode {
    fill: #1c1e2a;
}

#switch {
    position: absolute; /* Floats the button above the map */
    top: 20px; /* Position from the top of the wrapper */
    right: 20px; /* Position from the right of the wrapper */
    z-index: 1000; /* Ensures the button stays on top of the map */
    padding: 10px 15px;
    background-color: orange;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#switch:hover {
    background-color: darkorange;
}

#switch.day-mode {
    background-color: cornflowerblue;
}

#switch.day-mode:hover {
    background-color: royalblue;
}

/* Back button styles */
#back-button {
    position: absolute;
    top: 100px;
    right: 20px;
    z-index: 1000; /* Ensure it appears on top of the map */
    background-color: rgb(132, 148, 188);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    display: none; /* Initially hidden */
    /*box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);*/
}

#back-button:hover {
    background-color: rgb(83, 91, 105);
}

/* Center the search-wrapper */
#search-wrapper {
    display: flex;
    flex-direction: column; /* Stack search box and suggestions vertically */
    align-items: center; /* Horizontally center */
    position: absolute;
    top: 10px;
    left: 50%; /* Position in the center */
    transform: translateX(-50%); /* Offset by 50% of its width for perfect centering */
    z-index: 1000;
    width: 250px; /* Define a fixed width */
}

/* Style the search box */
#search-box {
    width: 100%; /* Full width inside the wrapper */
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: black;
    outline: none;
}

/* Style the suggestions dropdown */
#search-suggestions {
    width: 100%; /* Match the width of the search box */
    margin-top: 4px; /* Small gap between the box and suggestions */
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-height: 150px;
    color: black;
    overflow-y: auto;
    display: none; /* Hidden by default */
}

/* Style each suggestion */
#search-suggestions div {
    padding: 8px;
    cursor: pointer;
}

#search-suggestions div:hover {
    background-color: #f0f0f0;
}

#map-filter {
    padding: 10px;
    display: flex;
    flex-direction: column;
    width: 100%;
}

#map-filter h4 {
    margin: 0 0 10px 0;
}

.filter-item label {
    margin-left: 5px;
}

.filter-item input[type="checkbox"] {
    margin-right: 5px;
}

#rank-wrapper {
    display: none;
}

#rank-wrapper.day-mode{
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-right: 20px;
    margin-top: 5px;
    text-align: end;
}

#highest-states, #lowest-states {
    flex: 1;
}

#highest-states ul, #lowest-states ul {
    /*padding-left: 20px;*/
    list-style: none; /* Optional: Remove bullet points */
}

#highest-states h4, #lowest-states h4 {
    margin-bottom: 2px;
    font-size: 12px;
    text-align: end;
}

#highest-states ul, #lowest-states ul {
    margin: 0;
    font-size: 10px;
    padding: 0;
}

#bar-graph-wrapper{
    display: none;
    width: 100%;
    height: 80%;
}

#bar-graph-wrapper.day-mode{
    display: block;
}

#bar-graph-wrapper h4{
    margin: 0 10px;
}

#bar-graph{
    width: 100%;
    height: 80%;
}

#loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: #333;
    z-index: 9999;
}

#correlation-tip{
    position: absolute;
    top: 36%;
    left: 50%;
    width: 72%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    text-align: left;
    display: none; /* Hidden by default */
}

#correlation-tip button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    color: white;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

#correlation-tip button:hover {
    color: #ffdddd;
}

.info-button {
    fill: white; /* Button color */
}

.info-button:hover {
    fill: lightblue; /* Highlight when hovering */
}

#sleep-tips h4{
    margin: 10px;
    text-align: center;
}

#sleep-tips li {
    margin-left: 0;
    margin-right: 10px;
    font-size: 12px;
}

#sleep-tips.day-mode {
    display: none;
}
#reset-states {
    display: none; /* Hidden by default */
    font-size: 12px;
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    background-color: #4b63ff;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#reset-states:hover {
    background-color: #1636b5;
}

#tutorials {
    position: absolute;
    top: 5%;
    left: 50%;
    width: 60vw;
    height: 90vh;
    transform: translate(-50%, 0);
    background-color: white;
    color: black;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    text-align: left;
}

#tutorials button {
    position: absolute;
    top: 0;
    right: 15px;
    background: none;
    color: black;
    border: none;
    font-size: 48px;
    font-weight: bold;
    cursor: pointer;
}

#tutorials button:hover {
    color: gray;
}

#tutorials{
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.tutorial-item {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: row;
    max-width: 90%;
    max-height: 20%;
    gap: 20px;
}

.tutorial-item img{
    max-height: 100%;
    max-width: 50%;
}

.tutorial-item p {
    max-height: 100%;
    max-width: 50%;
}

#county-map-tutorial{
    max-width: 90%;
    max-height: 65%;
}