/* Reset and Global Styles */
:root {
    --bg-color: #ffffff;
    --text-color: #1e1e1e;
    --menu-bg: #222;
    --menu-text: #ffffff;
    --accent: #00ffcc;
    --hover-color: var(--accent);
}

/* Dark Theme */
.dark-mode {
    --bg-color: #1e1e1e;
    --text-color: #ffffff;
    --menu-bg: #111;
    --menu-text: #cccccc;
}
/* (Removed unused .light-mode CSS variable tokens) */
h1, h2, p, a, span {
    color: var(--text-color);
}
/* (Deduped: base .algo-card styles defined later) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}
/* Smooth transition for theme change */
* {
    transition: background-color 0.5s ease, color 0.5s ease;
}


/* Body Styling */
body {
    background: var(--bg-color);
    color: var(--text-color);
    transition: background 0.3s ease-in-out, color 0.3s ease-in-out;
}

.menu-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Hamburger button */
.menu-toggle {
    font-size: 24px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: none; /* Hidden by default for larger screens */
}

/* Menu items */
.menu-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex; /* Default: show all menu items */
}

.menu-items li {
    padding: 10px;
}

.menu-items li a {
    color: white;
    text-decoration: none;
}

/* Collapsed menu (for small screens) */
@media (max-width: 768px) {
    .menu-toggle {
        display: block; /* Show the button */
    }

    .menu-items {
        display: none; /* Hide the menu initially */
        flex-direction: column;
        background: #444;
        position: absolute;
        top: 50px;
        left: 0;
        width: 100%;
    }

    .menu-items.active {
        display: flex; /* Show when active */
    }
}

/* Ensure main content is not hidden */
.main-content {
    padding-top: 80px; /* Prevent overlap with fixed menu */
}

/* Navigation Menu */
.menu {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-color);
    padding: 12px 24px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Menu Links */
.menu a {
    text-decoration: none;
    color: var(--text-color);
    padding: 14px 22px;
    margin: 0 10px;
    font-size: 20px;
    font-weight: 500;
    position: relative;
    transition: 0.3s ease-in-out;
}

/* Hover Effect */
.menu a::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 0;
    height: 3px;
    background: var(--accent);
    transition: 0.3s ease-in-out;
    transform: translateX(-50%);
}

.menu a:hover {
    color: var(--accent);
}

.menu a:hover::after {
    width: 100%;
}

.theme-toggle {
    position: absolute;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;  /* Reduce padding to prevent extra space */
    display: flex; /* Ensures it takes only necessary space */
    align-items: center;
    justify-content: center;
}

#theme-toggle {
    background: transparent;
    border: none;
    color: var(--menu-text);
    font-size: 20px;
    cursor: pointer;
    margin-left: 20px;
    transition: color 0.3s ease-in-out;
}

#theme-toggle:hover {
    color: var(--hover-color);
}
/* Hero Section */
.hero {
    height: 100;
    text-align: center;
    padding: 100px 20px;
    background: linear-gradient(to right, #0f172a, #2563eb);
    border-bottom-left-radius: 50% 20px;
    border-bottom-right-radius: 50% 20px;
    animation: fadeIn 1s ease-in-out;
}

.hero-content {
    max-width: 800px;
    margin: auto;
    color: white;
    animation: slideDown 1s ease-in-out;
}

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

.hero h2 {
    font-size: 1.6rem;
    font-weight: 500;
    opacity: 0.9;
}

.hero p {
    font-size: 1.2rem;
    margin: 15px 0;
    opacity: 0.85;
}

.hero-buttons {
    margin-top: 20px;
}

.btn {
    display: inline-block;
    margin: 10px 10px;
    padding: 12px 20px;
    background: var(--accent);
    color: #1e1e1e;
    text-decoration: none;
    font-weight: bold;
    border-radius: 8px;
    transition: 0.3s ease-in-out;
}

.secondary-btn {
    background: #ffffff;
    color: #1e1e1e;
    border: 2px solid var(--accent);
}

.btn:hover {
    background: var(--accent);
    transform: scale(1.05);
}

.secondary-btn:hover {
    background: var(--accent);
    color: #1e1e1e;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}


@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.how-it-works {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-color);
    color: var(--text-color);
}

.how-it-works h2 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.how-it-works p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.algorithms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: auto;
}

.algo-card {
    display: block; /* clickable anchor cards */
    background: #ffffff; /* Light mode: white card */
    color: #1e1e1e;      /* Light mode: dark text */
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s;
    text-decoration: none;
}

