/* General Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Public Sans', sans-serif;
}

/* Anchor tag reset */
a,
a:link,
a:visited {
  color: inherit;
  text-decoration: none;
  background-color: transparent;
  -webkit-tap-highlight-color: transparent;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 3rem;
  background: linear-gradient(
    90deg,
    #fbb69f,
    #f68c6e,
    #f16363
  ); /* warm, soft professional gradient */
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.logo-container {
  display: flex;
  align-items: center;
  gap: 15px; /* space between logo and text */
}

.logo-img img {
  height: 50px;
  width: 50px;
}

.navbar .nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.navbar .nav-links li a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.navbar .nav-links li a:hover {
  color: #ffe5d4; /* subtle highlight */
}

/* Navbar Buttons */
.navbar .nav-links li a {
  display: inline-block;
  padding: 8px 20px;
  color: #fff;
  font-weight: 500;
  text-decoration: none;
  border-radius: 5px; /* rounded pill shape */
  background: linear-gradient(
    90deg,
    #f5c686,
    #ffcc70,
    #ffd9a6
  ); /* warm professional gradient */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.3s,
    box-shadow 0.3s,
    background 0.3s;
}

/* Hover effect */
.navbar .nav-links li a:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
  background: linear-gradient(
    90deg,
    #ffd9a6,
    #ffcc70,
    #ffb347
  ); /* subtle gradient shift */
}

/* Optional active button style */
.navbar .nav-links li a.active {
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
  background: linear-gradient(90deg, #ffcc70, #ffb347, #ffd9a6);
}

.navbar .logo {
  font-size: 1.7rem;
  font-weight: bold;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 0;
  background: linear-gradient(90deg, #fbb69f, #f68c6e, #f16363);
  color: #fff;
  margin-top: 3rem;
  font-size: 0.95rem;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.08);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
}

.footer-links a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition:
    color 0.2s,
    text-decoration 0.2s;
  padding: 0.5rem;
  border-radius: 4px;
}

.footer-links a:hover,
.footer-links a:focus {
  color: #ffe5d4;
  outline: 2px solid #ffe5d4;
  outline-offset: 2px;
}

.footer-links a:focus {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .card-container {
    flex-direction: column;
    align-items: center;
  }
  .navbar {
    flex-direction: column;
    gap: 1rem;
  }
}

/* Main Content */
main {
  padding: 3rem 2rem;
  text-align: center;
  background: #faf7f5;
}

main h1 {
  margin-bottom: 2.5rem;
  font-size: 2.5rem;
  color: #f16363; /* warm professional tone */
}

/* Cards */
.card-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
}

.card {
  background: #e9e9e1; /* soft cream/off-white */
  border-radius: 12px;
  padding: 2rem;
  width: 250px;
  cursor: pointer;
  transition:
    transform 0.25s,
    box-shadow 0.25s;
  box-shadow: 0 4px 10px rgba(0.9, 0.9, 0.9, 0.88);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.card h3 {
  margin-bottom: 1rem;
  color: black; 
  font-weight: 600;
}

.card p {
  color: #555;
  font-size: 0.95rem;
}

/* Heading underline animation */
main h1 {
  margin-bottom: 2.5rem;
  font-size: 2.5rem;
  color: #f16363; /* heading color remains warm red */
  position: relative;
  display: inline-block;
}

/* Moving gradient line with professional colors */
main h1::after {
  content: '';
  display: block;
  height: 4px; /* slightly thicker for visibility */
  width: 100%;
  border-radius: 3px;
  margin-top: 10px;
  background: linear-gradient(90deg, #ffb347, #ffcc70, #ffd9a6, #ffb347);
  background-size: 300% 100%;
  animation: moveLine 1s linear infinite;
}

@keyframes moveLine {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 0%;
  }
}
/* Right side container (links + snake button) */
.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem; /* space between links and button */
}

/* styling for Recently Viewed section */

.recently-viewed-sidebar {
  top: 100px;
  right: 20px;
  max-width: 55px;
  max-height: 50px;
  overflow: hidden;
  transition:
    max-width 0.3s ease-in-out,
    max-height 0.3s ease-in-out;
  white-space: nowrap;
  cursor: pointer;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  font-family: sans-serif;
  /*z-index: 1000;*/
}

/* Custom fix for clock icon misalignment in collapsed state */
.recently-viewed-sidebar h2 {
  /* Nudges the icon up slightly when collapsed */
  transform: translateY(-2px);
}

.recently-viewed-sidebar:hover {
  max-width: 500px;
  max-height: 700px;
}

#recently-viewed-list,
#clear-history-btn,
.recently-viewed-sidebar h2 span {
  opacity: 0;
  transition: opacity 0.1s ease-in-out;
}

.recently-viewed-sidebar:hover #recently-viewed-list,
.recently-viewed-sidebar:hover #clear-history-btn,
.recently-viewed-sidebar:hover h2 span {
  opacity: 1;
  transition: opacity 0.2s ease-in-out;
  transition-delay: 0.15s;
}

.recently-viewed-sidebar h2 {
  margin-top: 0;
  font-size: 1.2rem;
  color: #343a40;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
}

.recently-viewed-sidebar:hover h2 {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom-color: #007bff;
}

