@use 'sass:math';

:root {
    // 设计稿宽度
    --design-width: #{$vmDesignWidth}px;
    --design-multiple: #{$vmDesignMultiple};

    // 兼容最大宽度
    --max-window: #{$vmMaxWindow};

    // 兼容最小宽度
    --min-window: #{$vmMinWindow};
    --main-bg: #fff;
    --card-bg: #222;
    --action-bg: #fff;
    --main-yellow: #EA002A;
    --lable: #454745;
    --main-yellow-dark: rgb(15 120 71);
    --white: #000;
    --gray: #aaa;
    --border: #868685;
    --black: #fff;
    --black1: #343434;
    --font-size-10: 10px;
    --font-size-12: 12px;
    --font-size-13: 13px;
    --font-size-14: 14px;
    --font-size-15: 15px;
    --font-size-16: 16px;
    --font-size-18: 18px;
    --font-size-20: 20px;
    --font-size-22: 22px;
    --font-size-24: 24px;
    --font-size-26: 26px;
    --font-size-28: 28px;
    --font-size-32: 32px;
    --font-size-36: 36px;
    --font-size-40: 40px;
}

.dark {
    --main-bg: #181a1b;
    --card-bg: #222;
    --action-bg: #232323;
    --main-yellow: rgb(6 255 139);
    --main-yellow-dark: rgb(15 120 71);
    --white: #fff;
    --lable: #aaa;
    --gray: #aaa;
    --border: #333;
    --black: #000;
    --font-size-10: 10px;
    --font-size-12: 12px;
    --font-size-13: 13px;
    --font-size-14: 14px;
    --font-size-15: 15px;
    --font-size-16: 16px;
    --font-size-18: 18px;
    --font-size-20: 20px;
    --font-size-22: 22px;
    --font-size-24: 24px;
    --font-size-26: 26px;
    --font-size-28: 28px;
    --font-size-32: 32px;
    --font-size-36: 36px;
    --font-size-40: 40px;
}

html {
    --body-width: #{$vmDesignWidth}px;
    --tabbar-height: 80px;

    font-size: math.div($vmFontSize, $vmDesignWidth) * 100vw;

    // 同时，通过Media Queries 限制根元素最大最小值

    @media screen and (max-width: $vmMinWindow) {
        font-size: math.div($vmFontSize, $vmDesignWidth) * $vmMinWindow;
    }

    @media screen and (min-width: $vmMaxWindow) {
        --body-width: $vmMaxWindow;

        font-size: math.div($vmFontSize, $vmDesignWidth) * $vmMaxWindow;
    }
}

// body 也增加最大最小宽度限制，避免默认100%宽度的 block 元素跟随 body 而过大过小
body {
    max-width: var(--max-window);
    min-width: var(--min-window);
    min-height: 100vh;
    margin: 0 auto !important;
    font-size: 12px;
    line-height: 1;
    color: #000;
    background: #f4f4f4;
}

.fixed-center {
    left: calc((100% - var(--body-width)) / 2) !important;
    width: 100%;
    max-width: var(--max-window);
    min-width: var(--min-window);
}

.body {
    position: absolute;
    width: 100%;

    // height: 100vh;
    // padding-bottom: var(--tabbar-height);
    height: 100vh;
    max-width: var(--max-window);
    min-width: var(--min-window);
    overflow-y: scroll;
    box-sizing: border-box;
    transition: all 0.4s;
    -webkit-overflow-scrolling: touch;

    &.is-tab {
        height: calc(100vh - var(--tabbar-height));
    }
}

