* {
    box-sizing: border-box;
}


body {

    margin: 0;

    font-family: Arial, sans-serif;

    background: #f5f7fb;

    color: #222;
}

header {

    height: 70px;

    background: rgb(252, 250, 252);

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 50px;

    border-bottom: 1px solid #ddd;
}


.logo {

    font-size: 22px;

    font-weight: bold;
}


nav {

    display: flex;

    gap: 25px;
}


nav a {

    text-decoration: none;

    color: #555;

    font-size: 15px;

    padding: 8px 12px;

    border-radius: 5px;
}


nav a:hover {

    background: #f0f0f0;
}


nav a.active {

    font-weight: bold;

    color: black;
}


main {

    max-width: 1200px;

    margin: auto;

    padding: 40px 20px;
}


.hero {

    text-align: center;

    margin-bottom: 35px;
}


.hero h1 {

    font-size: 36px;

    margin-bottom: 10px;
}


.hero p {

    font-size: 17px;

    color: #666;
}


.controls-panel {

    background: white;

    padding: 25px;

    border-radius: 12px;

    display: flex;

    align-items: end;

    gap: 25px;

    flex-wrap: wrap;

    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
}


.control-group {

    display: flex;

    flex-direction: column;

    gap: 8px;
}


.control-group label {

    font-size: 14px;

    font-weight: bold;
}


select {

    padding: 11px 15px;

    border: 1px solid #ccc;

    border-radius: 6px;

    font-size: 15px;

    min-width: 170px;
}


input[type="range"] {

    width: 160px;

    cursor: pointer;
}


#arraySizeValue {

    font-size: 13px;

    text-align: center;
}

.buttons {

    display: flex;

    gap: 8px;

    margin-left: auto;
}


button {

    padding: 11px 16px;

    border: none;

    border-radius: 6px;

    cursor: pointer;

    font-size: 14px;

    font-weight: bold;
}


button:hover {

    opacity: 0.85;
}


button:disabled {

    opacity: 0.45;

    cursor: not-allowed;
}

.visualizer-container {

    background: rgb(235, 230, 230);

    margin-top: 25px;

    padding: 30px;

    border-radius: 12px;

    box-shadow: 0 3px 12px rgba(234, 135, 135, 0.08);
}


#array {

    height: 420px;

    display: flex;

    align-items: flex-end;

    justify-content: center;

    gap: 5px;

    padding: 20px;

    border-bottom: 2px solid #222;
}


.bar {

    width: 28px;

    background: black;

    border-radius: 4px 4px 0 0;

    position: relative;

    transition:
        height 0.15s,
        background-color 0.15s;
}


.bar span {

    position: absolute;

    top: -25px;

    left: 50%;

    transform: translateX(-50%);

    font-size: 11px;

    font-weight: bold;
}


.comparing {

    background: red;
}


.swapping {

    background: blue;
}


.sorted {

    background: green;
}


#status {

    text-align: center;

    margin-top: 20px;

    font-size: 16px;

    font-weight: bold;
}

#algorithm-info {

    background: rgb(255, 254, 254);

    margin-top: 25px;

    padding: 30px;

    border-radius: 12px;

    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
}


#algorithm-info h2 {

    margin-top: 0;
}


#algorithm-description {

    color: #666;

    line-height: 1.6;
}


.complexity-container {

    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 15px;

    margin-top: 25px;
}


.complexity-box {

    padding: 20px;

    background: #f5f7fb;

    border-radius: 8px;

    text-align: center;
}


.complexity-box span {

    display: block;

    font-size: 13px;

    color: #666;

    margin-bottom: 8px;
}


.complexity-box strong {

    font-size: 20px;
}

footer {

    text-align: center;

    padding: 25px;

    color: #777;

    font-size: 13px;
}

@media (max-width: 800px) {

    header {

        padding: 0 20px;

        flex-direction: column;

        height: auto;

        gap: 15px;

        padding-top: 15px;

        padding-bottom: 15px;
    }


    nav {

        gap: 5px;

        flex-wrap: wrap;

        justify-content: center;
    }


    .controls-panel {

        flex-direction: column;

        align-items: stretch;
    }


    .buttons {

        margin-left: 0;

        flex-wrap: wrap;
    }


    .complexity-container {

        grid-template-columns:
            repeat(2, 1fr);
    }
}

.stack-section {
    margin-top: 40px;
    padding: 30px;
    text-align: center;
}

.stack-section h2 {
    margin-bottom: 20px;
}

.stack-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.stack-controls input {
    width: 150px;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.stack-controls button {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}

.stack-controls button:hover {
    opacity: 0.8;
}

.stack {
    width: 220px;
    min-height: 300px;
    margin: 30px auto 20px;

    display: flex;
    flex-direction: column;

    justify-content: flex-start;
    align-items: center;

    border-left: 4px solid #333;
    border-right: 4px solid #333;
    border-bottom: 4px solid #333;

    padding: 10px;

    box-sizing: border-box;
}

.stack-element {
    width: 160px;
    height: 45px;

    margin: 4px 0;

    display: flex;
    justify-content: center;
    align-items: center;

    font-size: 18px;
    font-weight: bold;

    border-radius: 5px;
    border: 2px solid #333;

    background: #f1f1f1;

    animation: stackPush 0.3s ease;
}

@keyframes stackPush {

    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.stack-top {
    border: 3px solid #333;
    font-weight: bold;
}

.stack-top span {
    margin-left: 10px;
    font-size: 12px;
    font-weight: normal;
}

.stack-pop {
    animation: stackPop 0.4s ease forwards;
}

@keyframes stackPop {

    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-50px);
        opacity: 0;
    }
}

.stack-size {
    margin-top: 15px;
    font-size: 16px;
    font-weight: bold;
}

.stack-section {
    margin: 50px auto;
    padding: 30px;
    max-width: 800px;
    text-align: center;
}

.stack-section h2 {
    margin-bottom: 25px;
    font-size: 28px;
}

.stack-controls {
    margin-bottom: 25px;
}

.stack-controls input {
    outline: none;
    transition: 0.2s;
}

.stack-controls input:focus {
    border: 2px solid #333;
}

.stack-controls button {
    transition: transform 0.2s, opacity 0.2s;
}

.stack-controls button:hover {
    transform: translateY(-2px);
}

.stack-controls button:active {
    transform: translateY(0);
}

.stack {
    position: relative;
    width: 220px;
    min-height: 300px;

    margin: 30px auto 10px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: flex-start;

    border-left: 5px solid #333;
    border-right: 5px solid #333;
    border-bottom: 5px solid #333;

    border-radius: 0 0 8px 8px;

    padding: 10px;

    box-sizing: border-box;

    overflow: hidden;
}

.stack-element {
    width: 160px;
    height: 45px;

    margin: 4px 0;

    display: flex;
    justify-content: center;
    align-items: center;

    border: 2px solid #333;
    border-radius: 6px;

    font-size: 17px;
    font-weight: bold;

    transition: transform 0.2s;
}

.stack-element:hover {
    transform: scale(1.03);
}

.stack-top {
    border-width: 3px;
}

.stack-top span {
    margin-left: 8px;
    font-size: 11px;
    font-weight: normal;
}

.stack-size {
    margin-top: 15px;

    font-size: 16px;
    font-weight: bold;
}

.stack:empty::after {
    content: "Stack is empty";
    display: flex;

    height: 280px;

    align-items: center;
    justify-content: center;

    font-size: 15px;
    opacity: 0.6;
}

.queue-dequeue {
    animation: queueDequeue 0.4s ease forwards;
}

@keyframes queueDequeue {

    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-60px);
        opacity: 0;
    }
}

