/* ==========================================================================
   1. 基础变量与全局设置
   ========================================================================== */

:root {
    --btn-active: #e74c3c;
    --element-bg: #4a90e2;
    --element-height: 40px;
    --element-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --element-radius: 8px;
}

body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

input[type="file"] {
    display: none;
    user-select: none;
}

/* ==========================================================================
   2. 通用文本样式
   ========================================================================== */

.normal-white-text {
    font-size: 14px;
    color: white;
}

.normal-black-text {
    font-size: 14px;
    color: black;
}

.title-white-text {
    font-size: 28px;
    color: white;
    font-weight: bold;
}

.title-black-text {
    font-size: 28px;
    color: black;
    font-weight: bold;
}

.clickable-text {
    cursor: pointer;
}

/* ==========================================================================
   3. 通用网页组件
   ========================================================================== */

/* 通用按钮 */
.generator-btn {
    height: var(--element-height);
    width: max-content;
    min-width: fit-content;
    flex-shrink: 0;
    background-color: var(--element-bg);
    background-size: cover;
    background-position: center;
    border: none;
    border-radius: var(--element-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, opacity 0.2s, background 0.1s;
    box-sizing: border-box;
    padding: 0 20px;
}
.generator-btn:hover {
    opacity: 0.8;
}
.generator-btn:active {
    transform: scale(0.92);
}
.generator-btn.active {
    background-color: var(--btn-active);
}

/* 通用输入框 */
.generator-input {
    background: rgba(255, 255, 255, 0.1);
    height: 35px;
    padding: 0 10px;
    border-radius: var(--element-radius);
    font-size: 14px;
    color: black;
    border: 1px solid black;
    outline: none;
    width: 100%;
}
.generator-input:focus {
    border-color: var(--element-bg);
}

/* 通用纵向区域 */
.generator-column-wrapper {
    width: 100%;
    display: flex;
    gap: 10px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 通用横向区域 */
.generator-row-wrapper {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   通用弹窗
   ========================================================================== */

/* 遮罩层 */
.generator-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 20000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    display: none;
    gap: 0;
    flex-direction: column;
    animation-duration: 0.3s;
    animation-fill-mode: forwards;
}
.generator-mask.active {
    display: flex;
    animation-name: maskFadeIn;
}
.generator-mask.closing {
    display: flex;
    animation-name: maskFadeOut;
}

@keyframes maskFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes maskFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* 弹窗上部分 */
.generator-upper-modal {
    background: transparent;
    display: flex;
    flex-direction: row;
    gap: 20px;
}
.generator-upper-modal * {
    background: #ffffff;
    box-shadow: var(--element-shadow);
    border-radius: 8px 8px 0 0;
    padding: 0 20px;
}

/* 弹窗下部分 */
.generator-lower-modal {
    background: #ffffff;
    padding: 40px 30px;
    border-radius: var(--element-radius);
    box-shadow: var(--element-shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.generator-upper-modal,
.generator-lower-modal {
    width: max-content;
    height: max-content;
    position: relative;
    animation-duration: 0.3s;
    animation-fill-mode: forwards;
    animation-timing-function: ease-out;
}

/* 当父级 active 时，执行淡入 */
.generator-mask.active .generator-upper-modal,
.generator-mask.active .generator-lower-modal {
    animation-name: modalFadeIn;
}

/* 当父级 closing 时，执行淡出 */
.generator-mask.closing .generator-upper-modal,
.generator-mask.closing .generator-lower-modal {
    animation-name: modalFadeOut;
}

/* 弹窗淡入动画 */
@keyframes modalFadeIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes modalFadeOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(10px);
        opacity: 0;
    }
}

/* 弹窗关闭按钮 */
.close-modal-btn {
    font-size: 28px;
    color: var(--element-bg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
.close-modal-btn:hover {
    color: #4a90e2cc
}

/* 弹窗通用确定按钮 */
.model-confirm-btn {
    width: 100%;
}

/* ==========================================================================
   用户登录注册弹窗
   ========================================================================== */

#register-view {
    display: none;
}

#register-text {
    display: none;
}

#reset-text {
    display: none;
}

.sms-code {
    width: 80px;
}

#to-reset {
    width: 45%;
}

/* ==========================================================================
   工程列表（包含预览）
   ========================================================================== */

/* 工程展示父容器 */
.project-main-wrapper {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 20px;
}

/* 工程列表父容器 */
.project-content {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    width: fit-content;
}

/* 搜索 */
.project-input .generator-input {
    flex: 1;
    width: 0;
}

/* 项目节点容器 */
.project-item-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 0;
    width: 204px;
    position: relative;
}
.project-item-node,
.project-item-node * {
    box-sizing: border-box;
}

