@import '../utils/colors.less';
@import '../utils/fonts.less';
@import '../utils/mixin.less';

.theme-light .application.daggerheart.dh-style {
    .inventory-item,
    .card-item {
        .item-resource .item-dice-resource {
            img {
                filter: brightness(0) saturate(100%);
            }
        }
    }
}

.appTheme({}, {
    .inventory-item-header .img-portait .roll-img {
        filter: invert(1);
    }
});

.application.daggerheart.dh-style {
    .inventory-item {
        width: 100%;
        list-style-type: none;

        &:not(.single-img):hover {
            .inventory-item-header .img-portait {
                .roll-img {
                    opacity: 1;
                }
                .item-img {
                    opacity: 0;
                }
            }
        }

        .inventory-item-header {
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;

            .img-portait {
                flex: 0 0 40px;
                height: 40px;
                cursor: pointer;
                position: relative;

                .item-img,
                .roll-img {
                    position: absolute;
                    transition: opacity 300ms ease-in;
                    height: 40px;
                    width: 40px;
                    object-fit: cover;
                    border-radius: 3px;
                }

                .roll-img {
                    opacity: 0;
                }
            }

            .item-label {
                flex: 1;
                font-family: @font-body;
                align-self: center;

                .item-name {
                    font-size: 14px;
                }

                .item-tags,
                .item-labels {
                    display: flex;
                    gap: 10px;

                    .tag,
                    .label {
                        display: flex;
                        flex-direction: row;
                        justify-content: center;
                        align-items: center;
                        font-size: 12px;
                    }

                    .tag {
                        padding: 3px 5px;
                        background: light-dark(@dark-15, @beige-15);
                        border: 1px solid light-dark(@dark, @beige);
                        border-radius: 3px;
                    }

                    .label {
                        gap: 4px;
                    }
                }
            }

            .item-resource {
                flex: 0 0 60px;
                display: flex;
                align-items: center;
                gap: 4px;
            }
            .controls {
                flex: 0 0 auto;
                display: flex;
                align-items: center;
                justify-content: end;
                gap: 8px;

                .unequipped {
                    opacity: 0.5;
                }
            }
        }

        .inventory-item-content {
            > *:not(:last-child) {
                margin-bottom: 5px;
            }
            &.extensible {
                display: grid;
                grid-template-rows: 0fr;
                transition: grid-template-rows 0.3s ease-in-out;
                &.extended {
                    grid-template-rows: 1fr;
                }
                .invetory-description {
                    overflow: hidden;

                    h1 {
                        font-size: 32px;
                    }
                    h2 {
                        font-size: 28px;
                        font-weight: 600;
                    }
                    h3 {
                        font-size: 20px;
                        font-weight: 600;
                    }
                    h4 {
                        font-size: 16px;
                        color: @beige;
                        font-weight: 600;
                    }

                    ul,
                    ol {
                        margin: 1rem 0;
                        padding: 0 0 0 1.25rem;

                        li {
                            font-family: @font-body;
                            margin-bottom: 0.25rem;
                        }
                    }

                    ul {
                        list-style: disc;
                    }
                }
            }
            .item-resources {
                display: flex;
                align-items: center;
                gap: 4px;
                .item-dice-resource {
                    position: relative;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    width: 26px;

                    label,
                    i {
                        position: absolute;
                        z-index: 2;
                        cursor: pointer;
                    }

                    label {
                        color: light-dark(white, black);
                        filter: drop-shadow(0 0 1px light-dark(@dark-blue, @golden));
                        font-size: 18px;
                    }

                    img {
                        filter: brightness(0) saturate(100%) invert(97%) sepia(7%) saturate(580%) hue-rotate(332deg)
                            brightness(96%) contrast(95%);
                    }

                    i {
                        text-shadow: 0 0 3px white;
                        filter: drop-shadow(0 1px white);
                        color: black;
                        font-size: 26px;
                    }
                }
            }
        }
    }

    .card-item {
        position: relative;
        height: 120px;
        width: 100px;
        border: 1px solid light-dark(@dark-blue, @golden);
        border-radius: 6px;
        cursor: pointer;

        &:hover {
            .card-label {
                padding-top: 15px;
                .menu {
                    opacity: 1;
                    visibility: visible;
                    transition: all 0.3s ease;
                    max-height: 16px;

                    &.resource-menu {
                        max-height: 55px;

                        &.dice-menu {
                            max-height: 118px;

                            .item-resources {
                                flex-wrap: wrap;
                            }

                            .item-resource {
                                width: unset;
                            }
                        }
                    }
                }
            }
        }

        .card-img {
            height: 100%;
            width: 100%;
            object-fit: cover;
            border-radius: 6px;
        }

        .card-label {
            display: flex;
            flex-direction: column;
            height: fit-content;
            align-items: center;
            gap: 5px;
            padding-top: 5px;
            padding-bottom: 5px;
            width: 100%;
            position: absolute;
            background-color: @dark-blue;
            bottom: 0;
            mask-image: linear-gradient(180deg, transparent 0%, black 20%);

            .card-name {
                font-family: @font-body;
                font-style: normal;
                font-weight: 400;
                font-size: 12px;
                line-height: 15px;

                color: @beige;
            }

            .menu {
                display: flex;
                flex-direction: column;
                gap: 8px;
                max-height: 0px;
                opacity: 0;
                visibility: collapse;
                transition: all 0.3s ease;
                color: @beige;

                .controls {
                    display: flex;
                    gap: 2px;
                    gap: 15px;
                    justify-content: center;
                }
            }
        }

        .item-resources {
            width: 92px;
        }

        .item-resource {
            width: 92px;
        }
    }

    .inventory-item,
    .card-item {
        .item-resources {
            display: flex;
            gap: 4px;

            .resource-edit {
                font-size: 14px;
            }
        }

        .item-resource {
            display: flex;
            align-items: center;
            justify-content: end;
            gap: 4px;

            i {
                flex: none;
                font-size: 14px;
            }

            input {
                flex: 1;
                text-align: center;
            }

            .item-dice-resource {
                position: relative;
                display: flex;
                align-items: center;
                justify-content: center;
                width: 26px;

                label {
                    position: absolute;
                    color: light-dark(white, black);
                    filter: drop-shadow(0 0 1px light-dark(@dark-blue, @golden));
                    z-index: 2;
                    font-size: 18px;
                    cursor: pointer;
                }

                img {
                    filter: brightness(0) saturate(100%) invert(97%) sepia(7%) saturate(580%) hue-rotate(332deg)
                        brightness(96%) contrast(95%);
                }

                i {
                    position: absolute;
                    text-shadow: 0 0 3px white;
                    filter: drop-shadow(0 1px white);
                    color: black;
                    font-size: 26px;
                }
            }
        }
    }
}