.queue-section {
    margin: 50px auto;
    padding: 30px;
    max-width: 1000px;
    text-align: center;
}

.queue-section h2 {
    margin-bottom: 25px;
    font-size: 28px;
}

.queue-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.queue-controls input {
    width: 150px;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
}

.queue-controls input:focus {
    border: 2px solid #333;
}

.queue-controls button {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: 0.2s;
}

.queue-controls button:hover {
    transform: translateY(-2px);
    opacity: 0.8;
}

.queue {
    min-height: 120px;
    max-width: 900px;

    margin: 30px auto;

    display: flex;
    justify-content: center;
    align-items: center;

    gap: 8px;

    padding: 25px;

    border-top: 5px solid #333;
    border-bottom: 5px solid #333;

    box-sizing: border-box;

    overflow-x: auto;
}

.queue-element {
    min-width: 100px;
    height: 60px;

    padding: 0 15px;

    display: flex;
    justify-content: center;
    align-items: center;

    border: 2px solid #333;
    border-radius: 6px;

    font-size: 18px;
    font-weight: bold;

    flex-shrink: 0;

    animation: queueEnqueue 0.3s ease;
}

.queue-front {
    border-width: 3px;
}

.queue-rear {
    border-width: 3px;
}

.queue-front span,
.queue-rear span {
    margin-left: 8px;
    font-size: 11px;
    font-weight: normal;
}

@keyframes queueEnqueue {

    from {
        transform: translateX(30px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.queue-dequeue {
    animation: queueDequeue 0.4s ease forwards;
}

@keyframes queueDequeue {

    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-60px);
        opacity: 0;
    }
}

.queue:empty::after {
    content: "Queue is empty";

    font-size: 15px;
    opacity: 0.6;
}

.queue-info {
    max-width: 900px;
    margin: 10px auto 20px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: bold;
}

.queue-size {
    margin-top: 15px;
    font-size: 16px;
    font-weight: bold;
}

.linked-list-section {
    margin: 50px auto;
    padding: 30px;
    max-width: 1000px;
    text-align: center;
}

.linked-list-section h2 {
    margin-bottom: 25px;
    font-size: 28px;
}

.linked-list-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.linked-list-controls input {
    width: 150px;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
}

.linked-list-controls input:focus {
    border: 2px solid #333;
}

.linked-list-controls button {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: 0.2s;
}

.linked-list-controls button:hover {
    transform: translateY(-2px);
    opacity: 0.8;
}

.linked-list {
    min-height: 120px;
    max-width: 900px;
    margin: 30px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 25px;
    overflow-x: auto;
}

.linked-node {
    min-width: 80px;
    height: 60px;
    padding: 0 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 3px solid #333;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
    animation: nodeAppear 0.3s ease;
}

.linked-arrow {
    font-size: 28px;
    font-weight: bold;
    flex-shrink: 0;
}

.linked-null {
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

@keyframes nodeAppear {
    from {
        transform: scale(0.7);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.linked-list-size {
    margin-top: 15px;
    font-size: 16px;
    font-weight: bold;
}

.linked-list:empty::after {
    content: "Linked List is empty";
    font-size: 15px;
    opacity: 0.6;
}

.linked-list-wrapper {
    max-width: 900px;
    margin: 30px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.linked-label {
    font-size: 15px;
    font-weight: bold;
    margin: 8px 0;
}

.linked-list-wrapper .linked-list {
    width: 100%;
    margin: 5px auto;
}

#linkedListHead {
    align-self: flex-start;
    margin-left: 20px;
}

#linkedListTail {
    align-self: flex-end;
    margin-right: 20px;
}

.head-node {
    border-width: 4px;
}


.tail-node {
    border-width: 4px;
}

.searching-node {
    transform: scale(1.1);
    border-width: 4px;
    animation: searchPulse 0.6s ease;
}

.found-node {
    transform: scale(1.15);
    border-width: 4px;
}

@keyframes searchPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.insert-node {
    animation: insertNodeAnimation 0.5s ease;
}

@keyframes insertNodeAnimation {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.delete-node {
    animation: deleteNodeAnimation 0.5s ease forwards;
}

@keyframes deleteNodeAnimation {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.15);
        opacity: 0.7;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.traversing-node {
    transform: scale(1.15);
    border-width: 4px;
    animation: traversalPulse 0.7s ease;
}

@keyframes traversalPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

.tree-section {
    margin: 50px auto;
    padding: 30px;
    max-width: 1100px;
    text-align: center;
}

.tree-section h2 {
    margin-bottom: 25px;
    font-size: 28px;
}

.tree-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.tree-controls input {
    width: 150px;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
}

.tree-controls input:focus {
    border: 2px solid #333;
}

.tree-controls button {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: 0.2s;
}

.tree-controls button:hover {
    transform: translateY(-2px);
    opacity: 0.8;
}

.tree {
    min-height: 350px;
    max-width: 1050px;
    margin: 30px auto;
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: auto;
    box-sizing: border-box;
}

.tree-node-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.tree-node {
    width: 60px;
    height: 60px;
    border: 3px solid #333;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
    animation: treeNodeAppear 0.3s ease;
    z-index: 2;
}

.tree-children {
    display: flex;
    justify-content: center;
    gap: 80px;
    margin-top: 55px;
    position: relative;
}

.tree-children::before {
    content: "";
    position: absolute;
    top: -30px;
    left: 25%;
    right: 25%;
    border-top: 2px solid #333;
}

@keyframes treeNodeAppear {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.tree:empty::after {
    content: "Binary Search Tree is empty";
    font-size: 15px;
    opacity: 0.6;
}


.tree-traversing {
    transform: scale(1.2);
    border-width: 5px;
    animation: treeTraversalPulse 0.7s ease;
}

@keyframes treeTraversalPulse {

    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.controls,
.visualizer,
.status,
.algorithm-info {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}


.controls {
    text-align: center;
}


.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}


.control-group select,
.control-group input {
    max-width: 500px;
}


.buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}


.algorithm-info {
    text-align: center;
}


.complexity {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    text-align: center;
}


.visualizer {
    display: flex;
    justify-content: center;
    align-items: flex-end;
}


.status {
    text-align: center;
}


.tree-searching {
    transform: scale(1.2);
    border-width: 5px;
    animation: bstSearchPulse 0.7s ease;
}

.tree-found {
    transform: scale(1.2);
    border-width: 5px;
    animation: bstFoundPulse 0.7s ease;
}

@keyframes bstSearchPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes bstFoundPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.25);
    }

    100% {
        transform: scale(1.2);
    }
}

.tree-deleting {
    animation: bstDeleteAnimation 0.6s ease forwards;
}

@keyframes bstDeleteAnimation {

    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.graph-section {
    margin: 50px auto;
    padding: 30px;
    max-width: 1100px;
    text-align: center;
}

.graph-section h2 {
    margin-bottom: 25px;
    font-size: 28px;
}

.graph-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.graph-controls input {
    width: 120px;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
}

.graph-controls input:focus {
    border: 2px solid #333;
}

.graph-controls button {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: 0.2s;
}

.graph-controls button:hover {
    transform: translateY(-2px);
    opacity: 0.8;
}

.graph {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 500px;
    margin: 30px auto;
    border: 2px solid #333;
    border-radius: 10px;
    overflow: hidden;
}

.graph-node {
    position: absolute;
    width: 60px;
    height: 60px;

    border: 3px solid #333;
    border-radius: 50%;

    display: flex;
    justify-content: center;
    align-items: center;

    font-size: 18px;
    font-weight: bold;

    z-index: 2;

    animation: graphNodeAppear 0.3s ease;
}

.graph-svg {
    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    z-index: 1;

    pointer-events: none;
    overflow: visible;
}

.graph-svg .graph-edge {
    position: static;
    width: auto;
    height: auto;

    stroke: #333;
    stroke-width: 0.5;

    fill: none;
}

.graph-node {
    position: absolute;
    width: 60px;
    height: 60px;

    border: 3px solid #333;
    border-radius: 50%;

    display: flex;
    justify-content: center;
    align-items: center;

    font-size: 18px;
    font-weight: bold;

    background: #f5f7fa;

    z-index: 3;

    animation: graphNodeAppear 0.3s ease;
}

@keyframes graphNodeAppear {

    from {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.graph-searching {
    transform: translate(-50%, -50%) scale(1.2);
    border-width: 5px;
    animation: graphSearchPulse 0.7s ease;
}

@keyframes graphSearchPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.header {
    position: sticky;
    top: 0;
    z-index: 1000;

    width: 100%;
    padding: 16px 50px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;

    box-sizing: border-box;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.navbar {
    display: flex;
    align-items: center;
    gap: 30px;
}

.navbar a {
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: 0.2s;
}

.navbar a:hover {
    transform: translateY(-2px);
}

.hero {
    min-height: 420px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    text-align: center;

    padding: 60px 20px;
    box-sizing: border-box;
}

.hero h1 {
    max-width: 850px;
    margin: 0;

    font-size: 48px;
    line-height: 1.15;
    font-weight: 800;
}

.hero p {
    max-width: 650px;
    margin-top: 20px;

    font-size: 18px;
    line-height: 1.6;
    opacity: 0.7;
}

@media (max-width: 768px) {

    .header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
    }

    .navbar {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero {
        min-height: 350px;
        padding: 40px 20px;
    }

    .hero h1 {
        font-size: 34px;
    }

    .hero p {
        font-size: 16px;
    }
}

.main-section,
.stack-section,
.queue-section,
.linked-list-section,
.tree-section,
.graph-section {

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 18px;

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);

    margin: 50px auto;
    padding: 35px;

    box-sizing: border-box;

    transition: 0.3s ease;
}

.main-section:hover,
.stack-section:hover,
.queue-section:hover,
.linked-list-section:hover,
.tree-section:hover,
.graph-section:hover {

    transform: translateY(-3px);

    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.09);
}

.main-section h2,
.stack-section h2,
.queue-section h2,
.linked-list-section h2,
.tree-section h2,
.graph-section h2 {

    font-size: 28px;
    font-weight: 800;

    margin-bottom: 25px;
}

.status {

    margin-top: 20px;
    padding: 12px 18px;

    border-radius: 10px;

    background: #f8fafc;

    border: 1px solid #e5e7eb;

    font-size: 14px;
    font-weight: 600;
}

button {

    border: none;
    border-radius: 8px;

    padding: 10px 18px;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: all 0.2s ease;
}

button:hover {

    transform: translateY(-2px);

    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.12);
}

button:active {

    transform: translateY(0);
}

input,
select {

    border-radius: 8px;

    transition: 0.2s ease;
}

input:focus,
select:focus {

    outline: none;

    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {

    .main-section,
    .stack-section,
    .queue-section,
    .linked-list-section,
    .tree-section,
    .graph-section {

        width: 94%;

        padding: 22px;

        margin: 30px auto;

        border-radius: 14px;
    }

    .main-section h2,
    .stack-section h2,
    .queue-section h2,
    .linked-list-section h2,
    .tree-section h2,
    .graph-section h2 {

        font-size: 23px;
    }
}

body.dark-mode {
    background: #111827;
    color: #f9fafb;
}

body.dark-mode .header {
    background: #1f2937;
    border-bottom-color: #374151;
}

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

body.dark-mode .main-section,
body.dark-mode .stack-section,
body.dark-mode .queue-section,
body.dark-mode .linked-list-section,
body.dark-mode .tree-section,
body.dark-mode .graph-section {

    background: #1f2937;

    border-color: #374151;

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

body.dark-mode .status {

    background: #111827;

    border-color: #374151;

    color: #f9fafb;
}

body.dark-mode input,
body.dark-mode select {

    background: #111827;

    color: #f9fafb;

    border-color: #4b5563;
}

body.dark-mode .graph,
body.dark-mode .queue,
body.dark-mode .linked-list,
body.dark-mode .tree {

    border-color: #4b5563;
}

body.dark-mode .graph-node,
body.dark-mode .tree-node,
body.dark-mode .linked-node,
body.dark-mode .stack-element,
body.dark-mode .queue-element {

    background: #374151;

    color: #ffffff;

    border-color: #9ca3af;
}

body.dark-mode .graph-svg .graph-edge {
    stroke: #9ca3af;
}

#themeToggle {

    padding: 8px 14px;

    border: 1px solid #d1d5db;

    border-radius: 8px;

    cursor: pointer;

    font-size: 13px;

    font-weight: 600;
}

.stats-section {

    max-width: 1000px;

    margin: -20px auto 50px;

    padding: 20px;

    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 20px;

    box-sizing: border-box;
}


.stat-card {

    padding: 25px 15px;

    text-align: center;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 14px;

    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.05);

    transition: 0.25s ease;
}


.stat-card:hover {

    transform: translateY(-5px);

    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.10);
}


.stat-number {

    font-size: 30px;

    font-weight: 800;

    margin-bottom: 8px;
}


.stat-title {

    font-size: 14px;

    font-weight: 600;

    opacity: 0.65;
}

body.dark-mode .stat-card {

    background: #1f2937;

    border-color: #374151;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.3);
}


/* MOBILE */

@media (max-width: 768px) {

    .stats-section {

        width: 94%;

        grid-template-columns:
            repeat(2, 1fr);

        margin-top: 10px;

        gap: 12px;

        padding: 10px;
    }

    .stat-card {

        padding: 20px 10px;
    }

    .stat-number {

        font-size: 25px;
    }
}


#array {
    height: 420px;
    width: 100%;
    max-width: 1000px;

    margin: 30px auto;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    gap: 6px;

    padding: 20px;

    box-sizing: border-box;

    border-bottom: 2px solid #333;

    overflow: hidden;
}


