:root {
  --primary-color: #1abc9c;
  --secondary-color: #16a085;
  --button-hover-color: #148f77; /* New color for button hover */
  --title-color: #0e6655; /* New color for title */
}
* {
  /* Below is the standard CSS code one should add to get rid of default margins and padding which most of tge HTML elements have */
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
  user-select: none;
}
body {
  position: relative;
  height: 100vh;
  text-align: center;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  align-items: stretch;
}

/* Title CSS */
.title {
  background-color: var(--title-color); /* Updated title color */
  text-align: center;
  font-size: 1.2em;
  padding-block: 0.5em;
  color: #fff;
  cursor: pointer;
}

/* Navbar CSS */
.navbar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8em;
  font-size: 16px;
  min-height: 70px;
  padding-block: 0.6em;
  background-color: var(--secondary-color);
  transition: all 0.5s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.navbar a {
  all: unset;
  cursor: pointer;
  color: #fff;
  font-weight: bold;
  padding: 8px 10px;
  border-radius: 6px;
  transition: 0.3s;
  background-color: var(--primary-color);
    background: linear-gradient(45deg, #1abc9c, #16a085);
    transition: background 0.3s ease;
}
.navbar a:hover {
  background-color: var(--button-hover-color);
    transform: scale(1.05); 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.3s ease; 
}

.navbar a:active {
  transform: scale(0.95); 
  background-color: #148f77; 
}

.navbar a:focus {
  outline: none; 
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); 
}

.navbar #menu {
  width: fit-content;
  outline: none;
  border: none;
  border-radius: 4px;
  padding: 6px 8px;
  background-color: #1abc9c;
  color: white;
  /*background-color: #3498db; */
  background-color: linear-gradient(#0f8b7d,#2980b9);
  cursor: pointer; 
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); 
  transition: background-color 0.3s ease;
}
.navbar > .icon {
  display: none;
}
#menu,
#random,
#start {
  cursor: pointer;
}


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

.navbar a:hover {
  animation: pulse 0.6s infinite;
}

/* Center css */
.center {
  margin: 0 auto;
  box-shadow: rgba(255, 255, 255, 0.16) 0px 1px 4px; /* Added shadow to make page border free */
  height: 420px;
  width: 95%;
  max-height: 731px;
}
.array {
  display: flex;
  align-items: flex-end;
  min-height: 100%;
  height: 100%;
  padding: 1rem;
  flex-direction: row;
  background: #ede6ea;
}
.cell {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex: 0.5;
  width: 0.000001%;
  margin: 1px;
  background-color: #bbb5b5;

  position: relative;
  
  transition: all 0.4s ease-in;
}
.cell.done {
  background-color: #9cec5b;
  border-color: #9cec5b;
  color: white;
  transition: all 0.4s ease-out;
}
.cell.visited {
  border-color: #6184d8;
  background-color: #6184d8;
  color: white;
  transition: 0.5s;
}
.cell.current {
  border-color: #50c5b7;
  background-color: #50c5b7;
  color: white;
  transition: all 0.4s ease-out;
}
.cell.min {
  background-color: #ff1493;
  border-color: #ff1493;
  color: white;
  transition: all 0.4s ease-out;
}
.cell-value {
  position: absolute;
  bottom: 2px; 
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: black;
  font-weight: bold;
  pointer-events: none; 
  user-select: none; 

}

/* Footer CSS.................... */
.time-info {
  display: none;
  font-family: 'Roboto', sans-serif;
  color: #00ffc8;
  font-size: 1.1rem;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #00ffc8;
  padding: 10px 20px;
  margin: 20px auto;
  border-radius: 10px;
  width: fit-content;
  box-shadow: 0 0 15px #00ffc8aa;
  animation: fadeInScale 0.8s ease-in-out;
  transition: all 0.3s ease-in-out;
  text-align: center;
  backdrop-filter: blur(6px);
}

@keyframes fadeInScale {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.time-info span {
  font-weight: bold;
  color: #fffb00;
  text-shadow: 0 0 5px #fff200;
}

/* .footer > p:nth-child(2) {
  margin-bottom: 0.6em;
} */
.link {
  text-decoration: none;
  font-weight: bold;
  color: #ff5252;
  font-size: 20px;
}

@media screen and (max-width: 600px) {
  .navbar {
    gap: 0.4em;
  }
  .title {
    font-size: 17px;
  }
  .navbar *,
  .navbar a {
    font-size: 14px;
  }
  .footer {
    font-size: 18px;
  }
  a#random {
    order: 4;
  }
  a.start {
    order: 5;
  }
  .theme-switch{
    margin-left: 0px !important;
  }
}

