body {
	font-family: Arial, sans-serif;
	max-width: 800px;
	margin: 0 auto;
	padding: 20px;
	text-align: center;
	background-color: #f0f7ff; /* Light pastel blue background */
}

h1 {
	color: #333;
}

.settings-panel {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 20px;
	background-color: #e6f2ff;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 20px;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.settings-section {
	flex: 1;
	min-width: 200px;
	padding: 10px;
	border-radius: 6px;
	background-color: #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.settings-section h3 {
	margin-top: 0;
	color: #2196f3;
	font-size: 16px;
	margin-bottom: 15px;
	border-bottom: 1px solid #e0e0e0;
	padding-bottom: 8px;
}

.toggle-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.toggle-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 14px;
}

.array-size-control {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}

.size-btn {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: none;
	background-color: #2196f3;
	color: white;
	font-size: 16px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s;
}

.size-btn:hover {
	background-color: #1976d2;
}

#array-size-display {
	font-size: 18px;
	font-weight: bold;
	min-width: 30px;
}

.controls {
	margin: 20px 0;
	display: flex;
	justify-content: center;
	gap: 10px;
}

button {
	padding: 10px 20px;
	font-size: 16px;
	cursor: pointer;
	background-color: #4caf50;
	color: white;
	border: none;
	border-radius: 4px;
	transition: background-color 0.2s;
}

button:hover {
	background-color: #45a049;
}

button:disabled {
	background-color: #cccccc;
	cursor: not-allowed;
}

.toggle-switch {
	position: relative;
	display: inline-block;
	width: 60px;
	height: 28px;
	margin: 0 10px;
}

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

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

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

input:checked + .slider {
	background-color: #2196f3;
}

input:checked + .slider:before {
	transform: translateX(32px);
}

.sort-container {
	margin: 20px 0;
}

.sort-step {
	display: flex;
	justify-content: center;
	margin: 10px 0;
	position: relative;
}

.sort-step:before {
	content: attr(data-step);
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	font-weight: bold;
	color: #666;
}

.number-box {
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 5px;
	font-size: 18px;
	font-weight: bold;
	border-radius: 4px;
}

.sorted {
	background-color: #a8e6cf;
	border: 2px solid #1b9e77;
}

.unsorted {
	background-color: #ffaaa6;
	border: 2px solid #d95f02;
}

.current {
	background-color: #ffd3b6;
	border: 2px solid #ff8c00;
	animation: pulse 1s infinite;
}

.moved-value {
	margin-left: 20px;
	background-color: #ffd3b6;
	padding: 5px 10px;
	border-radius: 4px;
	font-weight: bold;
	display: inline-block;
	border: 2px solid #ff8c00;
}

.keyboard-shortcuts {
	margin-top: 10px;
	color: #666;
}

kbd {
	background-color: #f7f7f7;
	border: 1px solid #ccc;
	border-radius: 3px;
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
	color: #333;
	display: inline-block;
	font-size: 0.85em;
	font-weight: bold;
	padding: 2px 4px;
	margin: 0 2px;
}

@keyframes pulse {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.1);
	}
	100% {
		transform: scale(1);
	}
}

.explanation {
	margin: 20px 0;
	padding: 10px;
	background-color: #f8f9fa;
	border-radius: 4px;
	text-align: left;
}

.number-box {
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 5px;
	font-size: 18px;
	font-weight: bold;
	border-radius: 4px;
}

.sorted {
	background-color: #a8e6cf;
	border: 2px solid #1b9e77;
}

.unsorted {
	background-color: #ffaaa6;
	border: 2px solid #d95f02;
}

.current {
	background-color: #ffd3b6;
	border: 2px solid #ff8c00;
	animation: pulse 1s infinite;
}

/* New styles for bubble sort */
.compared {
	background-color: #ffd3b6;
	border: 2px solid #ff8c00;
	animation: pulse 1s infinite;
}

.swapped {
	background-color: #ff9e80;
	border: 2px solid #ff3d00;
	animation: swap 1s infinite;
}

.final-position {
	background-color: #a8e6cf;
	border: 2px solid #1b9e77;
	box-shadow: 0 0 10px #1b9e77;
}

.algorithm-selector {
	margin: 20px 0;
	text-align: center;
}

.algorithm-selector select,
.array-size-selector select {
	padding: 8px 15px;
	font-size: 16px;
	border-radius: 4px;
	border: 1px solid #ccc;
	background-color: #fff;
	cursor: pointer;
}

.config-section {
	display: flex;
	justify-content: center;
	gap: 20px;
	margin: 20px 0;
	flex-wrap: wrap;
}

@keyframes swap {
	0% {
		transform: translateY(0);
	}
	25% {
		transform: translateY(-10px);
	}
	75% {
		transform: translateY(10px);
	}
	100% {
		transform: translateY(0);
	}
}

/* Merge sort specific containers */
.subarrays-container {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin-top: 10px;
	align-items: center;
}

.subarray-row {
	display: flex;
	justify-content: center;
	gap: 20px;
	width: 100%;
}

.subarray {
	display: flex;
	border: 2px solid #ccc;
	border-radius: 8px;
	padding: 5px;
	background-color: #f9f9f9;
	position: relative;
}

.merge-phase {
	position: absolute;
	left: 0;
	top: -20px;
	font-weight: bold;
	padding: 2px 8px;
	border-radius: 4px;
	color: white;
}

.divide-phase {
	background-color: #3f51b5;
}

.merge-phase {
	background-color: #e91e63;
}

/* Styling for different states of subarrays */
.merging-array {
	border-color: #ff9800;
	background-color: #fff3e0;
	box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

.merged-array {
	border-color: #4caf50;
	background-color: #e8f5e9;
}

.completed-array {
	border-color: #009688;
	background-color: #e0f2f1;
	box-shadow: 0 0 8px rgba(0, 150, 136, 0.6);
}

/* Element states during merge sort */
.selected-element {
	background-color: #fff9c4;
	border-color: #fbc02d;
}

.from-left {
	background-color: #bbdefb;
	border-color: #2196f3;
	animation: pulse-blue 1s infinite;
}

.from-right {
	background-color: #f8bbd0;
	border-color: #e91e63;
	animation: pulse-pink 1s infinite;
}

.merged {
	background-color: #c8e6c9;
	border-color: #4caf50;
}

@keyframes pulse-blue {
	0% {
		box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.7);
	}
	70% {
		box-shadow: 0 0 0 5px rgba(33, 150, 243, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(33, 150, 243, 0);
	}
}

@keyframes pulse-pink {
	0% {
		box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.7);
	}
	70% {
		box-shadow: 0 0 0 5px rgba(233, 30, 99, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(233, 30, 99, 0);
	}
}

/* Responsive adjustments for merge sort */
@media (max-width: 768px) {
	.subarray-row {
		flex-direction: column;
		align-items: center;
		gap: 15px;
	}

	.subarrays-container {
		gap: 25px;
	}

	.subarray {
		margin-top: 20px;
	}

	.toggle-container {
		flex-direction: column;
		gap: 10px;
	}

	.config-section {
		flex-direction: column;
		align-items: center;
	}
}
