/* DAA Visualizer Global Shell CSS */

/* SVG Tree Overrides */
.node-circle {
    fill: #ffffff;
    stroke: #006576;
    stroke-width: 2px;
    transition: all 0.3s ease;
}

.node-text {
    fill: #001f26;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    text-anchor: middle;
    alignment-baseline: central;
}

.link-line {
    stroke: #bec8cb;
    stroke-width: 2px;
}

/* Linear structures overrides */
.linear-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow-x: auto;
    padding: 1rem;
    padding-right: 5rem; /* Space for labels */
    margin: auto;
    width: fit-content;
    max-width: 100%;
}

.stack-container {
    flex-direction: column;
    width: auto;
    gap: 0 !important;
}

.stack-container .linear-node {
    border-radius: 0;
    margin-bottom: -2px; /* Collapse borders */
    background: #e3eff6; /* Light blue */
    border-color: #003e5c; /* Dark blue border */
    box-shadow: none;
}

.stack-container .linear-node:first-child {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.stack-container .linear-node:last-child {
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    margin-bottom: 0;
}

.stack-container .linear-node {
    position: relative;
}

.stack-top::after {
    content: "\2190 Top";
    position: absolute;
    left: 100%;
    margin-left: 12px;
    top: 25%;
    transform: translateY(-50%);
    color: #d97706; /* Amber */
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    pointer-events: none;
}

.stack-container .linear-node:last-child::before {
    content: "\2190 Bottom";
    position: absolute;
    left: 100%;
    margin-left: 12px;
    top: 75%;
    transform: translateY(-50%);
    color: #6f797c;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    pointer-events: none;
}

.linear-node {
    width: 3.5rem;
    height: 3.5rem;
    background: #ffffff;
    border: 2px solid #006576;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    color: #001f26;
    box-shadow: 0 4px 12px rgba(0, 101, 118, 0.15);
    transition: all 0.3s ease;
}

.linear-arrow {
    color: #bec8cb;
    font-weight: bold;
    font-size: 1.5rem;
}

.stack-top {
    border-color: #fd9836;
    background: #ffdcc2;
    color: #683700;
}

/* Queue Container Styling */
.queue-container {
    flex-direction: row;
    width: auto;
    gap: 0 !important;
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.queue-container .linear-node {
    border-radius: 0;
    margin-right: -2px; /* Collapse borders horizontally */
    background: #e3eff6; /* Light blue */
    border-color: #003e5c; /* Dark blue border */
    box-shadow: none;
    position: relative;
}

.queue-container .linear-node:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.queue-container .linear-node:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    margin-right: 0;
}

.queue-container .linear-node:first-child::before {
    content: "Front \2193"; /* Front pointing down */
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    color: #d97706; /* Amber */
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    pointer-events: none;
}

.queue-container .linear-node:last-child::after {
    content: "\2191 Rear"; /* Rear pointing up */
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    color: #6f797c;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    pointer-events: none;
}

/* Animations */
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulseHighlight {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(253, 152, 54, 0.7); border-color: #fd9836; }
    50% { transform: scale(1.15); box-shadow: 0 0 0 10px rgba(253, 152, 54, 0); border-color: #fd9836; }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(253, 152, 54, 0); }
}

@keyframes flashFound {
    0% { background: #4edea3; border-color: #00855b; color: white; transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { background: #ffffff; border-color: #00855b; color: #001f26; transform: scale(1); }
}

@keyframes flashNotFound {
    0% { background: #ffdad6; border-color: #ba1a1a; color: white; transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { background: #ffffff; border-color: #ba1a1a; color: #001f26; transform: scale(1); }
}

@keyframes breakAway {
    0% { transform: scale(1) translateY(0); opacity: 1; }
    50% { transform: scale(1.1) translateY(-10px); opacity: 0.8; }
    100% { transform: scale(0.5) translateY(-50px); opacity: 0; }
}

@keyframes comeIn {
    0% { transform: scale(0.5) translateY(-50px); opacity: 0; }
    50% { transform: scale(1.1) translateY(10px); opacity: 0.8; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.anim-traverse {
    animation: pulseHighlight 0.8s ease;
    stroke: #fd9836 !important;
}

.anim-traverse circle, .anim-traverse.linear-node {
    border-color: #fd9836 !important;
}

.anim-found {
    animation: flashFound 1s ease;
    stroke: #00855b !important;
}

.anim-found circle, .anim-found.linear-node {
    border-color: #00855b !important;
}

.anim-not-found {
    animation: flashNotFound 1s ease;
    stroke: #ba1a1a !important;
}

.anim-not-found circle, .anim-not-found.linear-node {
    border-color: #ba1a1a !important;
}

.anim-selected {
    stroke: #fd9836 !important;
    border-color: #fd9836 !important;
    fill: #ffdcc2 !important;
    background: #ffdcc2 !important;
    transform: scale(1.1);
}

.rb-red {
    stroke: #ba1a1a !important;
}
.rb-black {
    stroke: #121c2a !important;
}
