* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

:root {
    --mole-box-width: 0%;
    --sidebar-bg: #fcfcfc;
}

@font-face {
    font-family: 'PingFangSC-Regular';
    src: url('../apps/mole-3d/css/pingfang-regular.ttf') format('truetype');
}

ul,
li {
    list-style: none;
}

body {
    height: 100vh;
    max-height: 100vh;
    max-width: 100vw;
    font-family: Arial, sans-serif;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.name-modal-overlay {
    .name-modal-container {
        position: relative;
        width: 600px;
        padding: 20px;
        border-radius: 8px;
        background: #fff;
        overflow: hidden;
        .name-modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            .name-modal-cancel {
                cursor: pointer;
            }
        }
        .name-modal-input {
            margin-top: 20px;
            input {
                width: 100%;
                padding: 12px;
                border: 1px solid #ddd;
                border-radius: 4px;
                box-sizing: border-box;
                font-size: 14px;
            }
        }
        .name-modal-footer {
            .name-modal-save {
                margin-top: 20px;
                width: 100%;
                padding: 12px;
                background: #4ECDB9;
                color: white;
                border: none;
                border-radius: 4px;
                cursor: pointer;
                &:hover {
                    background: #3db9a5;
                    transform: scale(1);
                }
            }
        }
    }
}

.login-modal-overlay {
    .login-modal-container {
        position: relative;
        display: flex;
        width: 800px;
        padding: 20px 0;
        border-radius: 8px;
        background: #fff;
        overflow: hidden;
        .logo-section {
            flex: 2;
            background: url('/images/bg.png') no-repeat center/auto 100%;
        }
        .login-modal-cancel {
            position: absolute;
            top: 20px;
            right: 20px;
            color: #4ECDB9;
            cursor: pointer;
        }
        .login-section {
            flex: 3;
            padding: 40px;
            .login-tabs {
                display: flex;
                margin-bottom: 30px;
                border-bottom: 1px solid #eee;
                .login-tab {
                    padding: 10px 20px;
                    cursor: pointer;
                    color: #666;
                }
            
                .login-tab.active {
                    color: #4ECDB9;
                    border-bottom: 2px solid #4ECDB9;
                }
            }
            .form-container {
                display: none;
            }
            
            .form-container.active {
                display: block;
            }
            .input-group {
                margin-bottom: 20px;
                input {
                    width: 100%;
                    padding: 12px;
                    border: 1px solid #ddd;
                    border-radius: 4px;
                    box-sizing: border-box;
                    font-size: 14px;
                }
            }
        
            .agreement {
                display: flex;
                align-items: center;
                justify-content: flex-start;
                gap: 8px;
                margin: 20px 0;
                color: rgba(0,0,0,0.34);
            }
        
            .login-btn,
            .register-btn {
                width: 100%;
                padding: 12px;
                background: #4ECDB9;
                color: white;
                border: none;
                border-radius: 4px;
                cursor: pointer;
                font-size: 16px;
            }
        
            .login-btn:hover,
            .register-btn:hover {
                background: #3db9a5;
                transform: scale(1);
            }
        
            .footer-links {
                margin-top: 20px;
                text-align: center;
            }
        
            .footer-links a {
                color: #666;
                font-size: 14px;
                text-decoration: none;
            }
        }
    
    }
}
.mobile-header{
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    height: 50px;
    background-color: #F5FEFF;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);
    img{
        height: 30px;
        cursor: pointer;
    }
}