.algo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Dark Mode Adjustments */
.dark-mode .how-it-works {
    background: #121212;
    color: #ffffff;
}

.dark-mode .algo-card {
    background: #222;
    color: #ddd;
}
.algo-card {
    background: #ffffff; /* Light mode: white card */
    color: #1e1e1e;      /* Light mode: dark text */
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s, background 0.3s, color 0.3s;
    border: 2px solid transparent;
}

/* Hover Effects */
.algo-card:hover {
    transform: translateY(-5px) scale(1.05);
    background: var(--hover-color);
    color: #000;
    border-color: #fff;
    box-shadow: 0 5px 10px rgba(0, 255, 204, 0.4);
}

/* Dark Mode Adjustments */
.dark-mode .algo-card {
    background: #121212;
    color: #ffffff;
    border: 2px solid #444;
}

.dark-mode .algo-card:hover {
    background: var(--hover-color);
    color: #000;
    border-color: #fff;
    box-shadow: 0 8px 16px rgba(0, 255, 204, 0.6);
}
/* Algorithm Selection Section */
.algorithm-selection {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-color);
    color: var(--text-color);
}

.algorithm-selection h2 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.algorithm-selection p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

/* Grid Layout for Algorithm Selection */
/* Adjusted Grid Layout */
.algo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    gap: 20px;
    max-width: 800px;
    margin: auto;
}

/* Place the final tile (Radix Sort) centered under Merge Sort on wide screens */
@media (min-width: 769px) {
    .algo-grid {
        grid-template-columns: repeat(3, auto);
        justify-content: center;
    }
    .algo-grid .algo-option { width: 240px; }
    .algo-grid .algo-option:last-child { grid-column: 2; }
}

/* Individual Algorithm Selection Boxes */
.algo-option {
    background: #000000; /* Light mode: black tiles */
    color: #ffffff;       /* Light mode: white text */
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    border: 2px solid transparent;
}

.algo-option h3 { color: #ffffff; }

/* Hover Effects */
.algo-option:hover {
    background: var(--hover-color);
    color: black;
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(0, 255, 204, 0.4);
}
.algo-card:last-child{
  grid-column: 2;
  justify-self: center;
}

/* Dark Mode Compatibility */
.dark-mode .algorithm-selection {
    background: var(--bg-color);
    color: var(--text-color);
}

.dark-mode .algo-option {
    background: #222222; /* Dark mode: dark tiles */
    color: #ffffff;      /* Dark mode: white text */
    border: 2px solid #444;
}

.dark-mode .algo-option h3 { color: #ffffff; }

.dark-mode .algo-option:hover {
    background: var(--hover-color);
    color: black;
}

/* Testimonials Section */
.testimonials {
    text-align: center;
    padding: 50px 20px;
    background: #f9f9f9;
}

.testimonial-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.testimonial {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-width: 300px;
    transition: transform 0.3s ease-in-out;
}

.testimonial:hover {
    transform: scale(1.05);
}

/* Dark Mode for Testimonials */
.dark-mode .testimonials {
    background: #1e1e1e;
    color: white;
}

.dark-mode .testimonial {
    background: #222;
    color: #ddd;
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1);
}

/* FAQ Section */
.faq {
    text-align: center;
    padding: 50px 20px;
}

.faq-container {
    max-width: 700px;
    margin: auto;
    text-align: left;
}

.faq-item {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}

.faq-item:hover {
    transform: scale(1.02);
}

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

.dark-mode .faq-item {
    background: #222;
    color: #ddd;
    box-shadow: 0 2px 5px rgba(255, 255, 255, 0.1);
}
/* Algorithm Intro Section */
.algorithm-intro {
    text-align: center;
    padding: 50px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
}

.algorithm-intro h1 {
    font-size: 2.5rem;
}

.algorithm-intro p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: auto;
}

/* Algorithm List */
.algorithm-list {
    display: flex;
    flex-wrap: wrap; /* Ensures cards wrap properly */
    justify-content: center; /* Centers the cards */
    gap: 20px;
    padding: 50px;
}