/* Chat Popup Toggle Button */
.chat-toggle-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
  }

.chat-toggle-button:hover {
  transform: scale(1.1);
}

/* Chat Container Styling */
.chat-container {
  position: fixed;
  bottom: 70px;
  right: 20px;
  width: 300px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;               /* Initial hidden state */
  transform: translateY(20px); /* Slide from 20px below */
  transition: transform 0.3s ease, opacity 0.3s ease;
  background-color: #fff; 
  max-height: 400px; 
  overflow-y: auto; 
  z-index: 1000; 
  transition: all 0.3s ease;
}

.chat-container.show {
  display: flex;             /* Display flex when active */
  opacity: 1;                /* Make visible */
  transform: translateY(0);  /* Slide up to position */
}

.chat-container.hide {
  opacity: 0;                /* Fade out */
  transform: translateY(20px); /* Slide back down */
}

/* Chat Header Styling */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background-color: #3498db;
  color: white;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.chat-header h4 {
  margin: 0;
  font-size: 16px;
}

.close-chat {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
}

/* Chat Body Styling */
.chat-body {
  display: flex;
  padding: 10px;
    max-height: 300px; 
    overflow-y: auto;
}
.chat-body input{
width: calc(100% - 60px); 
    padding: 10px;
    border: 1px solid #ccc; 
    border-radius: 5px; 
    margin-right: 10px;
}
#chatInput {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  outline: none;
  margin-right: 8px;
}

#chatButton {
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 10px 15px;
  font-size: 14px;
  cursor: pointer;
    background-color: #3498db; 
    
    transition: background-color 0.3s ease; 
}

#chatButton:hover {
  background-color: #2980b9;
  background-color: linear-gradient(#0f8b7d,#2980b9);
}
.chat-toggle-button {
  background-color: #3498db; 
  background-color: linear-gradient(#0f8b7d,#2980b9);
  color: #fff; 
  border: none; 
  border-radius: 50%; 
  width: 50px; 
  position: fixed;
  bottom: 20px; 
  right: 20px; 
  cursor: pointer; 
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); 
  transition: background-color 0.3s ease;
}
.chat-toggle-button:hover {
  background-color: #2980b9; /* Darker shade on hover */
}

.container {
  background-color: #f9f9f9;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
}


/* Light Mode (Default) */
#body {
  background-color: white;
  color: black;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.dark-mode {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Mode */
#body.dark-mode {
  background-color: #121212;
  color: white;
}

.dark-mode .navbar {
  background-color: #0d796d;
}

.dark-mode .title {
  background-color: #0f8b7d;
}

.dark-mode .center {
  box-shadow: rgba(255, 255, 255, 0.16) 0px 1px 4px;
}

.dark-mode .array {
  background-color: #2d2d2d;
}

.dark-mode .cell {
  background-color: #6c6c6c;
}

.dark-mode .cell.done {
  background-color: #9cec5b;
  border-color: #9cec5b;
  color: white;
}

.dark-mode .cell.visited {
  border-color: #6184d8;
  background-color: #6184d8;
  color: white;
}

.dark-mode .cell.current {
  border-color: #50c5b7;
  background-color: #50c5b7;
  color: white;
}

.dark-mode .cell.min {
  background-color: #ff1493;
  border-color: #ff1493;
  color: white;
}

/*.options
{
    background-color: #1abc9c; 
    color: white;
    border: none; 
    border-radius: 6px; 
    padding: 4px 7px;
    cursor: pointer; 
    transition: background-color 0.3s ease, transform 0.3s ease; 
}*/

.dark-mode .options select {
  background-color: #333;
  color: white;
}

.dark-mode .chat-container {
  background-color: #333;
  color: white;
  border: 1px solid #444;
}

.dark-mode footer {
  color: #e0e0e0;
}

/* Theme Toggle Button */
.theme-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 40px !important;
  height: 40px !important;
  padding: 8px !important;
  font-size: 16px !important;
  transition: transform 0.3s ease;
  background-color: #1abc9c !important;
  border-radius: 50% !important;
  position: absolute;
  right: 20px;
  top: 10px;
  z-index: 100;
}

.theme-btn:hover {
  transform: rotate(20deg);
  background-color: #16a085 !important;
}

.dark-mode .theme-btn i {
  content: "\f185"; /* fa-sun-o */
}

/* Customize button style */
#theme-toggle {
  background-color: #5c6bc0;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  width: 60px;
  height: 40px;
  display: block; /* Make the button a block element */
  margin: 0 auto; 
  border: 2px solid #2b5659; /* Added border around the circle */
}

#theme-toggle:hover {
  background-color: #3f51b5;
}

