:root {
    /* Backgrounds */
    --bg: #F5F4F2;
    --surface: #ECE8E1;
    --surface-elevated: #ffffff;

    /* Text */
    --text: #2C2C2C;
    --text-muted: #6B6B6B;

    /* Borders */
    --border-thickness: 1px;
    --border-radius: 8px;
    --border-color: #acacac;
    --border-type: solid;

    /* Accent */
    --accent: #2563EB;

    /* Inputs */
    --input-bg: var(--accent);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);

    /* Selection */
    --selected-bg: var(--accent);

    /* Button */
    --filter-button-hover: #ffffff;
    --button-hover: #ffffff;
    --text-on-accent: #ffffff;

    /* Dropdown */
    --dropdown-hover: #ffffff;
}

h1 {
    text-align: center;
    margin-bottom: 25px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
            Inter,
            system-ui,
            -apple-system,
            BlinkMacSystemFont,
            sans-serif;
}

.layout {
    display: flex;
    gap: 20px;
    min-height: calc(100vh - 120px);
    align-items: flex-start;
    padding: 20px;
    box-sizing: border-box;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--surface-elevated);
    padding: 15px;
    border-radius: var(--border-radius);
    border: var(--border-thickness) var(--border-type) var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

.page {
    display: flex;
    flex-direction: column;
}

select, input {
    background: var(--input-bg);
    color: var(--text);
    border: var(--border-thickness) var(--border-type) var(--border-color);
}

button {
    background: var(--surface-elevated);
    color: var(--text);
    border: var(--border-thickness) var(--border-type) var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: 0.2s;
}

button:hover {
    border-color: var(--accent);
    background: var(--button-hover);
}

.sidebar-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.sidebar-actions button:last-child {
    margin-left: auto;
}

.filter-block {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.radio-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.content {
    flex: 1;
    display: flex;
    min-width: 0;
}

#cancerTypes,
#timeSeries{
    width: 100%;
    min-width: 0;
}

.content #chart {
    flex: 1;
}

#yearSlider {
    margin: 10px 0 25px 0;
}

.noUi-target {
    background: #ffffff;
    border: none;
    box-shadow: none;
    height: 6px;
    border-radius: var(--border-radius);
}

.noUi-connect {
    background: var(--selected-bg);
}

.noUi-handle {
    width: 16px !important;
    height: 16px !important;
    border-radius: 50%;
    border: var(--border-thickness) solid #929292 ;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    cursor: pointer;
    right: -8px !important;
    top: -6px !important;
}

.noUi-handle:before,
.noUi-handle:after {
    display: none;
}

.noUi-horizontal .noUi-handle {
    top: -6px;
}

#yearStartLabel,
#yearEndLabel {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.tabs {
    display: flex;
    gap: 5px;
    padding: 0 10px;
    border-bottom: var(--border-thickness) var(--border-type) var(--border-color);
}

.tab-button {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    padding: 10px 14px;
    border-radius: 0;
    cursor: pointer;
    transition: 0.2s;
}

.tab-button:hover {
    color: var(--text);
}

.tab-button.active {
    color: var(--text);
    border-bottom: 3px solid var(--accent);
    font-weight: 600;
}

.tab-content {
    display: none;
    flex: 1;
    min-width: 0;
}

.tab-content.active {
    display: block;
    flex: 1;
    min-width: 0;
}

.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.toggle {
    padding: 8px 14px;
    border: var(--border-thickness) var(--border-type) var(--border-color);
    background: var(--surface-elevated);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: 0.2s;
}

.toggle:hover {
    background: var(--filter-button-hover);
}

.toggle.active{
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent)
}

.autocomplete-container {
    position: relative;
}

#typeFilter {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.combobox {
    display:flex;
    position: relative;
    flex-direction: column;
    width: 100%;
    gap: 6px;
}

#typeFilter {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    cursor: pointer;
}

.dropdown {
    display: none;
    background: var(--surface-elevated);
    border: var(--border-thickness) var(--border-type) var(--border-color);
    box-shadow: var(--shadow-md);

    max-height: 300px;
    overflow-y: auto;

    position: absolute;
    width: 100%;
    z-index: 1000;
}

.dropdown-item {
    padding: 8px;
    cursor: pointer;
}
.dropdown-item:hover {
    background: var(--dropdown-hover)
}

#timeSeriesContainer {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
}

.region-plot {
    width: 100%;
    min-height: 500px;
    overflow:hidden;
    border: var(--border-thickness) var(--border-type) var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);

    box-sizing: border-box;

    background: var(--surface-elevated);
}

.dropdown-item.selected {
    background: var(--accent);
    color: var(--text-on-accent);
}

.plot-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.homepage {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

.hero {
    background: var(--surface-elevated);
    border-radius: var(--border-radius);
    border: var(--border-thickness) var(--border-type) var(--border-color);
    box-shadow: var(--shadow-sm);

    padding: 40px;
    margin-bottom: 40px;
}

.hero h1{
    margin-top:0;
    margin-bottom:20px;
    text-align:center;
}

.hero p{
    max-width:900px;
    margin:auto;
    line-height:1.7;
    color:var(--text-muted);
    text-align:center;
}

.card-grid{
    display:grid;
    grid-template-columns:
        repeat(auto-fit,minmax(380px,1fr));
    gap:30px;
}

.dashboard-card{
    background:var(--surface-elevated);
    border:
            var(--border-thickness)
            var(--border-type)
            var(--border-color);

    border-radius:var(--border-radius);
    box-shadow:var(--shadow-sm);
    padding:20px;
    transition:0.2s;
    cursor:pointer;
}

.dashboard-card:hover{
    transform:translateY(-4px);
    box-shadow:var(--shadow-md);
    border-color:var(--accent);
}

.dashboard-card h2{
    margin-top:0;
    font-size:1.2rem;
}

.dashboard-card p{
    color:var(--text-muted);
    line-height:1.6;
}

.preview-chart{
    width:100%;
    height:220px;
    margin:15px 0;
}

.card-footer{
    display:flex;
    justify-content:flex-end;
    font-weight:600;
    color:var(--accent);
}

input[type="color"]{
    width:100%;
    height:40px;
    padding:2px;
    border:none;
    background:none;
    cursor:pointer;
}