/*
 Copyright (C) 2026 MrHunor, siryanni
  LICENSE:GNU General Public License v3 (GPLv3)
*/
@import url('https://fonts.googleapis.com/css2?family=Funnel+Display:wght@400;500;600;700&display=swap');
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Funnel Display', system-ui, -apple-system, sans-serif;
}

html {
    height: 100%;
}

body {
    background-color: #0b0b0b;
    color: #ffffff;
    padding: 2.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* inner distance */
.navbar, 
main, 
.algo-detail-container, 
.visualizer-container {
    padding: 2.5rem;
}

/* footer to the bottom  */
main, 
.algo-detail-container,
.visualizer-container {
    flex: 1 0 auto;
}

.navbar {
    margin-bottom: 3.5rem;
}

.logo {
    font-size: 2.5rem;
    font-weight: bold;
    letter-spacing: -1px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;          /* full width */
    align-items: start;   
}

.card {
    background-color: #2a2a2a;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    background-color: #333333;
}

.card-img {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #888888;
    background-color: #353535;
    letter-spacing: 1px;
}

.card-img img {
    height: 64px; 
    width: auto;
    filter: contrast(1.5);
}

.card-divider {
    height: 2px;
    background-color: #ffffff;
    width: 100%;
}

.card-title {
    padding: 1.2rem;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Logo-Link Reset */
.logo-link {
    text-decoration: none;
    color: inherit;
}

/* layout for detail-view */
.algo-detail-container {
    display: flex;
    gap: 4rem;
    max-width: 1200px;
    margin: 2rem auto 0 auto;
    align-items: flex-start;
}

/* left bar */
.algo-left-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.algo-preview-box {
    width: 100%;
    height: 320px;
    background-color: #1a1a1a;
    border: 2px solid #2a2a2a;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-weight: 600;
    letter-spacing: 1px;
}

/* play-button */
.play-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    text-decoration: none;
    padding: 0.9rem 1.5rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: all 0.2s ease;
}

.play-button:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.play-icon {
    fill: currentColor;
}

.algo-main-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
    letter-spacing: -0.5px;
}

/* right bar */
.algo-right-column {
    flex: 1.2;
}

.description-card {
    background-color: #161616;
    border: 1px solid #262626;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.description-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    color: #3b82f6;
}

.description-card p {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #cbd5e1; 
}

/* screen-adjustments */
@media (max-width: 850px) {
    .algo-detail-container {
        flex-direction: column;
        gap: 2.5rem;
    }
}

/* visualizer layout */
.visualizer-container {
    max-width: 900px;
    margin: 2rem auto;
    background-color: #161616;
    border: 1px solid #262626;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.visualizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.controls {
    display: flex;
    gap: 1rem;
}

.control-btn {
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.control-btn.primary {
    background-color: #2563eb;
    color: #fff;
}

.control-btn.primary:hover {
    background-color: #1d4ed8;
}

.control-btn.secondary {
    background-color: #262626;
    color: #cbd5e1;
}

.control-btn.secondary:hover {
    background-color: #333333;
}

/* container for bars */
.array-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    height: 350px;
    background-color: #0b0b0b;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #222;
}

/* bar */
.array-bar {
    width: 35px;
    background-color: #3b82f6;
    border-radius: 4px 4px 0 0;
    transition: height 0.1s ease, background-color 0.1s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
}

/* wiki source notice in algo.html */
.wiki-source {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: #666666;
}

.wiki-source a {
    color: #3b82f6;
    text-decoration: none;
}

.wiki-source a:hover {
    text-decoration: underline;
}

/* complexity information */
.complexity {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #262626;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.complexity p {
    margin: 0;
    padding: 0.9rem 1rem;
    background-color: #1f1f1f;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #cbd5e1;
}

.complexity strong {
    color: #3b82f6;
    font-weight: 600;
}

/* slider styling */
.visualizer-header input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    width: 140px;
    cursor: pointer;
}

.visualizer-header input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: #333333;
    border-radius: 3px;
    border: 1px solid #262626;
}

.visualizer-header input[type="range"]::-moz-range-track {
    height: 6px;
    background: #333333;
    border-radius: 3px;
    border: 1px solid #262626;
}

.visualizer-header input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #3b82f6;
    margin-top: -4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s ease, background-color 0.1s ease;
}

.visualizer-header input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s ease, background-color 0.1s ease;
}