#array {
    height: 420px;
    width: 100%;
    max-width: 1000px;

    margin: 30px auto;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    gap: 6px;

    padding: 20px;

    box-sizing: border-box;

    border-bottom: 2px solid #333;

    overflow: hidden;
}

.array-bar {
    width: 22px;
    min-height: 5px;

    background: #3498db;

    border-radius: 5px 5px 0 0;

    position: relative;

    display: flex;
    justify-content: center;
    align-items: flex-start;

    color: white;

    font-size: 11px;
    font-weight: bold;

    padding-top: 5px;

    box-sizing: border-box;

    transition:
        height 0.2s ease,
        transform 0.2s ease,
        background-color 0.2s ease;
}

.array-bar.active {
    background: #f1c40f;

    color: #111;

    transform: scaleX(1.15);

    box-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
}

.array-bar.found {
    background: #2ecc71;

    color: white;

    transform: scaleX(1.2);

    box-shadow: 0 0 15px rgba(46, 204, 113, 0.6);
}

.array-bar.swapping {
    background: #e74c3c;

    color: white;

    transform: scaleX(1.15);

    box-shadow: 0 0 12px rgba(231, 76, 60, 0.5);
}

.array-bar.pivot {
    background: #9b59b6;

    color: white;

    transform: scaleX(1.15);

    box-shadow: 0 0 12px rgba(155, 89, 182, 0.5);
}

.array-bar.sorted {
    background: #27ae60;

    color: white;
}

@media (max-width: 768px) {

    #array {
        height: 350px;
        gap: 3px;
        padding: 10px;
    }

    .array-bar {
        width: 14px;
        font-size: 9px;
        padding-top: 3px;
    }
}