.wrap {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.global-loading {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background: var(--main-bg);
}

.router-loading {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background: var(--main-bg);
}

.full-screen-loading {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
    width: 100vw;
    height: 100vh;
    background: var(--main-bg);
    display: flex;
    justify-content: center;
    align-items: center;
}

.request-loading,
.full-screen-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: fadeIn 0.2s ease-in-out;

    .van-loading {
        margin-bottom: 8px;
    }

    .loading-text {
        color: #fff;
        font-size: 14px;
        font-weight: 500;
        letter-spacing: 0.5px;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

    &::after {
        content: '';
        position: absolute;
        top: -1px;
        left: -1px;
        right: -1px;
        bottom: -1px;
        border-radius: 12px;
        background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
        z-index: -1;
    }
}

.full-screen-loading {
    width: 100vw;
    height: 100vh;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.load-more {
    margin: 10px 0;
}

/* 通用样式 */

.slide-left-enter,
.slide-right-leave-active {
    opacity: 0;
    transform: translate(100%, 0);
}

.slide-left-leave-active,
.slide-right-enter {
    opacity: 0;
    transform: translate(-100%, 0);
}

/* .fade-leave-active below version 2.1.8 */
.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.5s;
}

.fade-enter,
.fade-leave-to {
    opacity: 0;
}

/* start--文本行数限制--start */
.u-line-1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.u-line-2 {
    -webkit-line-clamp: 2;
}

.u-line-3 {
    -webkit-line-clamp: 3;
}

.u-line-4 {
    -webkit-line-clamp: 4;
}

.u-line-5 {
    -webkit-line-clamp: 5;
}

.u-line-2,
.u-line-3,
.u-line-4,
.u-line-5 {
    display: box; // 弹性伸缩盒
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
    -webkit-box-orient: vertical; // 设置伸缩盒子元素排列方式
}

/* end--文本行数限制--end */

/* start--Retina 屏幕下的 1px 边框--start */
.u-border,
.u-border-bottom,
.u-border-left,
.u-border-right,
.u-border-top,
.u-border-top-bottom {
    position: relative;
}

.u-border-bottom::after,
.u-border-left::after,
.u-border-right::after,
.u-border-top-bottom::after,
.u-border-top::after,
.u-border::after {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;

    // 多加0.1%，能解决有时候边框缺失的问题
    width: 199.8%;
    height: 199.7%;
    pointer-events: none;
    border: 0 solid #e4e7ed;
    content: ' ';
    transform: scale(0.5, 0.5);
    box-sizing: border-box;
    transform-origin: 0 0;
}

.u-border-top::after {
    border-top-width: 1PX;
}

.u-border-left::after {
    border-left-width: 1PX;
}

.u-border-right::after {
    border-right-width: 1PX;
}

.u-border-bottom::after {
    border-bottom-width: 1PX;
}

.u-border-top-bottom::after {
    border-width: 1PX 0;
}

.u-border::after {
    border-width: 1PX;
}

/* end--Retina 屏幕下的 1px 边框--end */



.cwg-button {
    width: 100%;

    .van-button {
        height: 44px;
        border-radius: 24px;
        background: var(--main-yellow);
        border: none;
        color: var(--black);
        font-size: var(--font-size-16);
        font-weight: bold;

        &:active {
            opacity: 0.9;
        }
    }
}

.fixed-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px 16px;
    color: var(--black);
    background-color: var(--black);
    box-shadow: 0px -1px 4px rgba(134, 134, 133, 0.25);
    // z-index: 9999;
}

.cwg-upload {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    width: 100%;
    height: 160px;
    border: 1px dashed #beb6b6;
    border-radius: 24px;

    .name {
        line-height: 44px;
        font-weight: 600;
        font-size: 16px;
        display: flex;
        align-items: center;
        text-align: center;
        color: #1a1a1a;
    }

    .back {
        font-size: 16px;
        line-height: 24px;
        display: flex;
        align-items: center;
        text-align: center;
        letter-spacing: 0.005em;
        color: #474747;
    }
}

// .status-success {
//     color: #4CAF50 !important;
// }

// .status-warning {
//     color: #faad14 !important;
// }

// .status-error {
//     color: #D32F2F !important;
// }

// .status-default {
//     color: #1a1a1a !important;
// }

.g {
    display: flex;

    img {
        height: 50px;
    }

    .g-l {
        margin-left: 16px;
        flex: 1;

        .g-item {
            display: flex;
            justify-content: space-between;
            margin-bottom: 16px;
        }

        .label {
            font-family: 'Roboto';
            font-style: normal;
            font-weight: 600;
            font-size: 14px;
            line-height: 20px;
            text-align: left;
            color: #1a1a1a;
        }

        .v {
            font-family: 'Roboto';
            font-style: normal;
            font-weight: 600;
            font-size: 14px;
            line-height: 20px;
            text-align: center;
            color: #1a1a1a;
        }
    }
}

.fixed-right {
    width: 40px;
    height: 40px;
    position: fixed;
    top: 4px;
    right: 10px;
    cursor: pointer;
    color: var(--main-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;

    i {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        font-size: 14px;
        color: var(--main-yellow);
    }

    &:hover {
        opacity: 0.8;
    }
}

.status-default {
    display: flex;
    padding: 4px 8px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-radius: 9999px;
    border: 0px solid #F4F4F4;
    background: rgba(0, 157, 235, 0.20);
    color: #009DEB;
    font-family: Roboto;
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: 0.06px;
}

.status-success {
    background: rgba(76, 175, 80, 0.20);
    color: #4CAF50;
}

.status-error {
    background: rgba(211, 47, 47, 0.21);
    color: #D32F2F;
}

.status-views {
    display: flex;
    width: 65.063px;
    // height: 36px;
    padding: 8px 16px;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    background: #EA002A;
    color: #FFF;
    text-align: center;
    font-family: Roboto;
    font-size: 14px;
    font-style: normal;
    font-weight: 600;
    line-height: 20px;
    letter-spacing: 0.07px;
}

.ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.custom-toast{
    background: #fff;
display: flex;
width: 348px;
padding: 32px 24px;
flex-direction: column;
align-items: center;
gap: 16px;
border-radius: 20px;
background: #FFF;
top: 40%;
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);

    .van-icon__image{
        width: 88px;
        height: 88px;
    }
    .van-toast__text {
        color: #474747;
        text-align: center;
        font-family: Roboto;
        font-size: 14px;
        font-style: normal;
        font-weight: 400;
        line-height: 20px;
        letter-spacing: 0.07px;
    }
}