.visualizer-header input[type="range"]::-webkit-slider-thumb:hover,
.visualizer-header input[type="range"]::-moz-range-thumb:hover {
    background: #2563eb;
    transform: scale(1.1);
}

/* Footer Styling */
footer {             
    background-color: #1a1a1a; 
    color: #ffffff;
    text-align: center;
    padding: 20px;
    margin-top: auto; 
    border-radius: 15px
}

footer ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 20px; 
    margin-top: 10px;
}

footer a {
    color: #4CAF50; 
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* PATHFINDING */
.path-grid {
    display: grid;
    grid-template-columns: repeat(25, 1fr); 
    gap: 2px;
    background-color: #0b0b0b;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #222;
    aspect-ratio: 2 / 1; 
    max-height: 500px;
    overflow: hidden;
}

.grid-cell {
    background-color: #1a1a1a;
    border: 1px solid #262626;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.grid-cell:hover {
    background-color: #333333;
}

.grid-cell.start {
    background-color: #22c55e;
    border-color: #16a34a;
}

.grid-cell.goal {
    background-color: #ef4444;
    border-color: #dc2626;
}

.grid-cell.wall {
    background-color: #64748b;
    border-color: #6287ba;
}

.grid-cell.visited {
    background-color: #3b82f6;
}

.grid-cell.path {
    background-color: #eab308;
}

/* COMPARISON VIEW STYLING */
.visualizer-container.compare-main-container {
    max-width: 1300px;
}

.compare-grid {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    width: 100%;
}

.compare-pane {
    flex: 1;
    background-color: #0f0f0f;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-width: 0; 
}

.compare-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.5rem;
}

.sub-algo-title {
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 600;
}

.exec-time-badge {
    font-size: 0.8rem;
    color: #888;
    background: #1a1a1a;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #2a2a2a;
}

.compare-array-container {
    height: 280px;
    padding: 1.5rem;
}

@media (max-width: 900px) {
    .compare-grid {
        flex-direction: column;
    }
}

/* TOOL SELECTION & COST TILES & NEW UTILITY CLASSES FOR CLEAN HTML */
.tool-btn.active {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.grid-cell.start,
.grid-cell.goal {
    cursor: grab;
}

.path-message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background-color: rgba(239, 68, 68, 0.12);
    border: 1px solid #ef4444;
    color: #fca5a5;
    font-size: 0.95rem;
    text-align: center;
}

.grid-cell.cost-5 {
    background-color: #475569; 
    border-color: #334155;
}

/* inline replacement */
.server-switch-wrapper {
    display: flex;
    gap: 1rem;
    align-items: center;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.cursor-pointer {
    cursor: pointer;
}

.visualizer-main-container {
    text-align: center;
    padding: 4rem 2.5rem;
}

.visualizer-heading-main {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #3b82f6;
}

.visualizer-desc-text {
    color: #cbd5e1;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

.connecting-hint {
    font-size: 0.9rem;
    color: #888888;
    letter-spacing: 1px;
}

.header-controls-group {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.speed-control-box {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.speed-control-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #cbd5e1;
}

.tool-selector-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-selector-label {
    color: #cbd5e1;
    font-size: 0.9rem;
}

/* --- Mobile optimization (for screens under 768px) --- */
@media (max-width: 768px) {
    /* 1. reduce whole padding */
    body {
        padding: 1rem;
    }

    /* 2. inner-padding  */
    .navbar, 
    main, 
    .algo-detail-container, 
    .visualizer-container {
        padding: 1.25rem;
    }

    /* 3.navbar n logo */
    .navbar {
        margin-bottom: 2rem;
    }
    .logo {
        font-size: 2rem;
    }

    /* 4. Visualizer-Header below eachother */
    .visualizer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .header-controls-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .controls {
        flex-wrap: wrap;
        width: 100%;
    }

    .control-btn {
        flex: 1;
        text-align: center;
    }

    /* 5. pathfinding grid  */
    .path-grid {
        padding: 0.5rem;
        gap: 1px;
    }
}
/*Ok, I am sorry to the reviewer who had (or didn't have to) go through this. 
So to whoever's down here reading this,
I hope your life is filled with joy and luck all throughout 
(PS: please send me a sign, you've read this message. 
Have a nice day, wether adventurer or AI Bot looking for markings
of your brothers.)/*
/*

/*