/* 分子编辑器 */
.app-container {
    position: relative;
    height: 100vh;
    width: 100vw;
    max-width: none;
    display: flex;

    /* 侧边栏 */
    .sidebar {
        position: relative;
        width: var(--mole-box-width);
        height: 100%;
        display: flex;
        flex-direction: column;
        transition: all 0.5s ease-in-out;
        border-right: 1px solid #ccc;
        background: var(--sidebar-bg);
        overflow: hidden;
        /* box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5); */
        .user-info {
            padding: 0 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            height: 40px;
            box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);
            gap: 10px;
            cursor: pointer;
            .user-name{
                margin-right: auto;
            }
        }

        /* 搜索框容器 */
        .search-container {
            padding: 0 16px;
            margin: 16px 0;

            /* 搜索框样式 */
            .search-input {
                width: 100%;
                height: 36px;
                padding: 0 16px;
                border: 1px solid #ccc;
                border-radius: 10px;
                font-size: 14px;
                transition: all 0.3s ease;

                &:focus {
                    outline: none;
                    border-color: #27C6D9;
                    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
                }
            }
        }

        .sidebar-content {
            padding: 20px;
            width: 100%;
            flex: 1;
            overflow-y: auto;
            &::-webkit-scrollbar {
                width: 5px;
            }
            
            &::-webkit-scrollbar-track {
                background: #f1f1f1;
                border-radius: 3px;
            }
            
            &::-webkit-scrollbar-thumb {
                background: #02ABB9;
                border-radius: 3px;
            }
            
            &::-webkit-scrollbar-thumb:hover {
                background: #555;
            } 
            .mole-list-container {
                margin-bottom: 20px;
            }

            .mole-header {
                display: flex;
                align-items: center;
                gap: 10px;
                padding: 10px 0;
                cursor: pointer;

                .collapse-icon {
                    transition: transform 0.3s ease;
                    transform: rotate(-90deg);
                }

                &.collapsed {
                    .collapse-icon {
                        transform: rotate(0deg);
                    }
                }

                .mole-title {
                    font-weight: 600;
                }
                .mole-title-right{
                    margin-left: auto;
                    cursor: pointer;
                    color: #f44336;
                    font-size: 12px;
                }
            }

            .mole-list {
                max-height: 0;
                overflow: hidden;
                transition: max-height 0.3s ease-out;
                .mole-item {
                    padding: 10px 15px;
                    color: black;
                    display: flex;
                    gap: 10px;
                    align-items: center;
                    cursor: pointer;
                    &.active{
                        background-color: #DDFCFF;
                    }
                    .mole-icon-wrapper{
                        width: 40px;
                        height: 40px;
                        border-radius: 50%;
                        border: 1px solid #02ABB9;
                        transition: all 0.3s ease-in-out;
                        &:hover{
                            transform: scale(1.5);
                        }
                    }
                    .mole-icon {
                        width: 100%;
                        height: 100%;
                    }
                    .mole-info{
                        display: flex;
                        flex-direction: column;
                        gap: 5px;
                        flex: 1;
                        font-size: 14px;
                        width: 100%;
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        .mole-name {
                            font-weight: 600;
                            white-space: nowrap;
                            overflow: hidden;
                            text-overflow: ellipsis;
                        }
                        .mole-smiles{
                            white-space: nowrap;
                            overflow: hidden;
                            text-overflow: ellipsis;
                        }
                    }
                    .delete-icon{
                        width: 20px;
                        height: 20px;
                    }
                }
                .empty-list{
                    font-weight: 600;
                    line-height: 100px;
                    text-align: center;
                    color: #02ABB9;
                }
            }

            .mole-header.collapsed+.mole-list {
                max-height: 100%;
                /* overflow-y: auto; */
                /* 或者根据需要调整 */
            }
        }

        .logo-container {
            display: flex;
            justify-content: center;
            height: 55px;
            padding-bottom: 20px;
            img {
                height: 100%;
                display: block;
            }
        }
    }

    /* 分子编辑器 */
    .mole-editor-container {
        flex: 1;
        height: 100%;
        transition: all 0.5s ease-in-out;
        position: relative;
        perspective: 1000px;

        /* 添加3D视角 */
        .view-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
            transition: transform 0.6s;
            transform-style: preserve-3d;
        }

        #mole-editor,
        #mole-3d {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            /* 隐藏背面 */
        }

        #mole-3d {
            transform: rotateY(180deg);
            /* 3D视图默认在背面 */
        }

        /* 翻转状态类 */
        .view-wrapper.flipped {
            transform: rotateY(180deg);
        }
    }

    /* 分子属性侧边栏 */
    #mole-feature-box {
        display: flex;
        flex-direction: column;
        background: var(--sidebar-bg);
        width: var(--mole-box-width);
        height: 100%;
        transition: all 0.5s ease-in-out;
        overflow: hidden;
        border-left: 1px solid #ccc;
        #mole-property-header {
            padding: 0 10px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            height: 40px;
            box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);

            #mole-property-logo {
                height: 80%;
            }

            #header-title {
                font-family: 'PingFangSC-Regular', sans-serif;
                color: #02ABB9;
            }

            #mole-property-cancel {
                visibility: hidden;
                width: 25px;
                height: 25px;
                cursor: pointer;
            }
        }

        #properties-container {
            margin-top: 10px;
            min-height: 50%;
            max-height: 60%;
            /* 预留顶部和底部空间 */
            overflow: hidden;

            /* 防止整体溢出 */
            .tab-container {
                width: 100px;
                background-color: #fafafa;
                padding-right: 8px;

                .tab {
                    height: 40px;
                    margin: 2px 0;
                    padding: 8px 16px;
                    border-bottom: 1px solid #d9d9d9;
                    background-color: #ffffff;
                    font-size: 14px;
                    text-align: center;
                    transition: all 0.3s;
                    cursor: pointer;
                }

                .tab:hover {
                    color: #02ABB9;
                    font-size: 16px;
                }

                .tab.active {
                    color: #02ABB9;
                    font-size: 16px;
                    border-right: 1px solid #02ABB9;
                }
            }

            #molecule-properties {
                box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
                flex: 1;
                background-color: #ffffff;
                overflow-y: auto;
                /* scrollbar-width: thin;
                scrollbar-color: rgba(0, 0, 0, 0.2) transparent; */
                &::-webkit-scrollbar {
                    width: 5px;
                }
                
                &::-webkit-scrollbar-track {
                    background: #f1f1f1;
                    border-radius: 3px;
                }
                
                &::-webkit-scrollbar-thumb {
                    background: #02ABB9;
                    border-radius: 3px;
                }
                
                .smiles-container {
                    padding: 10px;
                    margin-bottom: 15px;
                    background-color: #f5f5f5;
                    border-radius: 4px;

                    .smiles-text {
                        word-break: break-all;
                        flex: 1;
                        line-height: 1.4;
                    }
                }

                .property-table {
                    border-collapse: collapse;
                    font-size: 14px;

                    th,
                    td {
                        padding: 10px 6px;
                        border-bottom: 1px solid #eaeaea;
                        word-break: break-word;
                    }

                    th {
                        font-weight: 600;
                        color: #333;
                        background-color: #f8f9fa;
                        border-top: 1px solid #eaeaea;
                    }

                    tr:nth-child(even) {
                        background-color: #ffffff;
                    }

                    tr:nth-child(odd) {
                        background-color: #fafafa;
                    }

                    tr:hover {
                        background-color: #f5f5f5;
                    }
                }

            }
        }

        .pages-container {
            margin-top: 10px;
            overflow: hidden;
            flex: 1;
            display: flex;
            flex-direction: column;
            .papers-title {
                color: #02ABB9;
                box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);
                line-height: 40px;
                text-align: center;
            }

            #molecule-papers {
                padding: 20px;
                overflow-y: auto;
                flex: 1;
                line-height: 2;
                li{
                    list-style: inside dotted;
                    p{display: inline; margin-left: 5px;}
                }
                &::-webkit-scrollbar {
                    width: 5px;
                }
        
                &::-webkit-scrollbar-track {
                    background: #f1f1f1;
                    border-radius: 3px;
                }
        
                &::-webkit-scrollbar-thumb {
                    background: #02ABB9;
                    border-radius: 3px;
                }
                .no-papers {
                    line-height: 100px;
                    text-align: center;
                    color: #02ABB9;
                }
            }
        }
        /* tab栏的滚动条样式 */
        .tab-container::-webkit-scrollbar {
            width: 4px;
        }

        .tab-container::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 2px;
        }

        .tab-container::-webkit-scrollbar-thumb {
            background: #02ABB9;
            border-radius: 2px;
        }

    }
}