#theme-toggle.dark-mode {
  background-color: #333;
  color: white;
}





body {
  margin: 0;
  overflow: hidden; 
}

#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -1;
}

/*input[type="text"], select {
  border: 2px solid #1abc9c; 
  border-radius: 8px; 
  padding: 8px; 
  font-size: 15px; 
  transition: border-color 0.3s ease, box-shadow 0.3s ease; 
}

input[type="text"]:focus, select:focus {
  border-color: #16a085;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 
  outline: none; 
}

select {
  background-color: #fff; 
  color: #333; 
  cursor: pointer;
  transition: background-color 0.3s ease; 
}

select:hover {
  background-color: #f0f0f0; 
}

/*.algorithm-button {
  background-color: #1abc9c; 
  color: white;
  border: none; 
  border-radius: 8px; 
  padding: 7px 9px;
  cursor: pointer; 
  transition: background-color 0.3s ease, transform 0.3s ease; /* Smooth transition */
}

/*.algorithm-button:hover {
  background-color: #16a085; 
  transform: scale(1.05);
}
*/

.refresh-button{
    font-size: 14px; /* Adjust the font size */
    padding: 3px 7px; /* Adjust padding for smaller buttons */
    margin: 2px; /* Add some margin for spacing */
    height: 26px; /* Set a fixed height for buttons */
    margin: 2px; /* Add some margin for spacing */
  background-color: #1abc9c !important;
  transition: background 0.3s ease;
  background-color: linear-gradient(#0f8b7d,#2980b9);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #00ffc8;
  border-radius: 10px;
  box-shadow: 0 0 15px #00ffc8aa;
  animation: fadeInScale 0.8s ease-in-out;
  transition: all 0.3s ease-in-out;
  text-align: center;
  backdrop-filter: blur(6px);
}


/*refresh button styling........... */

#refresh-btn {
  all: unset;
  cursor: pointer;
  color: #fff;
  font-weight: bold;
  padding: 7px 9px;
  border-radius: 6px;
  transition: 0.3s;
  background-color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 5px; 
}

#refresh-btn:hover {
  background-color: var(--button-hover-color);
}

#refresh-btn i {
  font-size: 16px;
}









/* Popup card styling................. */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(6px);
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
}


.about-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #1abc9c;
  z-index: 100;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
  max-width: 500px;
  width: 90%;
  text-align: center;
  font-family: 'Roboto', sans-serif;
}

.about-popup h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.about-popup p {
  font-size: 1rem;
  color: #333;
}

.close-about {
  margin-top: 1.5rem;
  padding: 0.5rem 1rem;
  background-color: #444;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
}

.close-about:hover {
  background-color: #222;
}

.hidden {
  display: none;
}



input[type="range"] {
  -webkit-appearance: none; /* Remove default styling */
  width: 100%; /* Full width */
  height: 8px; /* Track height */
  background: #ddd; /* Track color */
  border-radius: 5px; /* Rounded track */
  outline: none; /* Remove outline */
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; 
  appearance: none; 
  width: 20px; 
  height: 20px; 
  background: #1abc9c; 
  border-radius: 50%; 
  cursor: pointer; 
  transition: background 0.3s ease; 
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #16a085; 
}


/* Theme Switch Styling.................................*/
.theme-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
  margin-left: 10px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  border-radius: 30px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #f1c40f;
  transition: background-color 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 16px;
  color: #fff;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.sun-icon {
  color: #fff700;
}

.moon-icon {
  color: #dfe6e9;
}


.theme-switch input:checked + .slider {
  background-color: #34495e; 
}

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

.sun-icon {
  text-shadow: 0 0 8px #fff700;
}

.theme-switch input:checked + .slider .moon-icon {
  text-shadow: 0 0 10px #95a5a6;
}


.slider::before {
  content: "";
  position: absolute;
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
  background: radial-gradient(circle at 30% 30%, #ffe100, #ff9900); /* Brighter sun */
  border-radius: 50%;
  transition: transform 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
  box-shadow: 0 0 10px #f39c12, 0 0 5px #ffae42;
  border: 2px solid #e67e22; /* Makes it stand out */
}


.theme-switch input:checked + .slider::before {
  background: radial-gradient(circle at 30% 30%, #dfe6e9, #2c3e50); /* Moon feel */
  transform: translateX(30px);
  box-shadow: 0 0 10px #95a5a6;
}

.theme-switch{
  position: relative;
  margin-left:80px;

}

@media screen and (max-width: 340px) {
  .array{
    min-height: 0vh;
    height: 65vh !important;
    overflow: hidden;
    z-index: 1000;
  }
}