* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scroll-margin: 80px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: #000000;
}

body.light-mode {
  background-color: #ffffff;
  color: #2d2d2d;
}

.navbar {
  display: flex;
  justify-content: space-between;
  height: 60px;
  align-items: center;
  background-color: #252525f8;
  position: sticky;
  top: 0;
  z-index: 1;
  transition: 0.3s ease;
}

body.light-mode .navbar {
  background-color: #f0f0f0f5;
}

.logo a {
  padding-left: 5vw;
  font-size: 30px;
  font-weight: 600;
  color: #ffffff;
  transition: 0.3s ease;
}

body.light-mode .logo a {
  color: #0f054b;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  margin-right: 2vw;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-right: 40px;
}

.nav-links.show {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 60px;
  right: -40px;
  background-color: #101010;
  padding: 10px 20px;
  border-radius: 10px;
  z-index: 2;
  transition: 0.3s ease;
}

body.light-mode .nav-links.show {
  background-color: #efefef;
}

.links {
  text-decoration: none;
  color: #ffffff;
  font-size: 18px;
  font-weight: 500;
  align-self: center;
  transition: 0.3s ease;
}

body.light-mode .links {
  color: rgb(16, 5, 77);
}

.links:hover, body.light-mode .links:hover {
  color: #f925e0;
}

.theme {
  height: 20px;
  width: 20px;
  background: none;
  border: none;
  cursor: pointer;
  margin-right: 30px;
  display: flex;
  align-items: center;
}

.menuIcon,
.closeIcon {
  display: none;
}

.hero {
  text-align: center;
  height: 90vh;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(ellipse 120% 80% at 70% 20%, rgba(255, 20, 145, 0.44), transparent 50%),
    radial-gradient(ellipse 100% 60% at 30% 30%, rgba(0, 255, 255, 0.21), transparent 60%),
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(137, 43, 226, 0.32), transparent 65%),
    radial-gradient(ellipse 110% 50% at 80% 50%, rgba(255, 217, 0, 0.10), transparent 40%),
    #000000;
  transition: 0.3s ease;
}

body.light-mode .hero {
  background: radial-gradient(ellipse 120% 80% at 70% 20%, rgba(255, 20, 145, 0.42), transparent 50%),
    radial-gradient(ellipse 100% 60% at 30% 30%, rgba(0, 255, 255, 0.36), transparent 60%),
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(138, 43, 226, 0.38), transparent 65%),
    radial-gradient(ellipse 110% 50% at 80% 50%, rgba(255, 215, 0, 0.40), transparent 40%),
    #ffffff;
}