@media (max-width: 768px) {

    #array {
        height: 350px;

        gap: 3px;

        padding: 10px;
    }

    .array-bar {
        width: 14px;

        font-size: 9px;

        padding-top: 3px;
    }
}

.hero {

    position: relative;

    min-height: 620px;

    padding: 100px 20px 80px;

    display: flex;
    flex-direction: column;

    justify-content: center;
    align-items: center;

    text-align: center;

    overflow: hidden;

    box-sizing: border-box;
}

.hero::before {

    content: "";

    position: absolute;

    width: 500px;
    height: 500px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(99, 102, 241, 0.18),
            transparent 70%
        );

    top: -180px;
    left: -150px;

    animation: heroGlow 6s ease-in-out infinite;
}


.hero::after {

    content: "";

    position: absolute;

    width: 450px;
    height: 450px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(168, 85, 247, 0.15),
            transparent 70%
        );

    bottom: -180px;
    right: -120px;

    animation: heroGlow 7s ease-in-out infinite reverse;
}


@keyframes heroGlow {

    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(30px, 20px) scale(1.15);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

.hero > * {

    position: relative;

    z-index: 2;
}

.hero-badge {

    display: inline-block;

    padding: 8px 16px;

    margin-bottom: 25px;

    border-radius: 50px;

    font-size: 13px;

    font-weight: 700;

    letter-spacing: 0.5px;

    background: rgba(99, 102, 241, 0.10);

    border: 1px solid rgba(99, 102, 241, 0.25);

    animation: badgeFloat 3s ease-in-out infinite;
}


@keyframes badgeFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.hero h1 {

    max-width: 900px;

    margin: 0;

    font-size: clamp(48px, 7vw, 82px);

    line-height: 1.05;

    font-weight: 900;

    letter-spacing: -2px;
}

.hero h1 span {

    display: block;

    background:
        linear-gradient(
            90deg,
            #6366f1,
            #8b5cf6,
            #ec4899
        );

    -webkit-background-clip: text;

    background-clip: text;

    color: transparent;
}

.hero p {

    max-width: 650px;

    margin: 25px auto 0;

    font-size: 19px;

    line-height: 1.7;

    opacity: 0.7;
}

.hero-buttons {

    display: flex;

    justify-content: center;

    align-items: center;

    gap: 15px;

    margin-top: 35px;

    flex-wrap: wrap;
}


.hero-primary,
.hero-secondary {

    padding: 14px 24px;

    border-radius: 10px;

    text-decoration: none;

    font-size: 15px;

    font-weight: 700;

    transition: all 0.25s ease;
}


.hero-primary {

    color: white;

    background:
        linear-gradient(
            135deg,
            #6366f1,
            #8b5cf6
        );

    box-shadow:
        0 10px 25px rgba(99, 102, 241, 0.25);
}


.hero-primary:hover {

    transform: translateY(-4px);

    box-shadow:
        0 15px 30px rgba(99, 102, 241, 0.35);
}


.hero-secondary {

    color: inherit;

    background: rgba(255, 255, 255, 0.7);

    border: 1px solid #d1d5db;
}


.hero-secondary:hover {

    transform: translateY(-4px);

    border-color: #6366f1;
}


.hero-features {

    display: flex;

    justify-content: center;

    gap: 50px;

    margin-top: 65px;

    flex-wrap: wrap;
}


.hero-features div {

    min-width: 150px;

    display: flex;

    flex-direction: column;

    gap: 5px;

    font-size: 24px;
}


.hero-features strong {

    font-size: 14px;
}


.hero-features small {

    font-size: 12px;

    opacity: 0.55;
}

body.dark-mode .hero-secondary {

    background: rgba(31, 41, 55, 0.8);

    border-color: #4b5563;
}

@media (max-width: 768px) {

    .hero {

        min-height: 550px;

        padding: 70px 20px;
    }

    .hero h1 {

        letter-spacing: -1px;
    }

    .hero p {

        font-size: 16px;
    }

    .hero-features {

        gap: 25px;

        margin-top: 45px;
    }
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #06b6d4;

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg: #f5f7ff;
    --card: #ffffff;
    --text: #172033;
    --muted: #64748b;
    --border: #e2e8f0;
}

body {
    background:
        linear-gradient(
            135deg,
            #f8f9ff 0%,
            #eef2ff 50%,
            #f0fdfa 100%
        );

    color: var(--text);
}

.header {
    background: rgba(255, 255, 255, 0.92);

    backdrop-filter: blur(12px);

    border-bottom: 1px solid var(--border);
}


.logo {
    background:
        linear-gradient(
            90deg,
            var(--primary),
            var(--secondary)
        );

    -webkit-background-clip: text;
    background-clip: text;

    color: transparent;
}


.navbar a {
    color: var(--text);

    transition: 0.25s;
}


.navbar a:hover {
    color: var(--primary);
}

.main-section,
.stack-section,
.queue-section,
.linked-list-section,
.tree-section,
.graph-section {

    background: rgba(255, 255, 255, 0.90);

    border: 1px solid var(--border);

    box-shadow:
        0 10px 35px rgba(79, 70, 229, 0.08);
}


.main-section h2,
.stack-section h2,
.queue-section h2,
.linked-list-section h2,
.tree-section h2,
.graph-section h2 {

    background:
        linear-gradient(
            90deg,
            var(--primary),
            var(--secondary)
        );

    -webkit-background-clip: text;
    background-clip: text;

    color: transparent;
}

button {

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--secondary)
        );

    color: white;

    box-shadow:
        0 5px 15px rgba(99, 102, 241, 0.20);
}


button:hover {

    background:
        linear-gradient(
            135deg,
            var(--primary-dark),
            var(--secondary)
        );

    box-shadow:
        0 8px 20px rgba(99, 102, 241, 0.30);
}

input,
select {

    background: #ffffff;

    border: 2px solid var(--border);

    color: var(--text);
}


input:focus,
select:focus {

    border-color: var(--primary);

    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.12);
}


.status {

    background:
        linear-gradient(
            135deg,
            #eef2ff,
            #ecfeff
        );

    border: 1px solid #c7d2fe;

    color: var(--text);
}


.array-bar {

    background:
        linear-gradient(
            180deg,
            #3b82f6,
            #6366f1
        );

    box-shadow:
        0 4px 10px rgba(59, 130, 246, 0.18);
}


.array-bar.active {

    background:
        linear-gradient(
            180deg,
            #fbbf24,
            #f59e0b
        );

    box-shadow:
        0 0 15px rgba(245, 158, 11, 0.45);
}


.array-bar.swapping {

    background:
        linear-gradient(
            180deg,
            #f87171,
            #ef4444
        );

    box-shadow:
        0 0 15px rgba(239, 68, 68, 0.45);
}


.array-bar.found {

    background:
        linear-gradient(
            180deg,
            #4ade80,
            #16a34a
        );

    box-shadow:
        0 0 18px rgba(34, 197, 94, 0.5);
}


.array-bar.pivot {

    background:
        linear-gradient(
            180deg,
            #c084fc,
            #8b5cf6
        );

    box-shadow:
        0 0 15px rgba(139, 92, 246, 0.45);
}



.stack-element {

    background:
        linear-gradient(
            135deg,
            #6366f1,
            #8b5cf6
        );

    color: white;

    border-color: #4f46e5;

    box-shadow:
        0 5px 12px rgba(99, 102, 241, 0.20);
}


.stack-top {

    border-color: #f59e0b;
}



.queue-element {

    background:
        linear-gradient(
            135deg,
            #0891b2,
            #06b6d4
        );

    color: white;

    border-color: #0891b2;

    box-shadow:
        0 5px 12px rgba(6, 182, 212, 0.20);
}