#btn-3d {
    /* position: absolute; */
    top: 50%;
    /* transform: translateY(-50%); */
    right: 5px;
    width: 40px;
    height: 40px;
    z-index: 2001;
    background-color: #028e99;
    transition: all 0.5s ease-in-out;

    &.transparent {
        background-color: transparent;
    }

    &.icon-3d {
        background-image: url("../images/3d.png");
        background-size: cover;
    }

    &:hover {
        background-color: transparent;
    }

    &:hover.icon-3d {
        background-image: url("../images/3d-color.png");
    }

    &:hover.active {
        background-image: url("../images/cancel.svg");
    }

    &.active {
        border-color: #028e99;
        background-color: transparent;
        background-image: url("../images/cancel.svg");
    }
}

@media only screen and (max-width: 996px) {
    #mole-3d {
        width: 100%;
        height: 100%;
    }
}

/* 立场转换loading加载动画 */
#loading-overlay,
#loading-overlay-2 {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.disabled {
    pointer-events: none;
    /* 禁用所有鼠标事件 */
    opacity: 0.5;
    /* 可选：降低透明度以表示禁用状态 */
}

.loading_overlay_active {
    display: flex !important;
}

.loading_overlay_active_3d {
    display: flex !important;
    z-index: 9999 !important;
}

