@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.popup-content:has(#worldInfoRecommenderPopup) {
    overflow-y: auto;
}

.popup-content:has(.edit-popup) {
    overflow: visible;
    overflow-y: auto;
}

.popup-body:has(.edit-popup) {
    overflow: visible;
}

.popup-content:has(.compare-popup) {
    overflow: visible;
    overflow-y: auto;
}
.popup-body:has(.compare-popup) {
    overflow: visible;
}
dialog:has(.compare-popup) {
    max-width: 90dvw;
    min-width: var(--sheldWidth);
}

.popup-content:has(.select-entries-popup) {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
dialog:has(.select-entries-popup) {
    min-width: 600px;
}

#worldInfoRecommenderPopup {
    color: var(--SmartThemeBodyColor);
    font-family: var(--mainFontFamily);
    max-width: 1200px;
    margin: 0 auto;
    font-size: var(--mainFontSize);

    h2 {
        text-align: center;
        margin-bottom: 20px;
        font-weight: 500;
        color: var(--SmartThemeBodyColor);
    }

    h3 {
        font-weight: 500;
        margin-top: 0;
        margin-bottom: 15px;
        color: var(--SmartThemeBodyColor);
    }

    .container {
        display: flex;
        gap: 20px;

        @media (max-width: 768px) {
            flex-direction: column;
        }
    }

    .column {
        width: 30%;
        display: flex;
        flex-direction: column;
        gap: 15px;

        @media (max-width: 768px) {
            width: 100%;
        }
    }

    .wide-column {
        width: 70%;
        display: flex;
        flex-direction: column;
        gap: 15px;

        @media (max-width: 768px) {
            width: 100%;
        }
    }

    .card {
        background-color: var(--SmartThemeBlurTintColor);
        border-radius: 10px;
        padding: 15px;
        box-shadow: 0 2px 4px var(--SmartThemeShadowColor);
        margin-bottom: 0;
        border: 1px solid var(--SmartThemeBorderColor);
    }

    .message-options {
        .message-input {
            width: 50px;
            margin-left: 5px;
            margin-right: 5px;
        }
    }

    .entry-selection-control {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-top: 10px;

        .menu_button {
            padding: 5px 10px;
            font-size: 0.9em;
            i {
                margin-right: 5px;
            }
        }
        span {
            font-size: 0.9em;
            color: var(--SmartThemeBodyColor);
            opacity: 0.8;
        }
    }

    .entry {
        background-color: var(--grey10);
        border-radius: 8px;
        padding: 15px;
        margin-bottom: 15px;
        position: relative;
        border: 1px solid var(--grey30);

        .menu {
            display: flex;
            justify-content: flex-end;
            gap: 8px;
            margin-bottom: 10px;
            flex-wrap: wrap;

            @media (max-width: 512px) {
                flex-wrap: wrap;
                justify-content: flex-end;

                .world-select {
                    order: 2;
                    margin-right: 0;
                    width: 100%;
                    max-width: 100%;
                }
            }

            .world-select {
                margin-right: auto;
                max-width: 200px;
                min-width: 150px;
                height: 30px;
                font-size: 0.9em;
                background-color: var(--SmartThemeInputColor);
                color: var(--SmartThemeInputTextColor);
                border: 1px solid var(--SmartThemeBorderColor);
                border-radius: 4px;
            }

            .menu_button {
                padding: 5px 10px;
                font-size: 0.9em;
                height: fit-content;
            }

            .add,
            .continue {
                background-color: var(--active);

                &:hover {
                    background-color: color-mix(in srgb, var(--active) 85%, white);
                }
            }

            .blacklist {
                background-color: var(--grey50);

                &:hover {
                    background-color: var(--grey70);
                }
            }

            .remove {
                background-color: var(--warning);

                &:hover {
                    background-color: color-mix(in srgb, var(--warning) 85%, white);
                }
            }
        }

        .comment {
            margin-top: 0;
            margin-bottom: 5px;
            color: var(--SmartThemeBodyColor);
            font-weight: 500;
        }

        .key {
            color: var(--SmartThemeEmColor);
            font-size: 0.9em;
            margin-bottom: 8px;
        }

        .content {
            margin-bottom: 5px;
            color: var(--SmartThemeBodyColor);
        }
    }

    .actions {
        display: flex;
        justify-content: flex-end;
        margin-bottom: 15px;

        .menu_button {
            background-color: var(--active);
            min-width: 90px;

            &:hover {
                background-color: color-mix(in srgb, var(--active) 85%, white);
            }

            &:disabled {
                opacity: 0.5;
                cursor: not-allowed;
                pointer-events: none;
            }
        }
    }

    button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        pointer-events: none;
    }

    .compare-popup {
        color: var(--SmartThemeBodyColor);
        font-family: var(--mainFontFamily);
        padding: 15px;

        h3 {
            margin-bottom: 15px;
            font-weight: 500;
            color: var(--SmartThemeBodyColor);
        }

        h4 {
            margin-bottom: 10px;
            color: var(--SmartThemeBodyColor);
        }

        .content {
            font-family: monospace;
            white-space: pre-wrap;
            padding: 15px;
            border: 1px solid var(--SmartThemeBorderColor);
            border-radius: 8px;
            background-color: var(--SmartThemeBlurTintColor);
            margin-bottom: 10px;

            span {
                &[style*="color: green"] {
                    color: var(--success) !important;
                    background-color: color-mix(in srgb, var(--success) 15%, transparent) !important;
                }

                &[style*="color: red"] {
                    color: var(--warning) !important;
                    background-color: color-mix(in srgb, var(--warning) 15%, transparent) !important;
                }

                &[style*="color: grey"] {
                    color: var(--SmartThemeBodyColor) !important;
                }
            }
        }
    }
}

.select-entries-popup {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
    height: 100%;

    h3 {
        margin-top: 0;
        text-align: center;
    }

    .controls {
        display: flex;
        gap: 10px;
        align-items: center;
        flex-wrap: wrap;

        .text_pole {
            flex-grow: 1;
        }
    }

    .entry-list {
        flex-grow: 1;
        overflow-y: auto;
        border: 1px solid var(--SmartThemeBorderColor);
        border-radius: 8px;
        padding: 10px;
        background-color: var(--SmartThemeChatBGColor);
    }

    .world-group {
        margin-bottom: 15px;

        h4 {
            margin: 0 0 8px 0;
            padding-bottom: 5px;
            border-bottom: 1px solid var(--SmartThemeBorderColor);
            color: var(--SmartThemeEmColor);
        }

        ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        li {
            margin-bottom: 5px;

            label {
                display: flex;
                align-items: center;
                gap: 8px;
                cursor: pointer;
            }
        }
    }
}
