body {
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  margin: 0;
  display: flex;
  flex-direction: column; /*Xếp dọc*/
  height: 100vh;
}

h1 {
  text-align: center;
  margin: 15px 0;
  color: #333;
}

/* Container gồm Sidebar và Maze */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden; /* Cố định body, không scroll*/
  padding: 10px;
  gap: 20px;
}

/* SIDEBAR */
.sidebar {
  width: 350px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto; /* scroll nếu màn hình nhỏ */
  flex-shrink: 0; /*không bị co lại khi màn hình nhỏ*/
}

/* CONTROLS */
.controls {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.controls label {
  font-weight: bold;
  margin-top: 10px;
  display: block;
  font-size: 14px;
}

.controls input,
.controls button {
  width: 100%;
  margin-top: 5px;
  padding: 8px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

.controls button:hover {
  background-color: #f1f1f1;
}

.mode-buttons,
#algoButtons {
  display: flex;
  gap: 5px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.mode-buttons button,
#algoButtons button {
  flex: 1;
  font-size: 12px;
}

.set-map {
  display: flex;
  flex-direction: row;
  gap: 20px;
  margin-bottom: 5px;
}

/* ACTIVE BUTTON: đổi màu khi chọn */
button.active.wall-btn {
  background: #343a40;
  color: white;
  font-weight: bold;
  border: none;
}

button.active.start-btn {
  background: #2ecc71;
  color: white;
  font-weight: bold;
  border: none;
}

button.active.end-btn {
  background: #e74c3c;
  color: white;
  font-weight: bold;
  border: none;
}

button.active.algo-btn {
  background: #39719c;
  color: white;
  font-weight: bold;
  border: none;
}

#reset-btn {
  background-color: #ff6b6b;
  color: white;
  font-weight: bold;
}

/* STATS */
.stats {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  border: 1px solid #eee;
  padding: 4px 2px;
  text-align: center;
  font-size: 12px;
}

th {
  background-color: #f8f9fa;
  font-weight: bold;
}

/* MAZE AREA */
.maze-wrapper {
  flex: 1;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  padding: 20px;
  overflow: auto;
}

.maze {
  display: grid;
  border: 2px solid #333;
  background: #ccc;
  gap: 0;
  height: fit-content;
  width: fit-content;
  margin: auto;
}

.cell {
  border: 1px solid #ddd;
  background: white;
  box-sizing: border-box;
}

.cell.wall {
  background: #343a40;
  border-color: #343a40;
}

.cell.start {
  display: flex;
  justify-content: center;
  align-items: center;
}
.cell.start::before {
  content: "🏁";
}

.cell.end {
  display: flex;
  justify-content: center;
  align-items: center;
}
.cell.end::before {
  content: "🚩";
}

.cell.visited {
  background: #a5d8ff;
  transition: background 0.2s;
  z-index: 1;
}
.cell.path {
  background: #fcc419;
  transition: background 0.2s;
}
