/* Base Styles */

body {
    font-family: Arial, sans-serif;
    background-color: #121212;
    color: #ffffff;
    margin: 0;
    padding: 0;
}

.site-header {
    text-align: center;
    padding: 20px;
    background-color: #333;
    border-bottom: 2px solid #444;
}

footer {
    text-align: center;
    font-size: 14px;
    color: #ddd;
    background-color: #333;
    position: fixed; /* Fixed position on desktop */
    bottom: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    z-index: 100; /* Ensure footer is above other content */
}

footer p {
    margin: 0;
    padding: 0 10px;
}

footer a,
footer a:visited {
    color: #888;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.layout-container {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 100px); /* Adjusted height to account for header and footer */
    overflow: hidden;
}

.item-list {
    flex: 1;
    background-color: #333;
    padding: 20px;
    overflow-y: auto;
    border-right: 2px solid #444;
}

.crafting-panel {
    flex: 2;
    padding: 20px;
    overflow-y: auto;
    background-color: #222;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

#search-box {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 15px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid #555;
    border-radius: 5px;
    background-color: #222;
    color: #ddd;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    cursor: pointer;
    background-color: #444;
    border-radius: 5px;
    margin-bottom: 5px;
    transition: background-color 0.3s;
    flex-direction: row;
}

.item-card:hover {
    background-color: #555;
}

.item-card img {
    width: auto;
    max-height: 48px;
    object-fit: contain;
    display: block;
}

.crafting-node-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-top: 15px;
    flex-wrap: wrap;
}

.crafting-node {
    background-color: #333;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 0 7px rgba(0, 0, 0, 0.4);
    position: relative;
    min-width: 200px;
}

.crafting-node img {
    width: auto;
    max-height: 64px;
    object-fit: contain;
}

.crafting-node input {
    width: 50px;
    padding: 5px;
    margin-top: 5px;
    border: 1px solid #555;
    background-color: #444;
    color: #fff;
    border-radius: 5px;
    text-align: center;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 200; /* Ensure loading overlay covers all content */
}

.loading-overlay.active {
    visibility: visible;
    opacity: 1;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 6px solid #ccc;
    border-top: 6px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Default Content Styles */
#default-content {
    text-align: left;
    padding: 40px;
    max-width: 600px;
}

#default-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

#default-content p {
    font-size: 16px;
    line-height: 1.5;
}

#default-content ul {
    list-style-type: disc;
    margin: 20px auto;
    padding-left: 20px;
    max-width: 400px;
}

#default-content li {
    margin-bottom: 10px;
}

/* Recipe Selector Styles */
.recipe-selector {
    width: auto;
    margin-bottom: 10px;
    padding: 5px;
    background-color: #444;
    color: #ddd;
    border: 1px solid #555;
    border-radius: 5px;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.recipe-selector option {
    background-color: #333;
    color: #ddd;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .layout-container {
        flex-direction: column;
        height: auto; /* Allow content to dictate height */
    }

    .item-list {
        padding: 15px 10px;
        border-right: none;
        border-bottom: 2px solid #444;
        max-height: 40vh; /* Limit height to 40% of the viewport height */
        overflow-y: auto;
    }

    .crafting-panel {
        padding: 15px 10px;
        align-items: stretch;
        flex: 1;
        overflow-y: auto;
    }

    #search-box {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .item-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .item-card img {
        max-height: 64px;
    }

    .crafting-node-container {
        flex-direction: column;
        align-items: center;
    }

    footer {
        position: static; /* Change to static position on mobile */
        flex-direction: column;
        height: auto;
        padding: 10px 0;
    }

    footer p {
        padding: 5px 0;
    }

    .layout-container {
        margin-bottom: 20px; /* Add margin to prevent content overlap with footer */
    }
}