.loading_text {
    color: #02ABB9;
    font-size: 24px;
    margin-bottom: 20px;
    user-select: none;
}

.loading_text_span {
    display: inline-block;
    animation: wave 2s infinite;
    animation-delay: calc(0.1s * var(--i));
}

@keyframes wave {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.progress_bar {
    width: 300px;
    height: 20px;
    background-color: #f0f8ff;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress_bar_inner {
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to right, #10D7EB, #02ABB9, #01D5B3, #e3f9e5, #57D3E6);
    background-size: 200% 100%;
    animation: scrollBar 2s linear infinite;
}

@keyframes scrollBar {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}
/* 3D 分子按钮 */
.button {
    z-index: 1000;
    width: 40px;
    height: 40px;
    background-color: #028e99;
    background-size: 100% 100%;
    color: white;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    bottom: 50px;

    &:hover {
        background-color: white;
        border-color: #028e99;

        svg {
            fill: #028e99;
        }
    }

    svg {
        width: 20px;
        height: 20px;
        fill: white;
        transition: all 0.3s ease;

        &.rotated {
            transform: rotateY(180deg);
        }
    }

    &.button-3d {
        right: 50px;
        -webkit-tap-highlight-color: transparent;
    }

    &.icon-3d {
        background-image: url("../images/3d.png");

        &:hover {
            background-image: url("../images/3d-color.png");
        }
    }
}

/* 以下为分子属性预测的响应式设计*/
@media only screen and (min-width: 769px) {
    :root {
        --mole-box-width: 22%;
        /* 大屏宽度为21.5% */
    }
}

@media only screen and (max-width: 768px) {
    :root {
        --mole-box-width: 0%;
        /* 小屏展开占屏幕一半 */
    }
    .mobile-header{
        display: flex;
    }
    .app-container{
        width: 100%;
        height: calc(100vh - 50px);
        overflow: hidden;
    }
    .sidebar{
        position: absolute!important;
        z-index: 9999!important;
    }
    #mole-feature-box {
        /* 改为固定定位，覆盖整个屏幕 */
        position: absolute;
        top: 0;
        right: 0;
        /* 移除圆角 */
        border-radius: 0;
        #mole-property-cancel{
            visibility: visible!important;
        }
    }
}

/* 以上为分子属性预测的响应式设计 */

@keyframes rotate-left {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(-180deg);
    }
}

@keyframes rotate-right {
    0% {
        transform: rotateY(-180deg);
    }

    100% {
        transform: rotateY(0deg);
    }

}

.rotated-left {
    animation: rotate-left 0.5s forwards;
}

.rotated-right {
    animation: rotate-right 0.5s forwards;
}


/* .message {
    padding: 8px 15px;
    border-bottom: 1px solid #eee;
    color: #333;
    cursor: pointer;
}

.message:hover {
    background-color: #DDFCFF;
}

.message:last-child {
    border-bottom: none;
} */