.algorithm-list .algo-card {
    flex: 1 1 300px; /* Ensures proper sizing */
    max-width: 350px; /* Prevents stretching */
    min-width: 280px; /* Ensures they don't shrink too much */
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.algorithm-list .algo-card h2 {
    color: #1e3c72;
    font-size: 1.5rem;
}

.algorithm-list .algo-card p {
    font-size: 1rem;
}

/* Hover Effect */
.algorithm-list .algo-card:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Dark mode overrides for algorithms page cards */
.dark-mode .algorithm-list .algo-card {
    background: #1e1e1e;
    color: #ffffff;
    border: 1px solid #444;
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.06);
}
.dark-mode .algorithm-list .algo-card h2 { color: #ffffff; }
.dark-mode .algorithm-list .algo-card p { color: #dddddd; }
.dark-mode .algorithm-list .algo-card:hover {
    box-shadow: 0 6px 15px rgba(255, 255, 255, 0.12);
}



/* Algorithm Page Header */
.algo-intro {
    background: linear-gradient(to right, #0044cc, #0088ff);
    color: white;
    text-align: center;
    padding: 50px 20px;
}

.algo-intro h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.algo-intro p {
    font-size: 1.2rem;
}

/* Algorithm Details Section */
.algo-details {
    max-width: 1000px;
    margin: 48px auto;
    padding: 28px;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0px 6px 16px rgba(0, 0, 0, 0.12);
}

.algo-details h2 {
    font-size: 2rem;
    line-height: 1.3;
    margin-bottom: 12px;
    color: #222;
}

.algo-details ul {
    list-style: disc;
    margin: 12px 0 18px 22px;
    line-height: 1.7;
}

.algo-details p {
    font-size: 1.1rem;
    line-height: 1.75;
    margin-bottom: 12px;
}

/* Example Section */
pre {
    background: #2d2d2d;
    color: #ffffff;
    padding: 18px;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 1rem;
}

/* Media/GIF section: keep visuals clean and prevent internal scrollbars */
.algo-details .example,
.algo-details figure,
.algo-details .image-box,
.algo-details .gif-box {
    margin: 18px 0 22px 0;
    border-radius: 10px;
    overflow: hidden; /* prevent scrollbars inside the container */
    background: #222;
}

.algo-details img,
.algo-details video,
.algo-details .gif-box img,
.algo-details .gif-box video {
    display: block;
    width: 100%;
    height: auto;
}

/* Dark mode readability for details */
.dark-mode .algo-details {
    background: #1b1b1b;
    color: #eaeaea;
    box-shadow: 0 6px 16px rgba(255,255,255,0.06);
}
.dark-mode .algo-details h2 { color: #ffffff; }
.dark-mode .algo-details p { color: #e0e0e0; }
.dark-mode pre { background: #333; }

/* Visualizer Link */
.visualizer-link {
    text-align: center;
    margin: 30px 0;
}

.visualizer-link a {
    display: inline-block;
    padding: 12px 20px;
    background: #0088ff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1.2rem;
    transition: background 0.3s ease;
}

.visualizer-link a:hover {
    background: #005bb5;
}

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

.dark-mode .algo-details {
    background: #1e1e1e;
    color: white;
}

.dark-mode pre {
    background: #444;
}

/* Default (Light Mode) */
body {
    background-color: #ffffff;
    color: #000000;
}

h1, h2, h3 {
    color: var(--text-color);
}

.dark-mode h1, 
.dark-mode h2, 
.dark-mode h3 {
    color: #f5f5f5; /* Ensuring headings are visible in dark mode */
}
/* Smooth transition for theme change (deduped) */
/* Already defined earlier for background/color; keep others minimal if needed */
h1, h2, h3, h4, h5, h6, p, li {
    color: var(--text-color);
}
/* Sorting Visualizer Section */
.visualizer-container {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-color);
    color: var(--text-color);
}

.visualizer-container h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.visualizer-container p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

/* Visualizer-specific control alignment */
.visualizer-container .controls {
    display: grid;
    grid-template-columns: 180px 1fr auto auto auto auto;
    align-items: center;
    gap: 12px;
}
.visualizer-container .controls select { min-width: 160px; }
.visualizer-container #arrayInput { min-width: 360px; }
.visualizer-container #speedDisplay { width: 60px; text-align: right; }
.visualizer-container #startBtn {
    grid-column: 1 / -1;
    justify-self: center;
}

/* Center the visualizer content and add safe horizontal padding */
.visualizer-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.controls label {
    font-size: 1rem;
    font-weight: 500;
}

.controls select, 
.controls input, 
.controls button {
    padding: 8px 12px;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid var(--text-color);
    transition: 0.3s ease-in-out;
}

.controls select, 
.controls input {
    background: var(--bg-color);
    color: var(--text-color);
}

.controls button {
    background: var(--accent);
    color: black;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.3s;
    border: none;
}

.controls button:hover {
    background: var(--accent);
    transform: scale(1.05);
}

/* Controls card container used on visualizer page */
.controls-card {
    max-width: 1000px;
    margin: 0 auto 20px auto;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    padding: 16px;
}

.dark-mode .controls-card {
    background: #1e1e1e;
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.06);
}

/* Array Container */
.array-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 300px;
    margin-top: 20px;
    gap: 4px;
}

/* Base bar styling for visualizer (light mode defaults) */
.bar {
    width: 20px;
    background: #0088ff;
    transition: height 0.3s ease;
}

/* (Removed redundant hard-coded dark body styles to rely on theme tokens) */

.container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 300px; /* Height of the container */
    margin: 20px; /* Margin around the container */
}

.block {
    width: 20px; /* Width of each block */
    margin: 0 2px; /* Margin between blocks */
    background-color: #007bff; /* Block color */
    transition: height 0.5s ease; /* Smooth transition for height change */
}

.button {
    background-color: #4caf50; /* Button color */
    color: white; /* Button text color */
    padding: 10px 20px; /* Padding inside buttons */
    text-align: center; /* Center text */
    border: none; /* No border */
    border-radius: 5px; /* Rounded corners */
    cursor: pointer; /* Cursor pointer on hover */
    margin: 10px; /* Margin around buttons */
}

.button:hover {
    background-color: #45a049; /* Darker green on hover */
}

.slider {
    margin: 20px; /* Margin around sliders */
}

/* Dark Mode Adjustments */
.dark-mode .visualizer-container {
    background: #121212;
    color: #ffffff;
}

.dark-mode .controls select, 
.dark-mode .controls input {
    background: #222;
    color: #ddd;
    border: 1px solid #444;
}

.dark-mode .bar {
    background: #3399ff;
}

.dark-mode .bar.sorted {
    background: #00ffcc !important;
}

.dark-mode .bar.swapping {
    background: #ff5733 !important;
}

/* Legend chips for visualizer */
.legend {
    margin: 10px auto 20px auto;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}
.chip {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    margin: 0 6px 0 16px;
    vertical-align: middle;
}
.chip-compare { background: #ff4081; }
.chip-swap { background: #ff5733; }
.chip-sorted { background: #00ffcc; }

/* Visualizer tiles (number blocks) */
.block {
    border: 1px solid rgba(0,0,0,0.1);
    background: #00bcd4;
}
.dark-mode .block {
    border: 1px solid rgba(255,255,255,0.15);
}

/* Color states during animations */
.block.compare { background: #ff4081 !important; }
.block.swap { background: #ff5733 !important; }
.block.sorted { background: #00ffcc !important; color: #000; }

/* Ensure the generated array sits below the controls/legend and stays centered */
#array-container,
.visualizer-container .array-container {
    margin: 16px auto 40px auto;
    max-width: 1000px;
    padding: 0 8px;
}

/* Merge sort panels */
.merge-panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 1000px;
    margin: 8px auto 8px auto;
}
.merge-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    padding: 12px;
}
.merge-card h3 {
    margin-bottom: 8px;
    font-size: 1rem;
    color: var(--text-color);
}
.merge-array {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 56px;
}
.dark-mode .merge-card {
    background: #1e1e1e;
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.06);
}

@media (max-width: 900px) {
    .merge-panels { grid-template-columns: 1fr; }
}

/* Utility */
.hidden { display: none !important; }

/* Responsive adjustment so controls wrap cleanly on small screens */
@media (max-width: 900px) {
    .visualizer-container .controls {
        grid-template-columns: 1fr 1fr;
        row-gap: 10px;
    }
    .visualizer-container #arrayInput { min-width: 0; }
}
/* General Page Styling */
.about-container {
    max-width: 1000px;
    margin: auto;
    padding: 50px 20px;
    text-align: center;
}

/* About Page Heading */
.about-container h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #222;
}

/* About Sections Layout */
.about-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

/* Individual About Cards */
.about-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 45%;
    text-align: left;
    transition: transform 0.3s ease;
}

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

/* About Page Text */
.about-card h2 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.about-card p, .about-card ul {
    color: #555;
    font-size: 1rem;
}

/* Dark Mode Styling */
.dark-mode .about-container h1 {
    color: #fff;
}

.dark-mode .about-card {
    background: #1e1e1e;
    box-shadow: 0px 4px 8px rgba(255, 255, 255, 0.1);
}

.dark-mode .about-card h2 {
    color: #00ffcc;
}

.dark-mode .about-card p, 
.dark-mode .about-card ul {
    color: #ddd;
}
/* Floating Chatbot Button */
#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
    display: none;
}

#chatbox {
    display: flex;
    flex-direction: column;
    padding: 10px;
}

