/* General Body Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #ffffff;
    color: #000000;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #1a202c;
    color: #ffffff;
}

/* Navigation Bar */
.navbar {
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

body.dark-mode .navbar {
    background-color: #2d3748;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4FD1C5;
    text-decoration: none;
}

.logo:hover {
    color: #38b2ac;
}

.nav-links {
    display: flex;
    justify-content: flex-end;
    flex-grow: 1;
    align-items: center;
    gap: 1.5rem; /* Increased gap between elements */
}

.search-container {
    position: relative;
    width: 220px; /* Slightly wider to accommodate the button */
    transition: width 0.3s ease;
    margin-right: 2.5rem; /* Increased margin for better spacing */
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 1rem;
    border: 1px solid #4FD1C5;
    border-radius: 50px;
    background-color: transparent;
    color: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-icon-btn {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #4FD1C5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.search-icon-btn svg {
    display: block;
}

body.dark-mode .search-icon {
    color: #e2e8f0;
}

.search-input:focus {
    border-color: #38b2ac;
    box-shadow: 0 0 0 2px rgba(79, 209, 197, 0.2);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
}

body.dark-mode .search-results {
    background-color: #2d3748;
    border-color: #4a5568;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #2d3748;
    text-decoration: none;
    display: block;
}

.search-result-item:hover {
    background-color: #f7fafc;
}

body.dark-mode .search-result-item {
    color: #e2e8f0;
}

body.dark-mode .search-result-item:hover {
    background-color: #4a5568;
}

.navbar a {
    color: #000000;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode .navbar a {
    color: #ffffff;
}

.navbar a:hover, .navbar a.active {
    background-color: #4FD1C5;
    color: #ffffff;
}

body.dark-mode .navbar a:hover, body.dark-mode .navbar a.active {
    color: #000000;
}

/* Mode Toggle Button */
.mode-toggle {
    background-color: transparent;
    border: 1px solid #4FD1C5;
    color: #4FD1C5;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    position: relative;
}

.mode-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

/* Sun (light mode) */
.mode-icon .sun {
    opacity: 1;
    transform: scale(1);
    transform-origin: center;
    transition: opacity 0.3s, transform 0.3s;
}

.mode-icon .moon {
    opacity: 0;
    transform: scale(0.6) rotate(-30deg);
    transform-origin: center;
    transition: opacity 0.3s, transform 0.3s;
    fill: none;
    stroke: currentColor;
}

/* Moon (dark mode) */
body.dark-mode .mode-icon .sun {
    opacity: 0;
    transform: scale(0.3) rotate(60deg);
}

body.dark-mode .mode-icon .moon {
    opacity: 1;
    transform: scale(1) rotate(0);
}

/* Hover effects */
.mode-toggle:hover {
    background-color: #4FD1C5;
}

.mode-toggle:hover .mode-icon {
    color: #ffffff;
}

body.dark-mode .mode-toggle:hover .mode-icon {
    color: #000000;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background-color: #f7fafc;
}

body.dark-mode .hero {
    background-color: #2d3748;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: #4FD1C5;
}

.hero p {
    font-size: 1.2rem;
    color: #718096;
}

body.dark-mode .hero p {
    color: #a0aec0;
}

/* Category Section */
.category-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 2rem;
    gap: 1.5rem;
}

.category-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
    width: 250px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

body.dark-mode .category-card {
    background-color: #2d3748;
    border-color: #4a5568;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

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

.category-card h3 {
    margin-top: 0;
    color: #4FD1C5;
}

/* Question List Page */
.question-list-container {
    padding: 2rem;
    max-width: 800px;
    margin: auto;
}

.question-item {
    background-color: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    cursor: pointer;
    padding: 1rem;
    transition: background-color 0.3s;
}

body.dark-mode .question-item {
    background-color: #2d3748;
    border-color: #4a5568;
}

.question-item:hover {
    background-color: #e2e8f0;
}

body.dark-mode .question-item:hover {
    background-color: #4a5568;
}

.question-title {
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.answer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    display: none; /* Hidden by default */
}

body.dark-mode .answer {
    border-top-color: #4a5568;
}

/* Footer */
.footer {
    background-color: #4FD1C5;
    color: #ffffff;
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

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

.sub-navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f7fafc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 999;
}

body.dark-mode .sub-navbar-container {
    background-color: #2d3748;
}

.scroll-btn {
    background-color: transparent;
    border: none;
    color: #4FD1C5;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 1rem;
}

.scroll-btn:hover {
    color: #38b2ac;
}

/* Sub-navbar */
.sub-navbar {
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
}

.sub-nav-links {
    display: flex;
    transition: transform 0.3s;
}

.sub-navbar a {
    color: #000000;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode .sub-navbar a {
    color: #ffffff;
}

.sub-navbar a:hover, .sub-navbar a.active {
    background-color: #4FD1C5;
    color: #ffffff;
}

body.dark-mode .sub-navbar a:hover, body.dark-mode .sub-navbar a.active {
    color: #000000;
}

/* DSA Page New Layout */
.dsa-container-new {
    display: flex;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
    background-color: #f7fafc;
    padding: 1rem;
    border-right: 1px solid #e2e8f0;
}

body.dark-mode .sidebar {
    background-color: #2d3748;
    border-right-color: #4a5568;
}

.sidebar h2 {
    margin-top: 0;
}

.question-link {
    display: block;
    padding: 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: #000000;
    margin-bottom: 0.5rem;
}

.question-link:hover {
    background-color: #e2e8f0;
}

.question-link.active {
    background-color: #4FD1C5;
    color: #ffffff;
}

body.dark-mode .question-link {
    color: #ffffff;
}

body.dark-mode .question-link:hover {
    background-color: #4a5568;
}

body.dark-mode .question-link.active {
    color: #000000;
}

.main-content {
    flex-grow: 1;
    padding: 1rem;
}

.answer-content-new {
    display: none;
}

.answer-content-new.active {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
}