:root
{
    --primary-color: #4CAF50;
    --secondary-color: #1a1a1a;
    --text-color: #333;
    --background-color: rgb(248, 248, 248);
}

*
{
    box-sizing: border-box;
}

html
{
    background-color: rgb(248, 248, 248);
}

body
{
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes slideIn {
    from { transform: translateX(-30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.nav-bar
{
    display: flex;
    background-color: #1a1a1a;
    color: white;
    height: 12vh;
    user-select: none;
    gap: 20px;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 10;
}

#site-title
{
    font-size: 1.8rem;
    margin-left: 20px;
    margin-right: 20px;
    font-weight: bold;
    transition: color 0.3s ease;
}

#site-title:hover
{
    cursor: default;
    color: #4CAF50;
}

#divider
{
    height: 60%;
    width: 2px;
    background-color: rgba(255, 255, 255, 0.5);
    margin-right: 20px;
}

.nav-item
{
    background-color: #1a1a1a;
    display: grid;
    place-items: center;
}

.nav-btn
{
    background-color: white;
    color: black;
    border-radius: 30px;
    padding: 8px 30px;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.nav-btn:hover
{
    transform: scale(1.1);
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.nav-btn.active {
    background-color: #4CAF50;
    color: white;
    transform: scale(1);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

.grid-container
{
    margin: 20px 40px;
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    grid-auto-flow: column;
    gap: 30px;
    height: calc(100vh - 40px - 12vh);
}

.grid-item
{
    overflow: auto;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    opacity: 0;
    background-color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.5s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-item:hover {
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

.grid-item:nth-child(1)
{
    opacity: 1;
    animation: fadeIn 0.8s ease;
}

.grid-item.visible {
    opacity: 1;
    animation: fadeIn 0.8s ease forwards;
}

#pseudo
{
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    height: 100%;
}

.input-region
{
    display: flex;
    height: 50%;
    width: 100%;
    position: relative;
    flex-direction: column;
    justify-content: flex-end;
    gap: 30px;
}

#pseudo h2
{
    text-align: center;
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 20px;
    position: relative;
    animation: fadeIn 1s ease;
}

#pseudo h2::after {
    content: '';
    display: block;
    width: 50%;
    height: 3px;
    background-color: #4CAF50;
    margin: 8px auto 0;
    border-radius: 2px;
    transition: width 0.3s ease;
}

#pseudo:hover h2::after {
    width: 70%;
}


.array-input
{
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 15px 20px;
    height: 20%;
    font-size: large;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.array-input:focus
{
    transform: scale(1.05);
    outline: none;
    border: 2px solid #4CAF50;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.3);
}

.array-input:hover
{
    transform: scale(1.05);
}

.submit-btn
{
    align-self: flex-end;
    padding: 12px 25px;
    color: white;
    background-color: #4CAF50;
    border: none;
    border-radius: 20px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
    cursor: pointer;
}

.submit-btn:hover
{
    transform: scale(1.1);
    background-color: #45a049;
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.5);
}

.submit-btn:active
{
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.4);
}

.desc-region
{
    display: flex;
    flex-direction: column;
    height: 50%;
    width: 100%;
    overflow: hidden;
    padding: 20px 10px;
    margin-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    animation: fadeIn 1.2s ease;
}

.array-input-desc
{
    font-size: large;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.desc-region p {
    line-height: 1.6;
    color: #555;
}

.desc-region p:last-child {
    background-color: rgba(76, 175, 80, 0.1);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #4CAF50;
}

.step.unfocus 
{
    opacity: 0.5;
    font-size: large;
}

.step.focus
{
    opacity: 1;
    font-size: x-large;
    font-weight: bold;
    color: #4CAF50;
}

#ori-array
{
    display: flex;
    flex-direction: column;
    padding: 20px;
    font-size: large;
    font-weight: bold;
}

.ori-header
{
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    position: relative;
}

.ori-header::after {
    content: '';
    display: block;
    width: 40%;
    height: 2px;
    background-color: #4CAF50;
    margin: 8px auto 0;
}

.array-holder
{
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    width: 100%;
}

.array-item
{
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 12px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.array-item:hover
{
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    border-color: #4CAF50;
}

.array-item.highlight {
    background-color: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
    animation: pulse 0.6s ease infinite;
}

#runs-region
{
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    padding: 20px 10px;
}

.runs-header {
    text-align: center;
    margin-bottom: 15px;
    color: #333;
    position: relative;
}

.runs-header::after {
    content: '';
    display: block;
    width: 40%;
    height: 2px;
    background-color: #4CAF50;
    margin: 8px auto 0;
}

.run-holder
{
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 15px;
    border-radius: 15px;
    width: 100%;
    background-color: rgba(76, 175, 80, 0.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease;
}

.run-holder:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.run-item
{
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background-color: white;
    padding: 8px 10px;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
}

.run-item:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#heap-region
{
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    font-size: large;
    font-weight: bold;
    padding: 20px;
}

.heap-header
{
    text-align: center;
    font-size: normal;
    margin-bottom: 15px;
    color: #333;
    position: relative;
}

.heap-header::after {
    content: '';
    display: block;
    width: 40%;
    height: 2px;
    background-color: #4CAF50;
    margin: 8px auto 0;
}

.heap-holder
{
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    width: 100%;
    padding:5px;
    border-radius: 10px;
}

.heap-item
{
    display: block;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    padding: 12px 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease;
}

.heap-item:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    border-color: #4CAF50;
}

.heap-item.active {
    background-color: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
}

#result-region
{
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

.result-header
{
    text-align: center;
    margin-bottom: 15px;
    color: #333;
    position: relative;
}

.result-header::after {
    content: '';
    display: block;
    width: 40%;
    height: 2px;
    background-color: #4CAF50;
    margin: 8px auto 0;
}

.result-item
{
    width: 100%;
    text-align: center;
    padding: 12px 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    font-size: large;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease;
}

.result-item:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    border-color: #4CAF50;
}

.result-item.highlight {
    background-color: #4CAF50;
    color: white;
    animation: pulse 0.8s ease;
}

/* Step animation for visualization */
.step {
    font-size: large;
    margin: 20px;
    color: #555;
    transition: all 0.4s ease;
    text-align: center;
}

.step.active {
    color: #000;
    font-weight: bold;
    transform: scale(1.05);
}

.play-btn {
    display: inline-block;
    margin-top: auto;
    height: 60px;
    width: 60px;
    max-width: auto;
    border: var(--primary-color);
    background-image: url('./media/icons8-play-96.png');
    background-color: #45a049;
    background-repeat: no-repeat;
    background-size: 60%;
    background-position: center;
    border-radius: 50%;
    opacity: 0.8;
    box-shadow: 0px 0px 20px rgba(76, 175, 80, 0.8);
    transition: all 0.3s ease;
}

.play-btn:hover
{
    cursor:pointer;
    opacity: 1;
}

.play-btn:active {
    transform: scale(0.8);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .grid-container {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: auto;
        height: auto;
    }
    
    .grid-item {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
    
    .nav-bar {
        flex-direction: column;
        height: auto;
        padding: 10px 0;
    }
    
    #divider {
        width: 80%;
        height: 1px;
        margin: 5px 0;
    }
    
    .nav-btn {
        margin: 5px 0;
    }
}
