/* Overlay dimmed background */
.overlay.dimmed {
    background-color: rgba(0, 0, 0, 0.5);
    transition: opacity 1s;
    opacity: 1;
}

/* New Item Display */
.item-display {
    position: fixed;
    top: 48%;
    left: 50.85%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background-color: #111b2e;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    color: #fff;
    width: 446px; /* Set a fixed width for consistent layout */
    max-width: 446px; /* Ensure width doesn't expand too much */
    height: 256px; /* Set a fixed height for the display */
    overflow: hidden;
    opacity: 0;
    animation: fadeIn 2s forwards;
    display: flex;
    flex-direction: column;
    font-family: var(--dashboard-font-family, "Futura", "Trebuchet MS", "Avenir Next", Arial, sans-serif);
}

.item-display.has-stat-cards {
    height: 300px;
}

/* Darker header section */
.item-display-header {
    background-color: #0a1221;
    width: 100%;
    padding: 15px 10px;
    box-sizing: border-box;
    position: relative; /* To position the close button */
}

/* Ensure the container with title and tier has consistent left alignment */
.item-title-container {
    display: flex;
    flex-direction: column;
    margin-right: 30px; /* Space for the close button */
    padding-left: 10px; /* Ensure both title and tier align from the same starting point */
}

#itemName {
    margin: 0;
    font-size: 24px;
    padding-left: 0;
    font-family: var(--dashboard-font-family, "Futura", "Trebuchet MS", "Avenir Next", Arial, sans-serif);
}

#itemTier {
    font-size: 18px;
    font-weight: 400;
    color: #ffffff;
    margin-top: 5px;
    padding-left: 0;
    padding-right: 10px;
    white-space: nowrap; /* Prevent wrapping of tier text */
    font-family: var(--dashboard-font-family, "Futura", "Trebuchet MS", "Avenir Next", Arial, sans-serif);
}

/* Close button aligned to the top right */
#itemDisplay #closeItemDisplay.close-button {
    background: none;
    border: none;
    border-radius: 0;
    color: #fff;
    font-family: "Arial Black", "Arial", sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    text-transform: none;
    transform: scaleY(0.9);
    transform-origin: center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    position: absolute;
    top: 18px;
    right: 12px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#itemDisplay #closeItemDisplay.close-button:focus-visible {
    background: transparent;
    color: #ffffff;
    outline: none;
}

@media (hover: hover) and (pointer: fine) {
    #itemDisplay #closeItemDisplay.close-button:hover {
        background: transparent;
        color: #ffffff;
        outline: none;
    }
}

/* Main body content */
.item-display-body {
    padding: 20px;
    background-color: #111b2e;
    display: flex;
    justify-content: space-between;
}

/* Item info styling */
.item-info {
    display: flex;
    align-items: flex-start; /* Align the image and text to the top */
}

.item-info img {
    width: 125px;
    height: 125px;
    margin-right: 30px;
    margin-top: 5px; /* Move the image slightly down without affecting text alignment */
}

.item-text {
    flex: 1;
    max-width: 60%; /* Constrain the width of the text area to prevent overlap */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Align the text content to the top */
    font-family: var(--dashboard-font-family, "Futura", "Trebuchet MS", "Avenir Next", Arial, sans-serif);
}

/* Uses the same stat-card structure as inventory item information. */
.item-display-stats {
    margin: 5px 0 10px;
}

.item-text p {
    margin: 0 0 0;
    font-size: 11px;
    font-style: italic;
    line-height: 1.4;
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade-out animation */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

html.phone-optimised .item-display,
body.phone-optimised .item-display {
    width: min(410px, 88vw);
    max-width: min(410px, 88vw);
    top: calc(48% - var(--phone-tile-screen-size, 64px));
    left: 50%;
}

html.phone-optimised .item-display-header,
body.phone-optimised .item-display-header {
    padding: 13px 9px;
}

html.phone-optimised .item-display-body,
body.phone-optimised .item-display-body {
    padding: 16px 14px;
}

html.phone-optimised .item-title-container,
body.phone-optimised .item-title-container {
    padding-left: 6px;
}

html.phone-optimised .item-info img,
body.phone-optimised .item-info img {
    width: 112px;
    height: 112px;
    margin-right: 22px;
}

html.phone-optimised .item-text,
body.phone-optimised .item-text {
    max-width: none;
}

html.phone-optimised .item-display-stats,
body.phone-optimised .item-display-stats {
    gap: 8px;
}