#messages {
    height: 200px;
    overflow-y: auto;
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
    padding: 5px;
}

#user-input {
    width: 80%;
    padding: 5px;
}

#chatbot-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    font-size: 15px;
    transition: background 0.3s ease-in-out, transform 0.2s ease;
    z-index: 1000;
    }
    
    #chatbot-button:hover {
    background: #0056b3;
    transform: scale(1.1);
    }
    
    

#chatbot-container button {
    width: 20%;
    padding: 8px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#chatbot-container button:hover {
    background: #0056b3;
}
/* Default light mode */
.chat-container {
    background-color: #f1f1f1;
    color: #000000;
    padding: 15px;
    border-radius: 10px;
    width: 300px;
    transition: background-color 0.3s, color 0.3s;
}

/* Dark mode */
.chat-container.dark-mode {
    background-color: black;
    color: white;
}

/* Toggle button style */
.toggle-btn {
    padding: 8px 12px;
    cursor: pointer;
    background: #ddd;
    border: none;
    border-radius: 5px;
    margin-bottom: 10px;
}

.toggle-btn:hover {
    background: #bbb;
}

/* (Removed duplicate .array-container block; primary definition kept above) */
    
    .block {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #4CAF50;
    color: white;
    font-weight: bold;
    border-radius: 6px;
    transition: transform 0.3s ease;
    }
    
    .block.swapping {
    background-color: #f44336;
    transform: scale(1.1);
    }
    
