/**
 * 이 파일은 아이모듈 위지윅에디터모듈의 일부입니다. (https://www.imodules.io)
 *
 * 위지윅에디터모듈 스타일시트를 정의한다.
 *
 * @file /modules/wysiwyg/styles/Wysiwyg.css
 * @author Arzz <arzz@arzz.com>
 * @license MIT License 
 * @modified 2024. 11. 5.
 */
div[data-module='wysiwyg'] {
    --im-wysiwyg-content-background-default: var(--im-color-background-500);
    --im-wysiwyg-content-color-default: var(--im-color-foreground-500);
    --im-wysiwyg-content-color-alternate: var(--im-color-foreground-300);

    --im-wysiwyg-content-line-height: var(--im-component-line-height);
    --im-wysiwyg-content-line-gap: var(--im-component-gap-small);

    --im-wysiwyg-content-table-header-border-color-default: var(--im-color-foreground-300);
    --im-wysiwyg-content-table-header-border-color-top: var(--im-color-foreground-500);
    --im-wysiwyg-content-table-header-background-default: var(--im-color-background-300);
    --im-wysiwyg-content-table-body-border-color-default: var(--im-color-foreground-200);
    --im-wysiwyg-content-table-body-border-color-highlighted: var(--im-color-danger-500);
    --im-wysiwyg-content-table-body-background-default: transparent;
    --im-wysiwyg-content-table-body-background-alternate: var(--im-color-foreground-100);

    --im-wysiwyg-content-link-color: var(--im-color-accent-500);

    --im-wysiwyg-content-hr-color: var(--im-color-foreground-100);
    --im-wysiwyg-content-pre-background: var(--im-color-background-400);

    position: relative;
    z-index: 5;

    & + div[data-role='module'][data-module='attachment'] {
        > div[data-role='uploader'] {
            padding-top: 10px;
        }
    }
}