#recently-viewed-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

#recently-viewed-list li {
  margin-bottom: 12px;
}

#recently-viewed-list a {
  text-decoration: none;
  color: #0056b3;
  font-weight: 500;
}

#recently-viewed-list a:hover {
  text-decoration: underline;
}

#clear-history-btn {
  width: 100%;
  margin-top: 15px;
  padding: 8px;
  border: 1px solid #dc3545;
  background-color: transparent;
  color: #dc3545;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

#clear-history-btn:hover {
  background-color: #dc3545;
  color: white;
}

/* Fix Recently Viewed clock alignment */
.recently-viewed-sidebar h2 {
  display: flex;
  align-items: center; /* vertical center */
  gap: 6px; /* gap between emoji and text */
  font-size: 1.2rem;
  color: #343a40;
}

/* @media (max-width: 992px) {
    .recently-viewed-sidebar {
        display: none;
    }
} */

/* Dark Mode Toggle Button */
.dark-mode-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 25px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.dark-mode-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.dark-mode-btn.active {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Dark Mode Styles */
body.dark-mode {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #e0e0e0;
  transition: all 0.4s ease;
}

body.dark-mode main {
  background: transparent;
}

body.dark-mode main h1 {
  color: #bb86fc;
  text-shadow: 0 0 20px rgba(187, 134, 252, 0.3);
}

body.dark-mode main h1::after {
  background: linear-gradient(90deg, #bb86fc, #cf6679, #03dac6, #bb86fc);
  background-size: 300% 100%;
}

/* Dark Mode Navbar */
body.dark-mode .navbar {
  background: linear-gradient(90deg, #6a11cb 0%, #2575fc 100%);
  box-shadow: 0 4px 20px rgba(106, 17, 203, 0.4);
}

body.dark-mode .navbar .nav-links li a {
  background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
  background-size: 200% 100%;
}

body.dark-mode .navbar .nav-links li a:hover {
  background: linear-gradient(90deg, #764ba2, #667eea, #764ba2);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

/* Dark Mode Cards */
body.dark-mode .card {
  background: linear-gradient(145deg, #2d2d44, #1f1f33);
  color: #e0e0e0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(187, 134, 252, 0.2);
}

body.dark-mode .card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(187, 134, 252, 0.4);
  border-color: rgba(187, 134, 252, 0.5);
}

body.dark-mode .card h3 {
  color: #bb86fc;
}

body.dark-mode .card p {
  color: #b0b0b0;
}

/* Dark Mode Footer */
body.dark-mode footer {
  background: linear-gradient(90deg, #6a11cb 0%, #2575fc 100%);
  box-shadow: 0 -4px 20px rgba(106, 17, 203, 0.3);
}

/* Dark Mode Recently Viewed Sidebar */
body.dark-mode .recently-viewed-sidebar {
  background-color: #2d2d44;
  border: 1px solid rgba(187, 134, 252, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

body.dark-mode .recently-viewed-sidebar h2 {
  color: #bb86fc;
}

body.dark-mode .recently-viewed-sidebar:hover h2 {
  border-bottom-color: #bb86fc;
}

body.dark-mode #recently-viewed-list a {
  color: #03dac6;
}

body.dark-mode #recently-viewed-list a:hover {
  color: #bb86fc;
}

body.dark-mode #clear-history-btn {
  border-color: #cf6679;
  color: #cf6679;
}

body.dark-mode #clear-history-btn:hover {
  background-color: #cf6679;
  color: white;
}

/* Dark Mode - Problem Statement Box */
body.dark-mode .problem-statement,
body.dark-mode .problem-box,
body.dark-mode .approach-box,
body.dark-mode .approach-section {
  background-color: #2d2d44;
  color: #e0e0e0;
  border: 1px solid rgba(187, 134, 252, 0.3);
}

body.dark-mode .problem-statement h2,
body.dark-mode .problem-statement h3,
body.dark-mode .approach-box h2,
body.dark-mode .approach-box h3 {
  color: #bb86fc;
}

body.dark-mode .problem-statement p,
body.dark-mode .approach-box p,
body.dark-mode .explanation,
body.dark-mode .time-complexity,
body.dark-mode .space-complexity {
  color: #b0b0b0;
}

/* Dark Mode - Code Blocks */
body.dark-mode pre,
body.dark-mode code {
  background-color: #1a1a2e;
  color: #03dac6;
  border: 1px solid rgba(187, 134, 252, 0.2);
}

/* Dark Mode - Breadcrumb Navigation */
body.dark-mode .breadcrumb,
body.dark-mode .breadcrumb a {
  color: #b0b0b0;
}

body.dark-mode .breadcrumb a:hover {
  color: #bb86fc;
}

/* Dark Mode - Example text */
body.dark-mode .example,
body.dark-mode .example-text {
  color: #e0e0e0;
}

/* Dark Mode - Problem Statement box text color fix only */
body.dark-mode .problem-statement p,
body.dark-mode .problem-statement span,
body.dark-mode .problem-statement li {
  color: #000 !important;
}

body.dark-mode .problem-statement h2 {
  color: #0056b3 !important;
}

body.dark-mode .problem-statement strong,
body.dark-mode .problem-statement .example {
  color: #d32f2f !important;
}