/* 顶部底部注释框 */
.project-node-top,
.preview-node-bottom {
    width: 100%;
    height: 36px;
    background-color: #fff;
    border: 2px solid #000;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
/* 隐藏 Webkit 内核滚动条 */
.project-node-top::-webkit-scrollbar,
.preview-node-bottom::-webkit-scrollbar {
    display: none;
}
/* 内部文字样式 */
.project-node-top p,
.preview-node-bottom p {
    margin: 0;
    padding: 0 10px;
    white-space: nowrap;
    min-width: 100%;
    width: max-content;
    line-height: 32px;
    text-align: center;
    flex-shrink: 0;
}
.project-node-top {
    border-radius: 8px 8px 0 0;
}
.preview-node-bottom {
    border-top: none; /* 移除顶部边框，防止与图片框底部重复 */
}

/* 中间图片包装器 */
.project-node-image-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    background-color: #fff;
    border: 2px solid #000;
    border-top: none; /* 移除顶部边框，防止与标题框底部重复 */
    display: flex;
    justify-content: center;
}
.project-node-image-wrapper img {
    width: 200px;
    height: 112px;
    object-fit: cover;
    display: block;
    transition: filter 0.2s;
    cursor: pointer;
}
.project-node-image-wrapper img:hover {
    filter: brightness(80%);
}

/* 缩略图遮罩 */
.thumbnail-mask {
    display: flex;
    position: absolute;
    gap: 10px;
}

/* 缩略图按钮 */
.thumbnail-btn {
    height: 30px;
    font-size: 12px;
}

/* ==========================================================================
   基础变量与全局设置
   ========================================================================== */

:root {
    --ui-bg: rgba(45, 45, 45, 0.95);
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #f0f0f0;
    user-select: none;
}

/* ==========================================================================
   通用组件
   ========================================================================== */

/* 通用ui */
.generator-ui {
    position: fixed;
    display: flex;
    width: max-content;
    height: max-content;
    flex-shrink: 0;
    background-color: var(--ui-bg);
    border-radius: var(--element-radius);
    box-shadow: var(--element-shadow);
    z-index: 10000;
    box-sizing: border-box;
    flex-shrink: 0;
    padding: 20px;
    align-items: center;
}

/* 主要ui */
.main-ui {
    gap: 20px;
}

/* 右侧ui */
.right-ui {
    right: 20px;
    transform: translateY(-50%);
    display: none;
}

/* 次要ui */
.sub-ui {
    gap: 10px;
    flex-direction: column;
}

/* 次要ui标题 */
.sub-ui-header {
    text-align: center;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
}

/* ==========================================================================
   主画布
   ========================================================================== */

#container {
    width: 100vw;
    height: 100vh;
    background: #fff;
}

/* ==========================================================================
   顶部ui
   ========================================================================== */

#top-ui-layer {
    top: 0px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 8px 8px;
}

.top-btn {
    width: 40px;
    background-color: transparent;
}

#upload-btn {
    background-image: url(/images/upload.1194b8ef.png);
}

#preview-btn {
    background-image: url(/images/repository.28ae139d.png);
}

/* ==========================================================================
   底部ui
   ========================================================================== */

#bottom-ui-layer {
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 8px 8px 0 0;
}

/* ==========================================================================
   登录后面板
   ========================================================================== */

#user-panel {
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}

/* ==========================================================================
   文字注释框选择面板
   ========================================================================== */

#text-frame-menu {
    top: 100px;
}

#text-frame-menu #type-chooser {
    display: flex;
    gap: 10px;
    flex-direction: column;
    align-content: flex-start !important;
    flex-wrap: wrap;
}

#text-frame-menu label {
    display: flex;
    align-items: center;
    gap: 5px;
}

#text-frame-menu input {
    cursor: pointer;
}

/* ==========================================================================
   样式编辑面板
   ========================================================================== */

.toolbar-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.toolbar-column input {
    cursor: pointer;
}

.toolbar-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}

.toolbar-row input {
    cursor: pointer;
}

.toolbar-btn {
    width: 70px;
}

/* ==========================================================================
   箭头样式编辑面板
   ========================================================================== */

#arrow-style-panel {
    top: 120px;
}

/* ==========================================================================
   文字样式编辑面板
   ========================================================================== */

#rich-text-panel {
    top: 100px;
}

/* ==========================================================================
   文字框样式编辑面板
   ========================================================================== */

#rect-style-panel {
    top: 90px;
}

/* ==========================================================================
   Lexical悬浮编辑器
   ========================================================================== */

#lexical-floating-container {
    position: fixed;
    display: none;
    z-index: 9999;
    pointer-events: auto;
    background: transparent;
    max-width: 800px;
    height: auto;
    transform-origin: center;
    will-change: transform, top, left;
}

#lexical-editor-container {
    outline: none;
    background: transparent;
    color: black;
    padding: 0 !important;
    box-sizing: border-box;
    font-family: 'Consolas', 'SimHei', sans-serif;
    white-space: pre-wrap;
    word-break: break-all;
    text-align: center;
}

#lexical-editor-container span {
    vertical-align: baseline !important;
}

.editor-paragraph {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: baseline !important;
    justify-content: center;
    line-height: 1 !important;
}

.editor-text-bold {
    font-weight: bold;
}

.editor-text-italic {
    font-style: italic;
}

.editor-text-underline {
    text-decoration: underline;
}

/* ==========================================================================
   工程加载
   ========================================================================== */

#loading-content {
    gap: 20px
}

#loading-content p {
    color: #333;
    font-weight: 500;
    margin: 0;
}

#spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   预览工程弹窗
   ========================================================================== */

#preview-modal {
    max-width: 635px;
    min-width: 240px;
}

/* ==========================================================================
   底部标签
   ========================================================================== */

#web-tag {
    height: 20px;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 8px 8px 0 0;
    box-shadow: unset;
}

