/* Year range slider using noUiSlider */
.year-slider-container {
	margin: 1rem 0;
	position: relative;
	max-width: 500px; /* Constrain width */
	margin-left: auto;
	margin-right: auto;
}

#year-slider {
	margin: 20px 0;
}

/* Year range label positioned in center of slider */
.year-range-label {
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(255, 255, 255, 0.95);
	padding: 4px 12px;
	border-radius: 4px;
	font-weight: 600;
	color: #2a5298;
	font-size: 0.9rem;
	white-space: nowrap;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	z-index: 10;
	pointer-events: none; /* Allow clicks to pass through to slider */
}

/* Customize noUiSlider to match navy blue theme */
#year-slider .noUi-connect {
	background: #2a5298; /* Navy blue */
}

#year-slider .noUi-handle {
	background: #2a5298;
	border: 2px solid white;
	box-shadow: 0 2px 6px rgba(0,0,0,0.3);
	width: 20px;
	height: 20px;
	right: -10px;
	top: -10px;
}

#year-slider .noUi-handle:active {
	background: #1e3c72; /* Darker blue when active */
}

#year-slider .noUi-handle:focus {
	outline: none;
	box-shadow: 0 2px 8px rgba(42, 82, 152, 0.5);
}

#year-slider .noUi-tooltip {
	background: #2a5298;
	color: white;
	border: none;
	font-weight: 600;
}

.year-slider-labels {
	display: flex;
	justify-content: space-between;
	font-size: 0.85rem;
	color: #666;
	margin-top: 0.5rem;
}

#year-range-display {
	font-weight: 600;
	color: #2a5298;
}

/* Old slider styles - keeping for reference but not used */
.year-range-container {
	position: relative;
	height: 50px;
	margin: 1rem 0;
	padding: 15px 9px;
	box-sizing: border-box;
}

.year-range-track {
	position: absolute;
	top: 50%;
	left: 9px;
	right: 9px;
	height: 4px;
	background: #ddd;
	border-radius: 2px;
	transform: translateY(-50%);
	z-index: 1;
}

.year-slider {
	position: absolute;
	width: calc(100% - 18px);
	left: 9px;
	height: 20px;
	top: 50%;
	transform: translateY(-50%);
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	z-index: 2;
	margin: 0;
	cursor: pointer;
	padding: 0;
}

.year-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	background: #2a5298;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 2px 4px rgba(0,0,0,0.2);
	transition: all 0.2s;
}

.year-slider::-webkit-slider-thumb:hover {
	background: #1e3c72;
	transform: scale(1.1);
}

.year-slider::-moz-range-thumb {
	width: 18px;
	height: 18px;
	background: #2a5298;
	border-radius: 50%;
	cursor: pointer;
	border: none;
	box-shadow: 0 2px 4px rgba(0,0,0,0.2);
	transition: all 0.2s;
}

.year-slider::-moz-range-thumb:hover {
	background: #1e3c72;
	transform: scale(1.1);
}

.year-slider::-ms-thumb {
	width: 18px;
	height: 18px;
	background: #2a5298;
	border-radius: 50%;
	cursor: pointer;
	border: none;
	box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.year-slider::-webkit-slider-runnable-track {
	height: 4px;
	background: transparent;
}

.year-slider::-moz-range-track {
	height: 4px;
	background: transparent;
}

.year-slider::-ms-track {
	height: 4px;
	background: transparent;
	border: none;
	color: transparent;
}

.year-range-labels {
	display: flex;
	justify-content: space-between;
	font-size: 0.85rem;
	color: #666;
	margin-top: 0.5rem;
}

#year-range-display {
	font-weight: 600;
	color: #2a5298;
}

/* Active range highlight */
.year-range-container {
	--start-percent: 0%;
	--end-percent: 100%;
}

.year-range-container::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 9px;
	width: calc(100% - 18px);
	height: 4px;
	background: linear-gradient(to right,
		#ddd 0%,
		#ddd var(--start-percent, 0%),
		#2a5298 var(--start-percent, 0%),
		#2a5298 var(--end-percent, 100%),
		#ddd var(--end-percent, 100%),
		#ddd 100%);
	border-radius: 2px;
	transform: translateY(-50%);
	z-index: 1;
	pointer-events: none;
	transition: all 0.1s;
}

/* New style matching the image - override existing styles */
.year-range-container {
	height: 80px !important;
	margin: 2rem 0 !important;
	padding: 0 0 20px 0 !important;
}

.year-range-track {
	top: 50px !important;
	left: 0 !important;
	right: 0 !important;
	height: 6px !important;
	background: #e0e0e0 !important;
	border-radius: 0 !important;
}

.year-range-container::before {
	top: 50px !important;
	left: var(--start-percent, 0%) !important;
	width: calc(var(--end-percent, 100%) - var(--start-percent, 0%)) !important;
	height: 6px !important;
	background: #2a5298 !important;
	border-radius: 0 !important;
	transform: none !important;
}

