/**
 * 이 파일은 아이모듈 위지윅에디터모듈의 일부입니다. (https://www.imodules.io)
 *
 * 위지윅에디터모듈 스타일시트를 정의한다.
 *
 * @file /modules/wysiwyg/resources/styles/Wysiwyg.css
 * @author sungjin <esung246@naddle.net>
 * @license MIT License
 * @modified 2026. 2. 13.
 */
:root {
    --wysiwyg-border-color: #8c8c8c;
    --wysiwyg-accent-primary: #0a84ff;
    --wysiwyg-danger-primary: #dc3535;
    --wysiwyg-table-header: rgba(0, 0, 0, 0.05);
    --wysiwyg-table-alternate: rgba(0, 0, 0, 0.45);

    --editor-color-1: #61bd6d;
    --editor-color-2: #41a85f;
    --editor-color-3: #1abc9c;
    --editor-color-4: #00a885;
    --editor-color-5: #54acd2;
    --editor-color-6: #3d8eb9;
    --editor-color-7: #2c82c9;
    --editor-color-8: #2969b0;
    --editor-color-9: #9365b8;
    --editor-color-10: #8b5cf6;
    --editor-color-11: #553982;
    --editor-color-12: #475577;
    --editor-color-13: #28324e;
    --editor-color-14: #000000;
    --editor-color-15: #7c706b;
    --editor-color-16: #a38f84;
    --editor-color-17: #cccccc;
    --editor-color-18: #d1d5d8;
    --editor-color-19: #efefef;
    --editor-color-20: #ffffff;
    --editor-color-21: #f7da64;
    --editor-color-22: #fac51c;
    --editor-color-23: #fba026;
    --editor-color-24: #f37934;
    --editor-color-25: #eb6b56;
    --editor-color-26: #e25041;
    --editor-color-27: #d14841;
    --editor-color-28: #b8312f;
    --editor-color-29: #ff6b9d;

    &[data-color-scheme='dark'],
    &[data-color-scheme='auto'][data-prefers-color-scheme='dark'] {
        --wysiwyg-border-color: #737373;
        --wysiwyg-accent-primary: #0a84ff;
        --wysiwyg-danger-primary: #ff453a;
        --wysiwyg-table-header: rgba(255, 255, 255, 0.05);
        --wysiwyg-table-alternate: rgba(255, 255, 255, 0.48);

        --editor-color-1: #3fae63;
        --editor-color-2: #2f8f52;
        --editor-color-3: #169b87;
        --editor-color-4: #00806a;
        --editor-color-5: #3f8fb3;
        --editor-color-6: #2f7396;
        --editor-color-7: #1f5fa3;
        --editor-color-8: #1c4f87;
        --editor-color-9: #7c5a96;
        --editor-color-10: #6f4fd1;
        --editor-color-11: #432c6b;
        --editor-color-12: #b6bcc9;
        --editor-color-13: #d1d5e0;
        --editor-color-14: #ffffff;
        --editor-color-15: #9e918c;
        --editor-color-16: #7a6f6a;
        --editor-color-17: #444444;
        --editor-color-18: #2f3336;
        --editor-color-19: #1a1a1a;
        --editor-color-20: #000000;
        --editor-color-21: #c9b24a;
        --editor-color-22: #d1a914;
        --editor-color-23: #c98228;
        --editor-color-24: #b5622d;
        --editor-color-25: #b55a4b;
        --editor-color-26: #a6453a;
        --editor-color-27: #913533;
        --editor-color-28: #702321;
        --editor-color-29: #c4557d;
    }
}

div[data-role='wysiwyg-content'],
body.fr-view {
    font-size: 16px;
    font-family: SUIT;
    font-size: 0.875rem;
    box-sizing: border-box;
    color: var(--editor-color-12);

    * {
        box-sizing: border-box;
    }

    p {
        margin: 0;
        padding-block: 0.25rem;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p {
        padding-block: 0.25rem;
    }

    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(--editor-color-12);
            }

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

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

        th,
        td {
            &.fr-highlighted {
                border: 1px double var(--wysiwyg-danger-primary);
            }

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

        &.fr-alternate-rows {
            tbody {
                tr:nth-child(2n) {
                    background: var(--wysiwyg-table-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(--wysiwyg-accent-primary);
        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;
            display: inline-block;
            vertical-align: middle;
            background-position: 50% 50%;
            background-repeat: no-repeat;
            background-size: contain;

            &[data-type='image'] {
                background-image: url(./assets/images/file_type_image.png);
            }

            &[data-type='audio'] {
                background-image: url(./assets/images/file_type_audio.png);
            }

            &[data-type='video'] {
                background-image: url(./assets/images/file_type_video.png);
            }

            &[data-type='archive'] {
                background-image: url(./assets/images/file_type_archive.png);
            }

            &[data-type='document'] {
                background-image: url(./assets/images/file_type_document.png);
            }

            &[data-type='text'] {
                background-image: url(./assets/images/file_type_document.png);
            }

            &[data-extension='ppt'],
            &[data-extension='pptx'] {
                background-image: url(./assets/images/file_extension_ppt.png);
            }

            &[data-extension='doc'],
            &[data-extension='docx'] {
                background-image: url(./assets/images/file_extension_doc.png);
            }

            &[data-extension='xls'],
            &[data-extension='xlsx'] {
                background-image: url(./assets/images/file_extension_xls.png);
            }

            &[data-extension='hwp'],
            &[data-extension='hwpx'] {
                background-image: url(./assets/images/file_extension_hwp.png);
            }

            &[data-extension='pdf'] {
                background-image: url(./assets/images/file_extension_pdf.png);
            }
        }

        > span {
            font-weight: bold;
            color: var(--wysiwyg-accent-primary);
            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(--editor-color-17);

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

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

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

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

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

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

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

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

            &::before {
                width: 11px;
                height: 11px;
                background: var(--editor-color-14);
                border: 1px solid var(--wysiwyg-border-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(--wysiwyg-border-color);
            position: relative;
            overflow: visible;

            &::before {
                width: 11px;
                height: 11px;
                background: var(--editor-color-14);
                border: 1px solid var(--wysiwyg-border-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 {
            display: block;
            margin: 10px auto;
            float: none;

            &.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;
    }

    &[contenteditable='false'] {
        cursor: not-allowed;
    }

    .atwho-inserted {
        font-weight: bold;
        color: #36f;
    }
}

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 {
        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;
    }
}
