:root {
    --primary-color: #1a1a1a;
    --bg: rgb(255, 252, 240);
    --bg-2: rgb(242, 240, 229);
    --tx: rgb(16, 15, 15);
    --re: rgb(175, 48, 41);
    --re-2: rgb(209, 77, 65);
    --or: rgb(188, 82, 21);
    --ye: rgb(173, 131, 1);
    --gr: rgb(102, 128, 11);
    --cy: rgb(36, 131, 123);
    --bl: rgb(32, 94, 166);
    --bl-2: rgb(67, 133, 190);
    --pu: rgb(94, 64, 157);
    --ma: rgb(160, 47, 111);
    --ui: rgb(230, 228, 217);
    --ui-2: rgb(218, 216, 206);
    --ui-3: rgb(206, 205, 195);
}

* {
    margin: 0;
    padding: 0;
}

body {
    padding: 0;
    margin: 0;
    font-family: "Libre Baskerville", serif;
    color: var(--tx);
}

html, body, #map {
    height: 100%;
    width: 100vw;
    font-size: 1rem;
}

p {
    margin-bottom: 1em;
    
}

h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.25rem;
}

.leaflet-container a {
    color: var(--cy);
}

.leaflet-container a:hover {
    text-decoration: underline;
}

.icon {
    width: 1.4rem;
    height: 1.4rem;
    vertical-align: middle;
    color: #dcd8c0;
}

.btn {
    font-family: "Libre Baskerville", serif;
    background-color: var(--bl);
    color: rgb(255, 252, 240);
    text-align: center;
    border: 1px solid transparent;
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.btn:hover {
    background-color: var(--bl-2);
    color: rgb(255, 252, 240);
}

#mode-select {
    width: 100%;
}

.sidebar-wrapper h3{
    text-align: center;
    margin-bottom: 0.25rem;
}

/* Race and year controls wrapper */
.year-race-dropdown-wrapper {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
}

.control-wrapper {
    display: none;
    align-items: center;
    gap: 5px;
    margin-bottom: 1rem;
}

.control-wrapper.active {
    display: flex;
}

/* Custom dropdown controls */
.dropdown-toggle::after {
    content: "▾";
}
.dropdown-group {
    position: relative; /* anchor for the panel */
}

.dropdown-panel {
    display: none;
    position: absolute; /* float above the page */
    top: 100%;          /* directly below the toggle button */
    left: 0;            /* aligned to the left edge of the toggle button */
    margin-top: 2px;    /* Adds margin between group btn and panel */
    z-index: 1000;      /* Top layer of viewport */
    overflow-y: auto;   /* For small screens */
    max-height: 90vh;   /* For small screens */
    background-color: var(--bg);
    color: var(--bl);
    text-align: left;
    padding: 0.5rem 0px;
    border: 2px solid var(--ui);
    border-radius: 0.25rem;
}

.dropdown-panel.open {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dropdown-header {
    padding: 0.5rem 1rem;
}

.dropdown-item {
    cursor: pointer;
    color: var(--bl);
    padding: 0.25rem 1rem;
}

.leaflet-container a.dropdown-item {
  color: var(--bl);
  text-decoration: none;
}

.dropdown-item:hover {
    background-color: var(--ui-2);
}

.leaflet-container .dropdown-item.active {
    color: #ffffff;
    background-color: var(--bl);
}

.dropdown-item.disabled {
    color: var(--color-text-tertiary);
    color: var(--re);
    pointer-events: none;
    cursor: default;
}

/* Modifications to leaflet-sidebar.css */
.leaflet-sidebar{
    font-family: "Libre Baskerville", serif;
}
.leaflet-sidebar.leaflet-touch {
    box-shadow: none;
}

.leaflet-sidebar-content {
    background-color: rgb(255, 252, 240);
}

.leaflet-sidebar-tabs {
    background-color: rgb(255, 252, 240);
}

.leaflet-sidebar-tabs ul li a {
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaflet-sidebar-header {
    margin-bottom: 1em;
    background-color: #dcd8c0;
    color: #454138;
}

.leaflet-sidebar-tabs > li.active, .leaflet-sidebar-tabs > ul > li.active {
    color: #454138;
    background-color: #dcd8c0;
}

.leaflet-sidebar-tabs > li.active, .sidebar-tabs > ul > li.active {
    color: #454138;
    background-color: #dcd8c0;
}

.sidebar.sidebar-right.leaflet-touch.collapsed {
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .sidebar-right {
        bottom: 35px;
    }
}

@media (min-width: 768px) {
    .sidebar {
        top: 10px;
        bottom: 10px;
        border: 2px solid rgba(0, 0, 0, 0.2)
    }
}

@media (min-width: 768px) {
    .leaflet-sidebar {
        width: 460px;
        max-width: 460px;
    }
}

/* Sets style override for all leaflet buttons*/
.leaflet-bar button {
    color: #454138;
    background-color: rgb(255, 252, 240);
}

/* Puts a little dividing line between zoom in and zoom out*/
.leaflet-bar a {
    color: #454138;
    background-color: rgb(255, 252, 240);
    border-bottom: 1px solid #d1cdb7;
}

/* Legend styles */
.legend {
    background: rgb(255, 252, 240);
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.25rem;
    line-height: 1.6;
    font-size: 0.895rem;
    font-family: "Libre Baskerville", serif;
    max-width: 260px;
    width: fit-content;
}

.legend h4 {
    margin: 0 0 0 0;
    font-size: 0.895rem;
    font-weight: 500;
    padding: 10px 14px;
    color: #454138;
    background-color: #dcd8c0;
}

.legend-rows {
    padding: 10px 14px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-swatch {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

/* Chart styles */
.chart-wrapper {
    background-color: rgb(242, 240, 229);
    margin-top: 1rem;
    padding: 9px;
    border-radius: 3px;
    border: 2px solid var(--ui);
}

.chart-title {
    margin-bottom: 9px;
}

#ed-bar-chart svg {
    width: 100%;
    height: auto;
    display: block;
}

#ed-bar-chart .bar:hover {
    opacity: 0.8;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 0.75rem;
    justify-content: center;
    
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