.queue-front {

    border-color: #22c55e;
}


.queue-rear {

    border-color: #f59e0b;
}



.linked-node {

    background:
        linear-gradient(
            135deg,
            #3b82f6,
            #6366f1
        );

    color: white;

    border-color: #4f46e5;

    box-shadow:
        0 5px 12px rgba(59, 130, 246, 0.18);
}


.head-node {

    border-color: #22c55e;
}


.tail-node {

    border-color: #f59e0b;
}


.found-node {

    background:
        linear-gradient(
            135deg,
            #22c55e,
            #16a34a
        );
}



.tree-node {

    background:
        linear-gradient(
            135deg,
            #8b5cf6,
            #6366f1
        );

    color: white;

    border-color: #4f46e5;

    box-shadow:
        0 5px 12px rgba(99, 102, 241, 0.20);
}


.tree-found {

    background:
        linear-gradient(
            135deg,
            #22c55e,
            #16a34a
        );
}


.tree-searching {

    border-color: #f59e0b;

    box-shadow:
        0 0 18px rgba(245, 158, 11, 0.5);
}



.graph {

    background:
        radial-gradient(
            circle at center,
            #ffffff,
            #f1f5ff
        );

    border-color: #c7d2fe;
}


.graph-node {

    background:
        linear-gradient(
            135deg,
            #6366f1,
            #8b5cf6
        );

    color: white;

    border-color: #4f46e5;

    box-shadow:
        0 5px 15px rgba(99, 102, 241, 0.25);
}


.graph-searching {

    background:
        linear-gradient(
            135deg,
            #22c55e,
            #06b6d4
        );

    border-color: #16a34a;

    box-shadow:
        0 0 20px rgba(34, 197, 94, 0.5);
}


.graph-svg .graph-edge {

    stroke: #94a3b8;
}



.stat-card {

    background:
        linear-gradient(
            145deg,
            #ffffff,
            #f5f3ff
        );

    border-color: #ddd6fe;
}


.stat-number {

    background:
        linear-gradient(
            90deg,
            var(--primary),
            var(--secondary)
        );

    -webkit-background-clip: text;
    background-clip: text;

    color: transparent;
}


.legend-color.normal {
    background: #6366f1;
}

.legend-color.comparing {
    background: #f59e0b;
}

.legend-color.swapping {
    background: #ef4444;
}

.legend-color.found {
    background: #22c55e;
}

.legend-color.pivot {
    background: #8b5cf6;
}

.main-section,
.stack-section,
.queue-section,
.linked-list-section,
.tree-section,
.graph-section {

    border: 2px solid #f4b400;

    box-shadow:
        0 8px 25px rgba(244, 180, 0, 0.12);

    position: relative;

    overflow: hidden;
}




.main-section::before,
.stack-section::before,
.queue-section::before,
.linked-list-section::before,
.tree-section::before,
.graph-section::before {

    content: "";

    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 4px;

    background:
        linear-gradient(
            90deg,
            #f4b400,
            #f9d65c,
            #8b5cf6,
            #6366f1
        );
}


.main-section h2,
.stack-section h2,
.queue-section h2,
.linked-list-section h2,
.tree-section h2,
.graph-section h2 {

    position: relative;

    display: inline-block;

    padding-bottom: 8px;
}


.main-section h2::after,
.stack-section h2::after,
.queue-section h2::after,
.linked-list-section h2::after,
.tree-section h2::after,
.graph-section h2::after {

    content: "";

    position: absolute;

    left: 15%;
    bottom: 0;

    width: 70%;
    height: 3px;

    border-radius: 10px;

    background:
        linear-gradient(
            90deg,
            #f4b400,
            #f9d65c
        );
}


input,
select {

    border: 2px solid #e5c04a !important;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


input:focus,
select:focus {

    border-color: #f4b400 !important;

    box-shadow:
        0 0 0 4px rgba(244, 180, 0, 0.15) !important;
}



button {

    border: 1px solid #f4b400;

    transition: all 0.25s ease;
}


button:hover {

    border-color: #d99d00;

    box-shadow:
        0 6px 15px rgba(244, 180, 0, 0.20);
}

#generateBtn,
#visualizeBtn {

    background:
        linear-gradient(
            135deg,
            #6366f1,
            #8b5cf6
        );

    color: white;

    border: none;
}


#generateBtn:hover,
#visualizeBtn:hover {

    transform: translateY(-3px);

    box-shadow:
        0 8px 20px rgba(99, 102, 241, 0.30);
}


#resetBtn {

    background: #fff7d6;

    border: 1px solid #f4b400;
}


#array,
.stack,
.queue,
.linked-list,
.tree,
.graph {

    border-color: #f4b400;

    box-shadow:
        inset 0 0 20px rgba(244, 180, 0, 0.05);
}


.status {

    border: 1px solid #f4b400 !important;

    background:
        linear-gradient(
            90deg,
            #fffdf2,
            #fff9dc
        ) !important;
}

.array-bar {

    background:
        linear-gradient(
            180deg,
            #6366f1,
            #8b5cf6
        );
}



.array-bar.active {

    background:
        linear-gradient(
            180deg,
            #ffd54f,
            #f4b400
        );

    box-shadow:
        0 0 12px rgba(244, 180, 0, 0.45);
}


.array-bar.found {

    background:
        linear-gradient(
            180deg,
            #34d399,
            #16a34a
        );
}

.array-bar.swapping {

    background:
        linear-gradient(
            180deg,
            #ff6b6b,
            #dc2626
        );
}


.array-bar.pivot {

    background:
        linear-gradient(
            180deg,
            #c084fc,
            #7c3aed
        );
}



.array-legend {

    padding: 12px;

    border: 1px solid #f4b400;

    border-radius: 10px;

    background: #fffdf5;
}


.hero-badge {

    border-color: #f4b400 !important;

    background:
        rgba(244, 180, 0, 0.10) !important;

    box-shadow:
        0 4px 15px rgba(244, 180, 0, 0.12);
}


.stat-card {

    border: 1px solid #f4b400;

    box-shadow:
        0 6px 20px rgba(244, 180, 0, 0.10);
}


.stat-card:hover {

    border-color: #6366f1;

    box-shadow:
        0 10px 25px rgba(99, 102, 241, 0.18);
}



.navbar a {

    position: relative;

    transition: 0.2s ease;
}


.navbar a:hover {

    color: #f4b400;
}



#themeToggle {

    border-color: #f4b400;

    background: #fffdf2;
}



body.dark-mode
.main-section,
body.dark-mode
.stack-section,
body.dark-mode
.queue-section,
body.dark-mode
.linked-list-section,
body.dark-mode
.tree-section,
body.dark-mode
.graph-section {

    border-color: #f4b400;

    box-shadow:
        0 8px 30px rgba(244, 180, 0, 0.08);
}


body.dark-mode .status {

    background:
        linear-gradient(
            90deg,
            #29250f,
            #24201a
        ) !important;

    border-color: #f4b400 !important;
}


body.dark-mode .array-legend {

    background: #1f1b0b;

    border-color: #f4b400;
}


body.dark-mode #resetBtn {

    background: #29250f;

    color: #ffffff;

    border-color: #f4b400;
}


body.dark-mode #themeToggle {

    background: #29250f;

    color: #ffffff;
}

body {
    background: #fffdf5;
    color: #242424;
}



.header {
    background: #fffaf0;
    border-bottom: 2px solid #f4c430;
}

.logo {
    color: #1f1f1f;
}

.navbar a {
    color: #292929;
}

.navbar a:hover {
    color: #d89b00;
}