.year-range-indicator-start,
.year-range-indicator-end {
	position: absolute;
	top: 50px;
	width: 2px;
	height: 6px;
	background: #2a5298;
	z-index: 3;
	pointer-events: none;
	transition: all 0.1s;
}

.year-range-indicator-start {
	left: var(--start-percent, 0%);
}

.year-range-indicator-end {
	left: var(--end-percent, 100%);
}

.year-slider {
	width: 100% !important;
	left: 0 !important;
	top: 47px !important;
	transform: none !important;
}

/* Make sliders functional with visible, larger clickable thumbs */
.year-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	background: #2a5298;
	cursor: grab;
	border: 2px solid white;
	border-radius: 50%;
	box-shadow: 0 2px 4px rgba(0,0,0,0.3);
	margin-top: -7px; /* Center the thumb on the track */
}

.year-slider::-webkit-slider-thumb:active {
	cursor: grabbing;
	background: #1e3c72;
	transform: scale(1.2);
}

.year-slider::-moz-range-thumb {
	width: 20px;
	height: 20px;
	background: #2a5298;
	cursor: grab;
	border: 2px solid white;
	border-radius: 50%;
	box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.year-slider::-moz-range-thumb:active {
	cursor: grabbing;
	background: #1e3c72;
	transform: scale(1.2);
}

.year-slider::-ms-thumb {
	width: 20px;
	height: 20px;
	background: #2a5298;
	cursor: grab;
	border: 2px solid white;
	border-radius: 50%;
	box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.year-slider::-ms-thumb:active {
	cursor: grabbing;
	background: #1e3c72;
}


/* Make track overlay block all clicks */
.year-range-track {
	pointer-events: none !important;
}

.year-range-scale {
	position: absolute;
	top: 56px;
	left: 0;
	right: 0;
	height: 20px;
	z-index: 1;
}

.year-range-scale-mark {
	position: absolute;
	top: 0;
	width: 1px;
	height: 8px;
	background: #999;
}

.year-range-scale-mark.major {
	height: 12px;
	background: #666;
}

.year-range-labels-top {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 40px;
	z-index: 5;
}

.year-range-label {
	position: absolute;
	transform: translateX(-50%);
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

.year-range-label.min,
.year-range-label.max {
	color: #999;
	background: #f5f5f5;
	padding: 4px 8px;
	border-radius: 3px;
}

.year-range-label.start,
.year-range-label.end {
	color: white;
	background: #2a5298;
	padding: 4px 8px;
	border-radius: 3px;
}

.year-range-label.start::after,
.year-range-label.end::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 6px solid #2a5298;
}

.year-range-labels {
	display: none !important;
}

/* Style for map container to blur areas outside US */
.map-container {
	position: relative;
	overflow: hidden;
	max-width: 100%%;
	margin: 0 auto;
}

#map {
	position: relative;
	width: 100%;
	height: 750px;
}

/* Overlay for areas outside US */
.world-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 1000;
}

/* Inset maps for Alaska and Hawaii */
.inset-map-container {
	position: absolute;
	background: white;
	border: 2px solid #2a5298;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.3);
	z-index: 2000;
	overflow: hidden;
}

.inset-map-container.alaska {
	bottom: 20px;
	left: 20px;
	width: 200px;
	height: 150px;
}

.inset-map-container.hawaii {
	bottom: 20px;
	left: 240px;
	width: 180px;
	height: 120px;
}

.inset-map-label {
	position: absolute;
	top: 5px;
	left: 5px;
	background: rgba(42, 82, 152, 0.9);
	color: white;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 0.75rem;
	font-weight: 600;
	z-index: 2001;
	pointer-events: none;
}

.inset-map {
	width: 100%;
	height: 100%;
}

/* State disasters table styles (matching events page) */
.events-table-container {
	background: white;
	padding: 1.5rem;
	border-radius: 4px;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
	margin-top: 2rem;
}

.events-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.events-table thead {
	background: #1e3c72;
	color: white;
}

.events-table th {
	padding: 12px 16px;
	text-align: left;
	font-weight: 600;
	font-size: 13px;
	border-bottom: 2px solid #0f2a52;
}

.events-table th.sortable {
	cursor: pointer;
	user-select: none;
	position: relative;
	padding-right: 24px;
}

.events-table th.sortable:hover {
	background: #2a5298;
}

.events-table th .sort-icon {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 10px;
	opacity: 0.7;
}

.events-table th.sort-asc .sort-icon::after {
	content: '▲';
	opacity: 1;
}

.events-table th.sort-desc .sort-icon::after {
	content: '▼';
	opacity: 1;
}

.events-table tbody tr {
	border-bottom: 1px solid #e0e0e0;
}

.events-table tbody tr:hover {
	background: #f5f5f5;
}

.events-table td {
	padding: 12px 16px;
	vertical-align: top;
}

.event-link {
	color: #2a5298;
	text-decoration: none;
	font-weight: 500;
}

.event-link:hover {
	text-decoration: underline;
}

.disaster-type-icon {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 2px;
	margin-right: 8px;
	vertical-align: middle;
}