.hero h1 {
  font-size: 4.2rem;
  font-weight: 500;
  margin-bottom: 10px;
  background: linear-gradient(to right, #ffffff, #ffeded, #fdc8c8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: 0.3s ease;
}

body.light-mode .hero h1 {
  background: linear-gradient(to right, #000000, #000000, #ce8f8f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero h2 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(to right, #ffffff, #d5d5d5, #511e1e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: 0.3s ease;
}

body.light-mode .hero h2 {
  background: linear-gradient(to right, #000000, #000000, #8f91ce);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.1rem;
  font-weight: 500;
  color: #989898;
  margin-bottom: 30px;
  transition: 0.3s ease;
}

body.light-mode .hero p {
  color: #484848;
}

.explore-btn {
  background: linear-gradient(120deg, #2268ff, #b253d7, #ff558e);
  background-size: 200% auto;
  color: white;
  text-decoration: none;
  width: max-content;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: background-position 0.5s ease, color 0.5s ease, transform 0.3s ease;
}

.explore-btn:hover {
  background-position: right center;
  color: #fff;
  transform: translateY(-2px);
}

.categories {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 50px 0;
  flex-direction: column;
  text-align: center;
  background-color: #000000;
}

body.light-mode .categories {
  background-color: #ffffff;
}

.categories h2 {
  font-size: 2rem;
  margin-bottom: 40px;
  color: #ffffff;
}

body.light-mode .categories h2 {
  color: #000000;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  padding: 0 20px;
  margin-left: 10%;
  margin-right: 10%;
}

.category-card img {
  width: 200px;
}

.category-card {
  background-color: #000000;
  box-shadow: 5px 5px 10px #ffffff2e;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.174);
  transition: all 0.3s ease-in-out;
  position: relative;
  overflow: hidden;
  text-align: center;
}

body.light-mode .category-card {
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.category-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 30px rgba(255, 255, 255, 0.15);
}

body.light-mode .category-card:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.category-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, #ff8a8e, #ffad96, #9d85d4, #ffb2e9);
}

.category-card h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e8e8e8;
  margin-top: 15px;
}

body.light-mode .category-card h3 {
  color: #333333;
}

.category-card p {
  font-size: 0.9rem;
  color: #b3b3b3;
  margin-top: 8px;
  margin-bottom: 20px;
}

body.light-mode .category-card p {
  color: #555555;
}

.category-card a {
  display: inline-block;
  width: 80%;
  padding: 8px 18px;
  border-radius: 8px;
  text-decoration: none;
  background: linear-gradient(90deg, #ff6c71, #7c5dc6);
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: 0.3s ease;
}

.category-card a:hover {
  background: linear-gradient(90deg, #ff7377, #896dc8);
}

.category-card:hover {
  transform: translateY(-5px);
}

.contact {
  background-color: #0c0c0c;
  color: #ffffff;
  padding: 50px 20px;
  text-align: center;
}

body.light-mode .contact {
  background-color: #f5f5f5;
  color: #000000;
}

.contact h2 {
  font-size: 2rem;
  margin-bottom: 20px;
}

.contact p {
  font-size: 1.1rem;
  margin-bottom: 30px;
}

.contact form {
  max-width: 600px;
  margin: 0 auto;
}

.contact form input,
.contact form textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: none;
  border-radius: 5px;
  background-color: #2e2e2e;
  color: #fff;
}

body.light-mode .contact form input {
  background-color: #dedede;
}

body.light-mode .contact form textarea {
  background-color: #dedede;
}

.contact button {
  background: #000032;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
}

.contact button:hover {
  background-color: #06063a;
}

.footer {
  background-color: #1b1b1b;
  text-align: center;
  padding: 20px;
}

body.light-mode .footer {
  background-color: #dfe0ff;
}

.footer p {
  font-size: 1rem;
  color: #ffffff;
}

body.light-mode .footer p {
  color: #000000;
}

/* sort page */

#sort-page {
  padding: 50px 20px;
  color: #f5f5f5;
  background: linear-gradient(135deg, #1c1c1e, #2a2a2e);
}

body.light-mode #sort-page {
  color: #2d2d2d;
  background: #ffffff;
}

.sort-selector {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin: 0 60px 40px 60px;
}

.sort-selector a {
  text-decoration: none;
  color: #fff;
}

.sort-btn {
  background: linear-gradient(90deg, #65b2ff, #cc9cf9);
  color: #ffffff;
  border-radius: 8px;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sort-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.sort-btn.active {
  background: linear-gradient(90deg, #ff9a9e, #fad0c4);
}

.sort-desc {
  margin: 60px;
  padding: 40px;
  border-radius: 16px;
  background: #2a2a2e;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  color: #ddd;
}

body.dark-mode .sort-desc {
  background: #ffffff;
  color: #444;
}

.sort-desc strong {
  color: white;
}

body.light-mode .sort-desc strong {
  color: rgb(0, 0, 0);
}

.defination1 {
  list-style-type: none;
  margin-left: 20px;
}

.working1 {
  margin-left: 40px;
}

body.light-mode .sort-desc {
  background-color: #d8d9ff;
  color: #212121;
}

.visualizer-layout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #2a2a2a;
  gap: 30px;
  margin: 60px;
  border-radius: 20px;
  padding: 20px 40px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

body.light-mode .visualizer-layout {
  background: #e5e7ff;
}

.left-panel {
  flex: 8;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.right-panel {
  flex: 3;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.step-info {
  background: #3a3a40;
  color: #eee;
  padding: 15px 30px;
  border-radius: 10px;
  font-size: 1rem;
  max-height: 320px;
  overflow-y: auto;
  transition: all 0.3s ease;
  height: 320px;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.05);
}

body.light-mode .step-info {
  background-color: #ffffff;
  color: #222;
}

.step-info li {
  padding: 4px 6px;
  margin-bottom: 3px;
  border-radius: 6px;
}

.step-info li.current {
  background-color: #5087d9;
  font-weight: bold;
  border-left: 4px solid #000d87;
}

.bar-wrapper {
  display: flex;
  flex-direction: column;
  overflow-x: auto;
}

.bars-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 400px;
  margin-top: 10px;
  background: #2f2f34;
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  width: 100%;
  min-width: 575px;
  justify-self: center;
  box-shadow: 6px 6px 10px rgba(0, 0, 0, 0.049);
}

body.light-mode .bars-container {
  background: #ffffff;
}

.bar-index-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9.5px;
  height: 40px;
  margin-top: 5px;
  font-size: 0.9rem;
  color: #aaa;
  width: 100%;
  min-width: max-content;
  padding: 15px;
}

#codeBox {
  background: #1e1e1e;
  padding: 0.8em;
  border-radius: 8px;
  color: #f1f1f1;
  overflow-x: auto;
}

.bar-index {
  width: 30px;
  text-align: center;
  font-weight: bold;
  color: #ccc;
}

body.light-mode .bar-index {
  color: #000000;
}

.bar {
  font-size: 12px;
  font-weight: bold;
  color: #212121;
  width: 30px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 6px;
  transition: height 0.4s ease, background-color 0.4s ease;
  box-shadow: 0 2px 5px #00000037;
}

.bar.default-bar {
  background: linear-gradient(180deg, #00a2ff, #b0e3ff);
}

.bar.comparing {
  background: linear-gradient(180deg, gold, #fff8b7) !important;
  /* animation: comparePulse 0.6s ease; */
}

/* @keyframes comparePulse {
  from {
    box-shadow: 0 0 8px yellow, 0 0 2px gold;
    transform: scale(1);
  }
  to {
    box-shadow: 0 0 20px orange, 0 0 1px gold;
    transform: scale(1.01);
  }
} */

.bar.swapping {
  background: linear-gradient(180deg, #d32f2f, #ffb2b2) !important;
  /* animation: swapLift 0.5s ease; */
}

/* @keyframes swapLift {
  0%   { transform: translateY(0) scale(1); }
  50%  { transform: translateY(-5px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
} */

.bar.sorted {
  background: linear-gradient(180deg, #057534, #5df09a) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Add this class to your existing CSS file */
.bar.sorted-permanent {
    background: linear-gradient(180deg, #057534, #5df09a) !important;
    box-shadow: 0 2px 8px rgba(27, 94, 32, 0.6);
}

.input-section input {
  padding: 10px;
  width: 60%;
  max-width: 300px;
  border-radius: 5px;
  border: none;
  margin-right: 10px;
}

body.light-mode .input-section input {
  background-color: #ffffff;
}

body.light-mode .input-section button {
  background-color: #4c70ff;
}

body.light-mode .input-section button:hover {
  background-color: #1f46e2;
  color: #ffffff;
}

.control-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.control-panel button,
.control-panel input[type="range"] {
  padding: 8px 12px;
  font-size: 1rem;
  border-radius: 5px;
  border: none;
}

.control-panel button,
.input-section button,
.sort-lan-btn {
  background: linear-gradient(90deg, #448cff, #87d9ff);
  border: none;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.control-panel button:hover,
.input-section button:hover{
  background: linear-gradient(90deg, #ff7b7f, #ffbeaa);
}

.speed {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-lan-selector {
  margin: 40px 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.sort-lan-btn:hover{
  transform: translateY(-3px);
}

.sort-lan-btn.active {
  background: linear-gradient(90deg, #ff7b7f, #ffbeaa);
}

.code-display {
  margin: 60px;
  padding: 40px;
  background: #2b2b30;
  border-radius: 12px;
  color: #fff;
  white-space: pre-wrap;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

body.light-mode .code-display {
  background: #e0e0e0;
  color: #000;
}

.code-display p {
  font-size: 1.1rem;
}

#copy-btn {
  width: 25px;
  height: 25px;
  background: linear-gradient(90deg, #70a7ff, #afe6ff);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  align-self: flex-end;
  display: flex;
  justify-content: center;
  align-items: center;
  position: sticky;
  top: 80px;
}

#copy-btn:hover{
  background: linear-gradient(90deg, #ff7b7f, #ffbeaa);
}

.alert-new{
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(90deg, #a0ff8e, #57d876);
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 5px;
}

.alert-commingSoon{
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(90deg, #ffbeaa, #ff7b7f);
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 5px;
}

@media (max-width: 1220px) {

  /* home page */
  .hero h1 {
    font-size: 3.8rem;
    font-weight: 500;
  }

  .hero h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 10px;
  }

  .hero p {
    font-size: 0.9rem;
  }

  .footer p {
    font-size: 0.8rem;
  }

  /* sort page */
  .visualizer-layout {
    flex-direction: column;
    align-items: stretch;
    margin: 60px;
    padding: 20px;
    gap: 20px;
  }

  .left-panel,
  .right-panel {
    flex: none;
    width: 100%;
  }

  .step-info {
    height: 320px;
    max-height: 320px;
    flex-shrink: 0;
  }
}

@media screen and (max-width: 768px) {
  .logo {
    font-size: 1.5rem;
  }

  .nav-links {
    display: none;
  }

  .menuIcon,
  .closeIcon {
    display: block;
    font-size: 30px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    width: 30px;
  }

  body.light-mode .menuIcon,
  body.light-mode .closeIcon {
    color: #05021a;
  }

  .hero {
    text-align: center;
    height: 80vh;
  }

  .hero-content {
    margin-bottom: 100px;
  }

  .hero h1 {
    font-size: 1.7rem;
    font-weight: 700;
  }

  .hero h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
  }

  .hero p {
    font-size: 0.6rem;
  }

  .footer p {
    font-size: 0.6rem;
  }

  .sort-selector {
    margin: 0 20px 40px 20px;
  }

  .sort-desc h2 {
    font-size: 0.9rem;
  }

  .sort-desc p {
    font-size: 0.8rem;
  }

  .visualizer-layout {
    margin: 15px;
    padding: 15px;
    gap: 15px;
  }

  .left-panel,
  .right-panel {
    width: 100%;
  }

  .step-info {
    height: 320px;
    max-height: 320px;
    font-size: 1rem;
    padding: 10px 20px;
  }

  .input-section label {
    font-size: 0.9rem;
    font-weight: 700;
  }

  .input-section input {
    margin-bottom: 10px;
    width: 40%;
  }

  .sort-desc {
    font-size: 0.95rem;
    padding: 20px;
    margin: 20px;
    margin-bottom: 50px;
  }

  .bar-wrapper {
    width: 100%;
    overflow-x: auto;
  }

  .bars-container {
    justify-content: center;
    min-width: max-content;
    padding: 10px;
  }

  .bar-index-container {
    justify-content: center;
    min-width: max-content;
    padding: 15px;
    gap: 10px;
  }

  .bar {
    width: 14px;
    flex-shrink: 0;
  }

  .code-display {
    padding: 15px;
    margin: 20px;
  }

  .code-display p {
    font-size: 0.8rem;
  }

  .sort-lan-selector {
    margin: 40px 20px;
  }

  #codeBox {
    font-size: 0.5rem;
  }
}


#notification-container {
  position: fixed;
  top: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.notification {
  background: #222;
  padding: 15px 20px;
  border-radius: 8px;
  min-width: 250px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideIn 0.4s ease, fadeOut 0.5s ease forwards;
  animation-delay: 0s, 3.5s;
}

.notification.success {
  border-left: 5px solid #22c55e;
}
.notification.error {
  border-left: 5px solid #ef4444;
}

.notification span {
  flex: 1;
  margin-right: 10px;
}

.notification-close {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 18px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}