.hero {
    background:
        radial-gradient(
            circle at 15% 20%,
            rgba(255, 214, 51, 0.28),
            transparent 30%
        ),
        radial-gradient(
            circle at 85% 75%,
            rgba(255, 165, 0, 0.18),
            transparent 30%
        ),
        #fffdf5;
}


.hero::before {
    background:
        radial-gradient(
            circle,
            rgba(255, 214, 51, 0.30),
            transparent 70%
        );
}

.hero::after {
    background:
        radial-gradient(
            circle,
            rgba(255, 165, 0, 0.22),
            transparent 70%
        );
}


.hero-badge {
    background: #fff3b0;
    border: 1px solid #f4c430;
    color: #6b4f00;
}



.hero h1 span {
    background:
        linear-gradient(
            90deg,
            #d89b00,
            #f4b400,
            #ff8c00
        );

    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}




.hero-primary {
    color: #1f1f1f;

    background:
        linear-gradient(
            135deg,
            #ffd633,
            #f4b400
        );

    box-shadow:
        0 10px 25px rgba(244, 180, 0, 0.28);
}

.hero-primary:hover {
    box-shadow:
        0 15px 30px rgba(244, 180, 0, 0.38);
}



.hero-secondary {
    color: #292929;
    background: #fffaf0;
    border: 1px solid #e5c45c;
}

.hero-secondary:hover {
    border-color: #d89b00;
    background: #fff3b0;
}


.stat-card {
    background: #fffaf0;
    border-color: #ead68a;

    box-shadow:
        0 6px 20px rgba(130, 100, 0, 0.08);
}

.stat-card:hover {
    border-color: #f4c430;

    box-shadow:
        0 10px 25px rgba(130, 100, 0, 0.14);
}

.stat-number {
    color: #d89b00;
}


.main-section,
.stack-section,
.queue-section,
.linked-list-section,
.tree-section,
.graph-section {

    background: #fffef9;

    border-color: #ead68a;

    box-shadow:
        0 8px 25px rgba(100, 80, 0, 0.07);
}

.main-section:hover,
.stack-section:hover,
.queue-section:hover,
.linked-list-section:hover,
.tree-section:hover,
.graph-section:hover {

    border-color: #f4c430;

    box-shadow:
        0 12px 30px rgba(100, 80, 0, 0.12);
}



.main-section h2,
.stack-section h2,
.queue-section h2,
.linked-list-section h2,
.tree-section h2,
.graph-section h2 {

    color: #222222;
}



button {

    background: #f4b400;

    color: #1f1f1f;

    font-weight: 700;
}

button:hover {

    background: #ffd633;

    box-shadow:
        0 5px 15px rgba(244, 180, 0, 0.25);
}



input,
select {

    background: #fffdf5;

    color: #222222;

    border-color: #d9c77a;
}

input:focus,
select:focus {

    border-color: #f4b400;

    box-shadow:
        0 0 0 3px rgba(244, 180, 0, 0.18);
}



.array-bar {
    background: #f4b400;

    color: #1f1f1f;
}



.array-bar.active {
    background: #ffd633;

    color: #1f1f1f;

    box-shadow:
        0 0 12px rgba(255, 214, 51, 0.55);
}



.array-bar.swapping {
    background: #e4572e;

    color: white;

    box-shadow:
        0 0 12px rgba(228, 87, 46, 0.40);
}




.array-bar.found {
    background: #2e9d50;

    color: white;

    box-shadow:
        0 0 15px rgba(46, 157, 80, 0.45);
}



.array-bar.pivot {
    background: #ff8c00;

    color: white;

    box-shadow:
        0 0 12px rgba(255, 140, 0, 0.45);
}


.array-bar.sorted {
    background: #2e9d50;

    color: white;
}



.legend-color.normal {
    background: #f4b400;
}

.legend-color.comparing {
    background: #ffd633;
}

.legend-color.swapping {
    background: #e4572e;
}

.legend-color.found {
    background: #2e9d50;
}

.legend-color.pivot {
    background: #ff8c00;
}


.status {

    background: #fff8dc;

    border-color: #ead68a;

    color: #3b320f;
}



.stack-element {
    background: #fff3b0;
    border-color: #d89b00;
}

.stack-top {
    background: #ffd633;
}



.queue-element {
    background: #fff3b0;
    border-color: #d89b00;
}

.queue-front {
    background: #ffd633;
}

.queue-rear {
    background: #ffe58a;
}



.linked-node {
    background: #fff3b0;
    border-color: #d89b00;
}

.head-node {
    border-color: #f4b400;
}

.tail-node {
    border-color: #ff8c00;
}

.found-node {
    background: #b8e6c1;
    border-color: #2e9d50;
}



.tree-node {
    background: #fff3b0;
    border-color: #d89b00;
}

.tree-found {
    background: #b8e6c1;
    border-color: #2e9d50;
}

.tree-searching {
    background: #ffd633;
    border-color: #d89b00;
}

.tree-deleting {
    background: #ffd1c5;
}



.graph-node {
    background: #fff3b0;
    border-color: #d89b00;
}

.graph-svg .graph-edge {
    stroke: #8a6a00;
}

.graph-searching {
    background: #ffd633;
    border-color: #d89b00;
}



#themeToggle {

    background: #292929;

    color: #ffd633;

    border: 1px solid #d89b00;
}

#themeToggle:hover {

    background: #f4b400;

    color: #1f1f1f;
}



body.dark-mode {

    background: #161616;

    color: #f8f1d0;
}



body.dark-mode .header {

    background: #1d1d1d;

    border-bottom-color: #d89b00;
}

body.dark-mode .logo,
body.dark-mode .navbar a {

    color: #fff3b0;
}

body.dark-mode .navbar a:hover {

    color: #ffd633;
}



body.dark-mode .hero {

    background:
        radial-gradient(
            circle at 15% 20%,
            rgba(255, 214, 51, 0.12),
            transparent 30%
        ),
        radial-gradient(
            circle at 85% 75%,
            rgba(255, 140, 0, 0.10),
            transparent 30%
        ),
        #161616;
}


body.dark-mode .hero-badge {

    background: #3b310d;

    border-color: #d89b00;

    color: #ffd633;
}


body.dark-mode .hero-secondary {

    background: #222222;

    border-color: #66551a;

    color: #fff3b0;
}


body.dark-mode .main-section,
body.dark-mode .stack-section,
body.dark-mode .queue-section,
body.dark-mode .linked-list-section,
body.dark-mode .tree-section,
body.dark-mode .graph-section,
body.dark-mode .stat-card {

    background: #202020;

    border-color: #4d4218;

    color: #f8f1d0;
}


body.dark-mode .status {

    background: #181818;

    border-color: #4d4218;

    color: #fff3b0;
}


body.dark-mode input,
body.dark-mode select {

    background: #181818;

    color: #fff3b0;

    border-color: #66551a;
}


body.dark-mode .graph-node,
body.dark-mode .tree-node,
body.dark-mode .linked-node,
body.dark-mode .stack-element,
body.dark-mode .queue-element {

    background: #3b310d;

    color: #fff3b0;

    border-color: #d89b00;
}



body.dark-mode .graph-svg .graph-edge {

    stroke: #d8b83f;
}

:root {
    --heading-color: #1f2937;
    --text-color: #374151;
}



body.dark-mode {
    --heading-color: #f9fafb;
    --text-color: #e5e7eb;
}


h1,
h2,
h3,
h4,
h5,
h6,
.logo,
.navbar a {
    color: var(--heading-color);
}



p,
label,
span {
    color: var(--text-color);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
    color: #f9fafb;
}


body.dark-mode .hero h1 {
    color: #f9fafb;
}