.type-drought { background-color: #FFD700; }
.type-flood { background-color: #0066CC; }
.type-freeze { background-color: #87CEEB; }
.type-severe-storm { background-color: #32CD32; }
.type-tropical-cyclone { background-color: #FFFF00; }
.type-wildfire { background-color: #FF8C00; }
.type-winter-storm { background-color: #9370DB; }

.cost-with-ci {
	display: flex;
	align-items: center;
	gap: 6px;
}

.ci-icon {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #e0e0e0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 9px;
	font-weight: bold;
	color: #666;
	cursor: help;
}

.loading {
	text-align: center;
	padding: 2rem;
	color: #666;
}

/* State hover info bar */
.state-hover-info {
	position: absolute;
	background: rgba(30, 60, 114, 0.95);
	color: white;
	padding: 10px 16px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	pointer-events: none;
	z-index: 1000;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	display: none;
	white-space: nowrap;
	transition: opacity 0.2s ease;
}

.state-hover-info.visible {
	display: block;
}

.state-hover-info .state-name {
	font-size: 16px;
	margin-bottom: 4px;
	font-weight: 700;
}

.state-hover-info .state-cost {
	font-size: 18px;
	color: #ffd700;
	font-weight: 700;
}

/* Map description and tooltip */
.map-description {
	background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
	border-left: 4px solid #2a5298;
	padding: 1.25rem 1.5rem;
	margin: 0 0 1.5rem 0;
	border-radius: 6px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.map-description h3 {
	color: #2a5298;
	font-size: 1.1rem;
	font-weight: 700;
	margin: 0 0 0.75rem 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.map-description h3::before {
	content: "";
	width: 4px;
	height: 20px;
	background: linear-gradient(180deg, #2a5298 0%, #1e3c72 100%);
	border-radius: 2px;
	flex-shrink: 0;
}

.map-description p {
	color: #495057;
	font-size: 0.95rem;
	line-height: 1.6;
	margin: 0 0 0.5rem 0;
}

.map-description p:last-child {
	margin-bottom: 0;
}

.map-description strong {
	color: #2a5298;
	font-weight: 600;
}

.interactive-tooltip {
	background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
	color: white;
	padding: 0.875rem 1.25rem;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(42, 82, 152, 0.25);
	margin: 0 0 1.25rem 0;
	display: flex;
	align-items: center;
	gap: 0.875rem;
	position: relative;
	overflow: hidden;
}

.interactive-tooltip::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(90deg, 
		rgba(255, 255, 255, 0) 0%, 
		rgba(255, 255, 255, 0.1) 50%, 
		rgba(255, 255, 255, 0) 100%);
	animation: shimmer 3s infinite;
}

@keyframes shimmer {
	0% { transform: translateX(-100%); }
	100% { transform: translateX(100%); }
}

.interactive-tooltip-icon {
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	animation: pulse-ring 2s ease-in-out infinite;
}

.interactive-tooltip-icon::before {
	content: "";
	width: 16px;
	height: 16px;
	background: white;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@keyframes pulse-ring {
	0%, 100% { 
		box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
	}
	50% { 
		box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
	}
}

.interactive-tooltip-content {
	position: relative;
	z-index: 1;
}

.interactive-tooltip-content p {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 500;
	line-height: 1.4;
}

.interactive-tooltip-content strong {
	font-weight: 700;
	color: #ffd700;
}

/* CPI Tooltip Styling */
.cpi-label-container {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: 500;
	color: #555;
	margin-bottom: 0.5rem;
}

.info-tooltip {
	position: relative;
	display: inline-flex;
	align-items: center;
	cursor: help;
}

.info-tooltip .info-icon {
	width: 16px;
	height: 16px;
	color: #2a5298;
	transition: color 0.2s;
}

.info-tooltip:hover .info-icon {
	color: #1e3c72;
}

.info-tooltip .tooltip-text {
	visibility: hidden;
	opacity: 0;
	position: absolute;
	bottom: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%);
	width: 280px;
	background: #1e3c72;
	color: white;
	padding: 12px 14px;
	border-radius: 8px;
	font-size: 0.85rem;
	font-weight: 400;
	line-height: 1.5;
	text-align: left;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	z-index: 1000;
	transition: opacity 0.2s, visibility 0.2s;
}

.info-tooltip .tooltip-text::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 8px solid transparent;
	border-top-color: #1e3c72;
}

.info-tooltip:hover .tooltip-text {
	visibility: visible;
	opacity: 1;
}

/* Toggle Switch Styling */
.toggle-switch {
	position: relative;
	display: inline-block;
	width: 120px;
	height: 40px;
}

.toggle-switch input {
	opacity: 0;
	width: 0;
	height: 0;
}

.toggle-slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #ccc;
	transition: 0.3s;
	border-radius: 40px;
}

.toggle-slider:before {
	position: absolute;
	content: "";
	height: 32px;
	width: 32px;
	left: 4px;
	bottom: 4px;
	background-color: white;
	transition: 0.3s;
	border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
	background-color: #2a5298;
}

.toggle-switch input:checked + .toggle-slider:before {
	transform: translateX(80px);
}

.toggle-text {
	display: none;
}