/* ftbwiki.org-style infobox */
.infobox {
    float: right;
    width: 260px;
    margin: 0 0 1em 1em;
    background: #c6c6c6;
    border-top: 3px solid #ffffff;
    border-right: 3px solid #555555;
    border-bottom: 3px solid #555555;
    border-left: 3px solid #ffffff;
    font-size: 0.8em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.infobox-header {
    display: none;
    background: linear-gradient(to bottom, #5a7a9a 0%, #4a6a8a 100%);
    color: #fff;
    text-align: center;
    padding: 8px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 2px 2px 0 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.infobox-image {
    text-align: center;
    margin: auto;
    margin-top: 16px;
    width: 100px;
    height: 100px;
    background: #8b8b8b;
    border-top: 2px solid #555555;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    border-left: 2px solid #555555;
    display: flex;
}

.infobox-image img {
    display: block;
    margin: auto;
    width: 64px;
    height: 64px;
    /* Icons are 256x256 from icon-exporter, scaled down to 64x64 */
    max-width: 64px;
    max-height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
}

.infobox-table {
    width: 100%;
    border-collapse: collapse;
}

.infobox-table tr {

}

.infobox-table tr:last-child {
    border-bottom: none;
}

.infobox-label {
    padding: 8px 10px;
    font-weight: bold;
    color: #000;
    width: 40%;
    vertical-align: top;
}

.infobox-value {
    padding: 8px 10px;
    color: #000;
    vertical-align: top;
}

.infobox-value a {
    color: #5a9fd4;
    text-decoration: none;
}

.infobox-value a:hover {
    text-decoration: underline;
}

.infobox-tier {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: bold;
}

.infobox-tier-1 {
    background: #6b5334;
    color: #fff;
    border-top: 1px solid #8b7355;
    border-left: 1px solid #8b7355;
    border-right: 1px solid #3a2a1a;
    border-bottom: 1px solid #3a2a1a;
}

.infobox-tier-2 {
    background: #3080c4;
    color: #fff;
    border-top: 1px solid #4a9fd4;
    border-left: 1px solid #4a9fd4;
    border-right: 1px solid #205080;
    border-bottom: 1px solid #205080;
}

.infobox-tier-3 {
    background: #7050bb;
    color: #fff;
    border-top: 1px solid #9370db;
    border-left: 1px solid #9370db;
    border-right: 1px solid #503080;
    border-bottom: 1px solid #503080;
}

.infobox-tier-4 {
    background: #cc6c00;
    color: #fff;
    border-top: 1px solid #ff8c00;
    border-left: 1px solid #ff8c00;
    border-right: 1px solid #804400;
    border-bottom: 1px solid #804400;
}

.infobox-tier-5 {
    background: #b01030;
    color: #fff;
    border-top: 1px solid #dc143c;
    border-left: 1px solid #dc143c;
    border-right: 1px solid #800020;
    border-bottom: 1px solid #800020;
}

.infobox-tier-6 {
    background: #6b0000;
    color: #fff;
    border-top: 1px solid #8b0000;
    border-left: 1px solid #8b0000;
    border-right: 1px solid #400000;
    border-bottom: 1px solid #400000;
}

.infobox-tier-advanced {
    background: #cc6c00;
    color: #fff;
    border-top: 1px solid #ff8c00;
    border-left: 1px solid #ff8c00;
    border-right: 1px solid #804400;
    border-bottom: 1px solid #804400;
}

.infobox-tier-end {
    background: #b01030;
    color: #fff;
    border-top: 1px solid #dc143c;
    border-left: 1px solid #dc143c;
    border-right: 1px solid #800020;
    border-bottom: 1px solid #800020;
}

/* Stackable indicators */
.stackable-yes {
    color: #2a7a2a;
    font-weight: bold;
}

.stackable-no {
    color: #a02020;
    font-weight: bold;
}

/* Clear float for h2 headings so they start below infobox */
h2 {
    clear: both;
}

/* Crafting Recipe Display */
.crafting-recipe {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    width: fit-content;
    background-color: #c6c6c6;
    padding: 12px;
    border-top: 3px solid #ffffff;
    border-right: 3px solid #555555;
    border-bottom: 3px solid #555555;
    border-left: 3px solid #ffffff;
}

/* 3x3 Crafting Grid */
.crafting-grid {
    display: grid;
    grid-template-columns: repeat(3, 32px);
    grid-template-rows: repeat(3, 32px);
    gap: 2px;
    background-color: #c6c6c6;
    padding: 4px;
}

/* Individual Crafting Slot */
.crafting-slot {
    width: 32px;
    height: 32px;
    background-color: #8b8b8b;
    border-top: 2px solid #555555;
    border-left: 2px solid #555555;
    border-bottom: 2px solid #ffffff;
    border-right: 2px solid #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Empty slot remains visible */
.crafting-slot:empty {
    background-color: #8b8b8b;
}

/* Item in crafting slot */
.crafting-item {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
    cursor: help;
}

/* Links in crafting slots */
.crafting-slot a {
    display: block;
    width: 32px;
    height: 32px;
    text-decoration: none;
    position: relative;
}

.crafting-slot a:hover {
    opacity: 0.8;
}

.crafting-slot a .crafting-item {
    cursor: pointer;
}

/* Tooltip styling */
.crafting-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 12px;
    font-family: 'Minecraft', monospace;
    z-index: 1000;
    pointer-events: none;
    margin-bottom: 4px;
}

/* Arrow between grid and output */
.crafting-arrow {
    font-size: 24px;
    color: #8b8b8b;
    font-weight: bold;
    user-select: none;
}

/* Output Slot Container */
.crafting-output {
    width: 48px;
    height: 48px;
    background-color: #8b8b8b;
    border-top: 2px solid #555555;
    border-left: 2px solid #555555;
    border-bottom: 2px solid #ffffff;
    border-right: 2px solid #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-sizing: border-box;
}

/* Item in output slot (centered 32x32 in 48x48 slot) */
.crafting-output .crafting-item {
    width: 32px;
    height: 32px;
}

/* Quantity counter on output */
.crafting-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 2px 2px 0px #3f3f3f;
    pointer-events: none;
    line-height: 1;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .infobox {
        float: none;
        width: 100%;
        margin: 1em 0;
    }

    .crafting-recipe {
        transform: scale(0.8);
        transform-origin: left center;
    }
}