body.dark-mode .hero h1 span {
    background: linear-gradient(
        90deg,
        #818cf8,
        #a78bfa,
        #f472b6
    );

    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

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


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


body.dark-mode label {
    color: #e5e7eb;
}


body.dark-mode .algorithm-info,
body.dark-mode .algorithm-info h2,
body.dark-mode .algorithm-info p {
    color: #f9fafb;
}


body.dark-mode .complexity strong,
body.dark-mode .complexity span {
    color: #e5e7eb;
}

.login-page {

    min-height: 100vh;

    margin: 0;

    display: flex;

    justify-content: center;

    align-items: center;

    padding: 40px 20px;

    box-sizing: border-box;

    background:
        radial-gradient(
            circle at 10% 20%,
            rgba(99, 102, 241, 0.12),
            transparent 35%
        ),
        radial-gradient(
            circle at 90% 80%,
            rgba(168, 85, 247, 0.12),
            transparent 35%
        );

}

.login-container {

    width: 100%;

    max-width: 1050px;

    min-height: 600px;

    display: grid;

    grid-template-columns: 1fr 430px;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 24px;

    overflow: hidden;

    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.12);
}


.login-left {

    padding: 70px;

    display: flex;

    flex-direction: column;

    justify-content: center;

    background:
        linear-gradient(
            135deg,
            #eef2ff,
            #faf5ff
        );
}


.login-brand {

    font-size: 18px;

    font-weight: 800;

    margin-bottom: 35px;
}


.login-left h1 {

    margin: 0;

    font-size: 55px;

    line-height: 1.05;

    font-weight: 900;

    letter-spacing: -2px;
}


.login-left h1 span {

    display: block;

    background:
        linear-gradient(
            90deg,
            #6366f1,
            #8b5cf6,
            #ec4899
        );

    -webkit-background-clip: text;

    background-clip: text;

    color: transparent;
}


.login-left > p {

    max-width: 500px;

    margin-top: 25px;

    font-size: 17px;

    line-height: 1.7;

    opacity: 0.7;
}


/* FEATURES */

.login-features {

    display: flex;

    gap: 30px;

    margin-top: 45px;

    flex-wrap: wrap;
}


.login-features div {

    display: flex;

    flex-direction: column;

    gap: 5px;

    font-size: 22px;
}


.login-features strong {

    font-size: 13px;
}


.login-features small {

    font-size: 11px;

    opacity: 0.6;
}

.login-card {

    padding: 55px 45px;

    display: flex;

    flex-direction: column;

    justify-content: center;

    box-sizing: border-box;
}


.login-header {

    margin-bottom: 30px;
}


.login-header h2 {

    margin: 0;

    font-size: 28px;
}


.login-header p {

    margin-top: 8px;

    font-size: 14px;

    opacity: 0.6;
}


.form-group {

    margin-bottom: 20px;
}


.form-group label {

    display: block;

    margin-bottom: 8px;

    font-size: 13px;

    font-weight: 700;
}


.form-group input {

    width: 100%;

    padding: 13px 14px;

    box-sizing: border-box;

    border: 1px solid #d1d5db;

    border-radius: 9px;

    font-size: 14px;

    background: #ffffff;

    color: #111827;
}


.form-group input:focus {

    outline: none;

    border-color: #6366f1;

    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.12);
}


.password-box {

    position: relative;
}


.password-box input {

    padding-right: 50px;
}


.password-box button {

    position: absolute;

    right: 8px;

    top: 50%;

    transform: translateY(-50%);

    padding: 5px;

    background: transparent;

    box-shadow: none;

}

.login-options {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin: 5px 0 25px;

    font-size: 12px;
}


.remember-me {

    display: flex;

    align-items: center;

    gap: 6px;

    font-weight: 500;
}


.login-options a,
.signup-text a {

    color: #6366f1;

    text-decoration: none;

    font-weight: 700;
}


.login-button {

    width: 100%;

    padding: 14px;

    border: none;

    border-radius: 9px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            #6366f1,
            #8b5cf6
        );

    font-size: 15px;

    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 8px 20px rgba(99, 102, 241, 0.25);

    transition: 0.25s;
}


.login-button:hover {

    transform: translateY(-2px);

    box-shadow:
        0 12px 25px rgba(99, 102, 241, 0.35);
}


.login-status {

    margin-top: 15px;

    text-align: center;

    font-size: 13px;

    min-height: 20px;
}


.signup-text {

    margin-top: 25px;

    text-align: center;

    font-size: 13px;
}


.back-home {

    margin-top: 25px;

    text-align: center;

    text-decoration: none;

    font-size: 13px;

    font-weight: 600;

    opacity: 0.65;
}

body.dark-mode.login-page {

    background: #111827;
}


body.dark-mode .login-container {

    background: #1f2937;

    border-color: #374151;

    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.4);
}


body.dark-mode .login-left {

    background:
        linear-gradient(
            135deg,
            #1e1b4b,
            #312e81
        );
}


body.dark-mode .login-card {

    color: #f9fafb;
}


body.dark-mode .form-group input {

    background: #111827;

    color: #f9fafb;

    border-color: #4b5563;
}


body.dark-mode .login-options a,
body.dark-mode .signup-text a {

    color: #a5b4fc;
}


body.dark-mode .back-home {

    color: #f9fafb;
}


@media (max-width: 800px) {

    .login-container {

        grid-template-columns: 1fr;

    }

    .login-left {

        padding: 45px 30px;

        text-align: center;

    }

    .login-left h1 {

        font-size: 42px;

    }

    .login-left > p {

        margin-left: auto;
        margin-right: auto;

    }

    .login-features {

        justify-content: center;

    }

    .login-card {

        padding: 40px 30px;

    }

}
#userWelcome {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

body.dark-mode #userWelcome {
    color: #f9fafb;
}

#logoutBtn {
    background: #ef4444;
    color: white;
}

#logoutBtn:hover {
    background: #dc2626;
}

.profile-menu {
    position: relative;
}

#profileButton {
    background: transparent;
    border: 1px solid #d1d5db;
    color: inherit;
    padding: 8px 12px;
}

#profileButton:hover {
    background: #f3f4f6;
}

.profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 48px;
    width: 220px;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    z-index: 2000;
}

.profile-dropdown.show {
    display: block;
}

.profile-name {
    font-size: 15px;
    font-weight: 800;
}

.profile-email {
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.6;
    word-break: break-all;
}

.profile-dropdown hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 12px 0;
}

.profile-dropdown button {
    width: 100%;
    background: #ef4444;
    color: white;
}

body.dark-mode .profile-dropdown {
    background: #1f2937;
    border-color: #374151;
}

body.dark-mode #profileButton {
    border-color: #4b5563;
}

body.dark-mode #profileButton:hover {
    background: #374151;
}

body.dark-mode .profile-dropdown hr {
    border-color: #374151;
}

.dashboard-page {
    min-height: 100vh;
}

.dashboard-container {
    width: 94%;
    max-width: 1100px;
    margin: 50px auto;
}



.dashboard-hero {
    padding: 60px;
    border-radius: 24px;

    background:
        radial-gradient(
            circle at 90% 20%,
            rgba(139, 92, 246, 0.18),
            transparent 35%
        ),
        linear-gradient(
            135deg,
            #eef2ff,
            #faf5ff
        );

    border: 1px solid #e5e7eb;
}

.dashboard-badge {
    display: inline-block;

    padding: 8px 15px;

    border-radius: 50px;

    background: rgba(99, 102, 241, 0.1);

    color: #4f46e5;

    font-size: 13px;

    font-weight: 700;

    margin-bottom: 20px;
}

.dashboard-hero h1 {
    margin: 0;

    font-size: clamp(
        38px,
        5vw,
        60px
    );

    line-height: 1.1;

    font-weight: 900;
}