/* Responsive Design */
@media (max-width: 768px) {
    .about-card {
        width: 100%;
    }
}


/* Responsive */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: center;
    }
}


/* Responsive Design */
@media (max-width: 600px) {
    .menu {
        flex-direction: column;
        align-items: center;
        padding: 10px;
    }

    .menu a {
        margin: 6px 0;
    }
}
@media (max-width: 768px) {
    .menu {
        flex-direction: column;
        align-items: center;
        padding: 10px;
    }
    .menu a {
        padding: 10px;
        font-size: 18px;
        display: block;
    }
}
@media (max-width: 768px) {
    .algo-grid {
        grid-template-columns: repeat(2, 1fr); /* Adjust to 2 columns */
    }
}
@media (max-width: 480px) {
    .algo-grid {
        grid-template-columns: repeat(1, 1fr); /* Single column for small screens */
    }
}
@media (max-width: 600px) {
    .array-container {
        height: 200px; /* Reduce height */
        gap: 2px; /* Reduce gap */
    }
    .bar {
        width: 15px; /* Reduce width */
    }
}
@media (max-width: 600px) {
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    .controls button, 
    .controls select, 
    .controls input {
        width: 100%;
    }
}
/* Responsive Design for Devices */

/* Large Screens (Desktops) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
        margin: auto;
    }
}

/* Medium Screens (Tablets) */
@media (max-width: 1024px) {
    .menu {
        flex-direction: column;
        align-items: center;
        padding: 10px;
    }
    .menu a {
        font-size: 18px;
        padding: 10px;
    }
    .algo-grid {
        grid-template-columns: repeat(2, 1fr); /* Adjusting for tablets */
    }
    .hero h1 {
        font-size: 2.4rem;
    }
}

/* Small Screens (Phones) */
@media (max-width: 768px) {
    .menu {
        flex-direction: column;
        align-items: center;
    }
    .menu-items {
        flex-direction: column;
        width: 100%;
    }
    .algo-grid {
        grid-template-columns: repeat(1, 1fr); /* Single column for smaller screens */
    }
    .hero {
        padding: 80px 15px;
    }
    .hero h1 {
        font-size: 2rem;
    }
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    .algo-card {
        width: 90%;
        margin: auto;
    }
}

/* Extra Small Screens (Mobile Devices) */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.8rem;
    }
    .hero p {
        font-size: 1rem;
    }
    .algo-card {
        padding: 15px;
        font-size: 1rem;
    }
    .controls select, 
    .controls input, 
    .controls button {
        width: 100%;
        font-size: 14px;
    }
}