div[data-module='wysiwyg'] div.fr-box,
div[data-role='wysiwyg-content'] {
    background: var(--im-wysiwyg-content-background-default);
    color: var(--im-color-foreground-500);

    &[data-role='wysiwyg-content'] {
        font-family: inherit;
        font-size: inherit;
        line-height: inherit;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p {
        padding-block: var(--im-wysiwyg-content-line-gap);
    }

    pre {
        margin-block: var(--im-wysiwyg-content-line-gap);
        background: var(--im-wysiwyg-content-pre-background);
        font-family: 'Nanum Gothic Coding' monospace;

        a {
            font-family: 'Nanum Gothic Coding' monospace !important;
        }
    }

    table {
        border-collapse: collapse;
        border-spacing: 0;
        border: 1px;
        empty-cells: show;
        table-layout: auto;
        max-width: 100%;

        thead {
            tr {
                border-top: 2px solid var(--im-wysiwyg-content-table-header-border-color-top);
            }

            th {
                background: var(--im-wysiwyg-content-table-header-background-default);
                border: 1px solid var(--im-wysiwyg-content-table-header-border-color-default);
                padding: 2px 5px;
            }
        }

        tbody {
            tr {
                td {
                    border: 1px solid var(--im-wysiwyg-content-table-body-border-color-default);
                    padding: 2px 5px;
                    vertical-align: middle;
                    background: var(--im-wysiwyg-content-table-body-background-default);
                }
            }
        }

        th,
        td {
            &.fr-highlighted {
                border: 1px double var(--im-wysiwyg-content-table-body-border-color-highlighted);
            }

            &.fr-thick {
                border-width: 2px;
            }
        }

        &.fr-alternate-rows {
            tbody {
                tr:nth-child(2n) {
                    background: var(--im-wysiwyg-content-table-body-background-alternate);
                }
            }
        }

        &.fr-dashed-borders {
            td,
            th {
                border-style: dashed;
            }
        }
    }

    blockquote {
        border-left: solid 2px #5e35b1;
        margin-left: 0;
        padding-left: 5px;
        color: #5e35b1;

        > blockquote {
            border-color: #00bcd4;
            color: #00bcd4;

            > blockquote {
                border-color: #43a047;
                color: #43a047;
            }
        }
    }

    *.fr-emoticon {
        font-weight: 400;
        font-family: 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji',
            EmojiSymbols;
        display: inline;
        line-height: 0;

        &.fr-emoticon-img {
            background-repeat: no-repeat !important;
            font-size: inherit;
            height: 1em;
            width: 1em;
            min-height: 20px;
            min-width: 20px;
            display: inline-block;
            margin: -0.1em 0.1em 0.1em;
            line-height: 1;
            vertical-align: middle;
        }
    }

    a {
        color: var(--aui-color-accent-500);
        text-decoration: none;
    }

    a[data-attachment-id] {
        display: inline-flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
        font-size: inherit;
        max-width: 100%;
        height: calc(1em * 1lh);
        gap: 5px;
        line-height: inherit;
        vertical-align: baseline;

        > i[data-type][data-extension] {
            flex-shrink: 0;
            width: calc(1em * 1lh);
            height: calc(1em * 1lh);
            box-sizing: border-box;
            background-clip: padding-box;
            border: 1px solid transparent;
            overflow: hidden;
            color: transparent;
        }

        > span {
            font-weight: bold;
            color: var(--im-wysiwyg-content-link-color);
            height: calc(1em * 1lh);
            flex-shrink: 1;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }

        > small {
            flex-shrink: 0;
            font-size: 1em;
            height: calc(1em * 1lh);
            align-self: baseline;
            color: var(--im-wysiwyg-content-color-alternate);

            &::before {
                content: '(';
            }

            &::after {
                content: ')';
            }
        }
    }

    hr {
        min-width: 100px;
        border: 0;
        background: transparent;

        &.default {
            margin: 16px 0px;
            border-top: 1px solid var(--im-wysiwyg-content-hr-color);
            height: 0;
        }

        &.dashed {
            margin: 16px 0px;
            border-top: 1px dashed var(--im-wysiwyg-content-hr-color);
            height: 0;
        }

        &.bold {
            margin: 16px 0px;
            border-top: 2px solid var(--im-wysiwyg-content-hr-color);
            height: 0;
        }

        &.triangle {
            height: 8px;
            margin: 16px 0px 8px 0;
            position: relative;

            &::after {
                background: var(--im-wysiwyg-content-hr-color);
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 1px;
                z-index: 0;
                content: ' ';
            }

            &::before {
                width: 11px;
                height: 11px;
                background: var(--im-wysiwyg-background-default);
                border: 1px solid var(--im-wysiwyg-content-hr-color);
                position: absolute;
                top: -6px;
                left: 50%;
                margin-left: -5px;
                content: ' ';
                box-sizing: border-box;
                display: block;
                transform: rotate(45deg);
                z-index: 1;
            }
        }

        &.diamond {
            height: 8px;
            margin: 16px 0px 8px 0;
            border-top: 1px solid var(--im-wysiwyg-content-hr-color);
            position: relative;
            overflow: visible;

            &::before {
                width: 11px;
                height: 11px;
                background: var(--im-wysiwyg-background-default);
                border: 1px solid var(--im-wysiwyg-content-hr-color);
                position: absolute;
                top: -6px;
                left: 50%;
                margin-left: -5px;
                content: ' ';
                box-sizing: border-box;
                display: block;
                transform: rotate(45deg);
            }
        }

        &.dotted {
            width: 100%;
            height: 30px;

            &::before {
                content: '●●●●●●';
                display: block;
                font-size: 6px;
                letter-spacing: 8px;
                line-height: 30px;
                padding-left: 8px;
                text-align: center;
                width: 100%;
                height: 30px;
                box-sizing: border-box;
            }
        }
    }

    ol:not([data-role]) {
        margin-left: 25px;
        list-style-position: outside;
    }

    ul:not([data-role]) {
        margin-left: 25px;
        list-style-position: outside;
        list-style-type: disc;
    }

    img {
        max-width: 100%;

        &.fr-dib {
            margin: 10px auto;
            display: block;
            float: none;
            vertical-align: top;

            &.fr-fil {
                margin-left: 0;
                text-align: left;
            }

            &.fr-fir {
                margin-right: 0;
                text-align: right;
            }
        }

        &.fr-dii {
            display: inline-block;
            float: none;
            vertical-align: bottom;
            margin-left: 5px;
            margin-right: 5px;
            max-width: calc(100% - (2 * 5px));

            &.fr-fil {
                float: left;
                margin: 5px 5px 5px 0;
                max-width: calc(100% - 5px);
            }

            &.fr-fir {
                float: right;
                margin: 5px 0 5px 5px;
                max-width: calc(100% - 5px);
            }
        }
    }

    .fr-video {
        max-width: 100%;

        iframe,
        video {
            width: 100%;
            height: auto;
            aspect-ratio: 16/9;
            border: 0;
            display: block;
            z-index: 1;
            box-sizing: border-box;
        }

        &.fr-dvb {
            margin: 10px auto;
            display: block;

            &.fr-fvl {
                text-align: left;
            }

            &.fr-fvr {
                text-align: right;
            }
        }

        &.fr-dvi {
            display: inline-block;
            float: none;
            vertical-align: bottom;
            margin-left: 5px;
            margin-right: 5px;
            max-width: calc(100% - (2 * 5px));

            &.fr-fvl {
                float: left;
                margin: 5px 5px 5px 0;
                max-width: calc(100% - 5px);
            }

            &.fr-fvr {
                float: right;
                margin: 5px 0 5px 5px;
                max-width: calc(100% - 5px);
            }
        }
    }

    .fr-font-large {
        font-size: 1.2rem;
    }

    .fr-box-notice {
        padding: 8px;
        color: #bf360c;
        background: #ffe0b2;
        font-size: 1rem;
        border: 1px solid #ffb74d;
    }
}

div.atwho-container {
    .atwho-view {
        position: absolute;
        top: 0;
        left: 0;
        display: none;
        margin-top: 18px;
        background: #fff;
        color: #000;
        border: 1px solid #ddd;
        border-radius: 3px;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
        min-width: 120px;
        z-index: 1111000 !important;
    }
    .atwho-view .atwho-header {
        padding: 5px;
        margin: 5px;
        cursor: pointer;
        border-bottom: solid 1px #eaeff1;
        color: #6f8092;
        font-size: 11px;
        font-weight: 700;
    }
    .atwho-view .atwho-header .small {
        color: #6f8092;
        float: right;
        padding-top: 2px;
        margin-right: -5px;
        font-size: 12px;
        font-weight: 400;
    }
    .atwho-view .atwho-header:hover {
        cursor: default;
    }
    .atwho-view .cur {
        background: #36f;
        color: #fff;
    }
    .atwho-view .cur small {
        color: #fff;
    }
    .atwho-view strong {
        color: #36f;
    }
    .atwho-view .cur strong {
        color: #fff;
        font-weight: 700;
    }
    .atwho-view ul {
        list-style: none;
        padding: 0;
        margin: auto;
        max-height: 200px;
        overflow-y: auto;
    }
    .atwho-view ul li {
        display: block;
        padding: 5px 10px;
        border-bottom: 1px solid #ddd;
        cursor: pointer;
        height: 32px;
        line-height: 22px;
    }
    .atwho-view ul li i {
        display: inline-block;
        width: 22px;
        height: 22px;
        vertical-align: top;
        border-radius: 50%;
        background-size: cover;
        background-position: 50% 50%;
        background-repeat: no-repeat;
        border: 1px solid #ccc;
        box-sizing: border-box;
        margin-right: 6px;
        float: left;
    }
    .atwho-view ul li:after {
        content: ' ';
        clear: both;
        display: block;
    }
    .atwho-view small {
        font-size: smaller;
        color: #777;
        font-weight: 400;
    }
    .atwho-inserted {
        font-weight: bold;
        color: #36f;
    }
}