.dashboard-hero h1 span {
    background:
        linear-gradient(
            90deg,
            #6366f1,
            #8b5cf6,
            #ec4899
        );

    -webkit-background-clip: text;

    background-clip: text;

    color: transparent;
}

.dashboard-hero p {
    max-width: 650px;

    margin: 20px 0 30px;

    font-size: 17px;

    line-height: 1.7;

    opacity: 0.7;
}

.dashboard-primary {
    display: inline-block;

    padding: 14px 24px;

    border-radius: 10px;

    color: white;

    text-decoration: none;

    font-size: 15px;

    font-weight: 700;

    background:
        linear-gradient(
            135deg,
            #6366f1,
            #8b5cf6
        );

    box-shadow:
        0 10px 25px
        rgba(99, 102, 241, 0.25);

    transition: 0.25s;
}

.dashboard-primary:hover {
    transform: translateY(-3px);
}


.dashboard-stats {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 18px;

    margin-top: 25px;
}

.dashboard-card {
    padding: 25px;

    text-align: center;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 16px;

    box-shadow:
        0 8px 25px
        rgba(0, 0, 0, 0.05);

    transition: 0.25s;
}

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

.dashboard-icon {
    font-size: 26px;

    margin-bottom: 10px;
}

.dashboard-number {
    font-size: 28px;

    font-weight: 900;
}

.dashboard-title {
    margin-top: 5px;

    font-size: 13px;

    opacity: 0.6;

    font-weight: 600;
}

.learning-section {
    margin-top: 55px;
}

.learning-section h2 {
    margin-bottom: 8px;

    font-size: 30px;
}

.learning-section > p {
    opacity: 0.6;

    margin-bottom: 25px;
}

.learning-grid {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 18px;
}

.learning-card {
    padding: 25px;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 16px;

    text-decoration: none;

    color: inherit;

    transition: 0.25s;
}

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

    border-color: #6366f1;

    box-shadow:
        0 12px 30px
        rgba(99, 102, 241, 0.12);
}

.learning-card span {
    font-size: 32px;
}

.learning-card h3 {
    margin: 15px 0 8px;

    font-size: 18px;
}

.learning-card p {
    margin: 0;

    font-size: 13px;

    line-height: 1.6;

    opacity: 0.6;
}


body.dark-mode .dashboard-hero {
    background:
        radial-gradient(
            circle at 90% 20%,
            rgba(139, 92, 246, 0.2),
            transparent 35%
        ),
        #1f2937;

    border-color: #374151;
}

body.dark-mode .dashboard-badge {
    color: #a5b4fc;
}

body.dark-mode .dashboard-card,
body.dark-mode .learning-card {
    background: #1f2937;

    border-color: #374151;

    color: #f9fafb;
}

body.dark-mode .learning-card:hover {
    border-color: #818cf8;
}


@media (max-width: 800px) {

    .dashboard-container {
        margin: 30px auto;
    }

    .dashboard-hero {
        padding: 40px 25px;
    }

    .dashboard-stats {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .learning-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

}


@media (max-width: 500px) {

    .dashboard-stats,
    .learning-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero h1 {
        font-size: 36px;
    }

}

.profile-section {
    margin-top: 55px;
}

.profile-section h2 {
    margin-bottom: 20px;
    font-size: 30px;
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 25px;

    padding: 30px;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 18px;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.05);
}

.profile-avatar {
    width: 80px;
    height: 80px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    font-size: 35px;

    background:
        linear-gradient(
            135deg,
            #6366f1,
            #8b5cf6
        );
}

.profile-details {
    display: grid;
    grid-template-columns:
        repeat(3, 1fr);

    gap: 50px;

    flex: 1;
}

.profile-details div {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-details span {
    font-size: 12px;
    opacity: 0.55;
}

.profile-details strong {
    font-size: 15px;
}

.account-status {
    color: #16a34a;
}

body.dark-mode .profile-card {
    background: #1f2937;
    border-color: #374151;
}

@media (max-width: 700px) {

    .profile-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-details {
        width: 100%;
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.progress-section {
    margin-top: 55px;
}

.progress-section h2 {
    margin-bottom: 8px;
    font-size: 30px;
}

.progress-section > p {
    margin-bottom: 25px;
    opacity: 0.6;
}

.progress-card {
    padding: 30px;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 18px;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.05);
}

.progress-item {
    margin-bottom: 25px;
}

.progress-item:last-child {
    margin-bottom: 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 8px;

    font-size: 14px;
    font-weight: 600;
}

.progress-header strong {
    font-size: 13px;
    opacity: 0.7;
}

.progress-bar {
    width: 100%;
    height: 10px;

    overflow: hidden;

    border-radius: 20px;

    background: #e5e7eb;
}

.progress-fill {
    height: 100%;

    border-radius: 20px;

    background:
        linear-gradient(
            90deg,
            #6366f1,
            #8b5cf6
        );

    transition: width 0.5s ease;
}

body.dark-mode .progress-card {
    background: #1f2937;
    border-color: #374151;
}

body.dark-mode .progress-bar {
    background: #374151;
}
.reset-progress-btn {
    margin-top: 18px;
    padding: 10px 18px;

    background: #ef4444;
    color: white;

    border: none;
    border-radius: 8px;

    font-size: 13px;
    font-weight: 700;

    cursor: pointer;
}

.reset-progress-btn:hover {
    background: #dc2626;
}

.overall-progress-card {

    margin: 25px 0;

    padding: 25px;

    border: 2px solid #f5c542;

    border-radius: 16px;

    background: rgba(255, 255, 255, 0.04);

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);

}


.overall-progress-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 20px;

    margin-bottom: 18px;

}


.overall-progress-label {

    font-size: 20px;

    font-weight: 700;

}


.overall-progress-header p {

    margin: 6px 0 0;

    opacity: 0.75;

    font-size: 14px;

}


#overallProgressText {

    font-size: 26px;

    font-weight: 800;

}


.overall-progress-bar {

    width: 100%;

    height: 18px;

    background: rgba(255, 255, 255, 0.12);

    border-radius: 20px;

    overflow: hidden;

}


.overall-progress-fill {

    width: 0%;

    height: 100%;

    border-radius: 20px;

    background: linear-gradient(
        90deg,
        #f5c542,
        #ffd966
    );

    transition: width 0.6s ease;

}

body.dark-mode .graph {

    background: #111827;

    border-color: #6b7280;

    box-shadow:
        inset 0 0 25px rgba(0, 0, 0, 0.25);

}

body.dark-mode .graph-node {

    background: #374151;

    color: #ffffff;

    border-color: #f5c542;

    box-shadow:
        0 0 12px rgba(245, 197, 66, 0.15);

}

body.dark-mode .graph-svg .graph-edge {

    stroke: #d1d5db;

    stroke-width: 1.5;

}

body.dark-mode .graph-controls input {

    background: #111827;

    color: #ffffff;

    border-color: #6b7280;

}

body.dark-mode .graph-controls input::placeholder {

    color: #9ca3af;

}

body.dark-mode .graph-controls input:focus {

    border-color: #f5c542;

    box-shadow:
        0 0 0 3px rgba(245, 197, 66, 0.15);

}

body.dark-mode .graph-controls button {

    background: #374151;

    color: #ffffff;

    border: 1px solid #6b7280;

}

body.dark-mode .graph-controls button:hover {

    background: #4b5563;

    border-color: #f5c542;

}

body.dark-mode .graph-section .status {

    background: #111827;

    color: #f9fafb;

    border-color: #374151;

}

body.dark-mode .graph-section h2 {

    color: #f9fafb;

}