/**
 * 이 파일은 아이모듈의 일부입니다. (https://www.imodules.io)
 *
 * 예외페이지 스타일시트를 정의한다.
 * 
 * @file /app/resources/styles/Exceptions.css
 * @author Arzz <arzz@arzz.com>
 * @license MIT License
 * @modified 2025. 7. 27.
 */
body {
    /**
     * 디버그 모드일때
     */
    &:has(main[data-type='error'][data-mode='debug']) {
        width: 100%;
        height: 100%;
        padding: 0px;
        margin: 0px;
        overflow: auto;

        > main[data-type='error'] {
            min-height: 100%;

            > section {
                max-width: 1000px;
                box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.1);
            }
        }
    }

    /**
     * 예외메시지 블럭
     */
    main[data-type='error'] {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        width: 100%;
        height: fit-content;
        padding: 50px 15px;
        box-sizing: border-box;

        > section {
            width: 100%;
            max-width: 500px;
            border: 1px solid var(--im-color-background-200);
            background: var(--im-color-background-500);
            flex-grow: 0;
            flex-shrink: 0;

            &[data-debug] {
                max-width: 1000px;
            }

            &[data-role='message'] {
                padding: 24px;

                > h4 {
                    font-size: 20px;
                    margin-bottom: 24px;
                    padding-bottom: 16px;
                    color: var(--im-color-foreground-500);
                    border-bottom: 1px solid var(--im-color-background-200);
                    font-weight: bold;
                }

                > b {
                    display: block;
                    color: var(--im-color-error-text-500);
                    font-size: 16px;
                    line-height: 1.4;
                }

                > small {
                    display: block;
                    margin-top: 16px;
                    color: var(--im-color-error-text-300);
                    font-size: 14px;
                    word-break: break-all;
                    line-height: 1.4;
                }
            }

            &[data-role='debug'] {
                margin-top: 24px;

                > aside {
                    display: flex;
                    width: 100%;
                    height: 48px;
                    background: var(--im-color-error-accent-500);
                    align-items: center;
                    justify-content: center;

                    > button {
                        display: block;
                        height: 40px;
                        line-height: 40px;
                        color: var(--im-color-error-accent-backward-500);
                        cursor: pointer;
                        padding: 0 16px;
                        border: 0;
                        background: transparent;
                        border-radius: 3px;
                        font-size: 14px;

                        &.selected {
                            background: var(--im-color-error-accent-600);
                            color: var(--im-color-error-accent-backward-600);
                        }
                    }
                }

                > article {
                    > div {
                        &:not(.selected) {
                            display: none !important;
                        }

                        &[data-tab='trace'] {
                            display: flex;
                            align-items: stretch;

                            > aside {
                                width: 300px;
                                flex-shrink: 0;
                                z-index: 1;
                                background: var(--im-color-background-500);
                                border-right: 1px solid var(--im-color-background-200);

                                > button {
                                    display: block;
                                    width: 100%;
                                    background: transparent;
                                    border: 0;
                                    padding: 14px 14px 14px 54px;
                                    text-align: left;
                                    cursor: pointer;
                                    position: relative;
                                    border-bottom: 1px solid var(--im-color-background-300);

                                    &::after {
                                        content: ' ';
                                        position: absolute;
                                        top: 0;
                                        left: 40px;
                                        width: 2px;
                                        height: 100%;
                                        background: var(--im-color-background-300);
                                    }

                                    > label {
                                        display: block;
                                        font-size: 14px;
                                        color: var(--im-color-error-text-400);
                                        line-height: 1.4;
                                        word-break: break-all;
                                        margin-bottom: 10px;
                                    }

                                    > p {
                                        display: flex;
                                        align-items: flex-end;
                                        position: relative;

                                        > b {
                                            flex-grow: 1;
                                            font-size: 14px;
                                            line-height: 20px;
                                            color: var(--im-color-error-text-300);
                                            word-break: break-all;

                                            > small {
                                                font-size: 12px;
                                                display: block;
                                            }
                                        }

                                        > small {
                                            flex-basis: auto;
                                            background: var(--im-color-background-200);
                                            color: var(--im-color-foreground-400);
                                            height: 20px;
                                            line-height: 20px;
                                            padding: 0px 4px;
                                            border-radius: 3px;
                                            font-size: 12px;
                                        }

                                        > i {
                                            position: absolute;
                                            top: 0;
                                            left: -54px;
                                            width: 40px;
                                            height: 20px;
                                            line-height: 20px;
                                            font-style: normal;
                                            color: var(--im-color-error-text-300);
                                            font-weight: bold;
                                            font-size: 12px;
                                            text-align: center;
                                        }
                                    }

                                    &.selected {
                                        background: var(--im-color-error-background-200);

                                        &::after {
                                            background: var(--im-color-error-background-400);
                                        }
                                    }
                                }
                            }

                            > div {
                                flex-grow: 1;

                                > div[data-index] {
                                    &:not(.selected) {
                                        display: none;
                                    }

                                    > ul {
                                        list-style: none;
                                        width: 100%;

                                        > li {
                                            width: 100%;
                                            display: flex;
                                            align-items: stretch;

                                            > small {
                                                flex-basis: 50px;
                                                font-size: 12px;
                                                background: var(--im-color-background-400);
                                                border-right: 1px solid var(--im-color-background-200);
                                                line-height: 20px;
                                                flex-shrink: 0;
                                                text-align: right;
                                                padding-right: 8px;
                                                font-family: 'Nanum Gothic Coding', monospace;
                                                color: var(--im-color-foreground-300);
                                            }

                                            > pre {
                                                line-height: 20px;
                                                word-break: break-all;
                                                width: 100%;
                                                white-space: pre-wrap;
                                                padding: 0px 8px;
                                                font-family: 'Nanum Gothic Coding', monospace;
                                                font-size: 14px;
                                            }

                                            &.file {
                                                display: block;
                                                box-sizing: border-box;
                                                background: var(--im-color-background-300);
                                                padding: 10px 20px;
                                                border-bottom: 1px solid var(--im-color-background-200);

                                                > label {
                                                    display: block;
                                                    font-size: 14px;
                                                    color: var(--im-color-error-text-300);
                                                    line-height: 1.4;
                                                    word-break: break-all;
                                                    margin-bottom: 10px;
                                                    word-break: break-all;
                                                }

                                                > b {
                                                    display: block;
                                                    font-weight: normal;
                                                    color: var(--im-color-error-text-400);
                                                    font-size: 16px;
                                                    word-break: break-all;
                                                }
                                            }

                                            &.focus {
                                                > small {
                                                    background: var(--im-color-error-background-300);
                                                }

                                                > pre {
                                                    background: var(--im-color-error-background-200);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                &[data-tab='trace'] {
                    > aside {
                        > button[data-tab='trace'] {
                            background: var(--im-color-error-accent-600);
                            color: var(--im-color-error-accent-backward-600);
                        }
                    }
                }
            }
        }
    }
}
