/**
 * 通知条幅样式
 * 
 * @package Leahz
 * @since 1.0.0
 */

/* 通知条幅容器 */
#notification-banners-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    pointer-events: none;
}

/* 单个通知条幅 */
.notification-banner {
    display: block;
    width: 100%;
    height: 24px;
    background-color: #000000;
    color: #ffffff;
    text-decoration: none;
    border: none;
    outline: none;
    cursor: pointer;
    pointer-events: auto;
    transition: opacity 0.3s ease;
    overflow: hidden;
    position: relative;
}

/* 条幅内容容器 */
.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 16px;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

/* 条幅文字 */
.banner-text {
    font-family: inherit;
    font-size: 11px;
    font-weight: 800;
    line-height: 24px;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    display: inline-block;
    animation: none;
    position: relative;
    flex: 1;
    min-width: 0;
}

/* 文字滚动动画 - 当文字超出容器宽度时 */
.banner-text.scroll {
    animation: banner-scroll 15s linear infinite;
    animation-delay: 2s;
    /* 确保文字在关闭按钮左侧滚动 */
    margin-right: 24px;
}

/* 滚动动画关键帧 */
@keyframes banner-scroll {
    0% {
        transform: translateX(0);
    }
    10% {
        transform: translateX(0);
    }
    90% {
        transform: translateX(calc(-1 * var(--text-width, 0px) + var(--container-width, 0px)));
    }
    100% {
        transform: translateX(calc(-1 * var(--text-width, 0px) + var(--container-width, 0px)));
    }
}

/* 悬停效果 */
.notification-banner:hover {
    opacity: 0.9;
}

/* 链接样式重置 */
.notification-banner:visited {
    color: inherit;
}

.notification-banner:active {
    opacity: 0.8;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .banner-content {
        padding: 0 12px;
    }
    
    .banner-text {
        font-size: 11px;
    }
    
    /* 移动端滚动动画调整 */
    @keyframes banner-scroll {
        0% {
            transform: translateX(0);
        }
        10% {
            transform: translateX(0);
        }
        90% {
            transform: translateX(calc(-1 * var(--text-width, 0px) + var(--container-width, 0px)));
        }
        100% {
            transform: translateX(calc(-1 * var(--text-width, 0px) + var(--container-width, 0px)));
        }
    }
}

/* 确保条幅在页面内容之上 */
body {
    margin-bottom: 0;
}

/* 当有通知条幅时，为页面内容添加底部间距 */
body.has-notification-banners {
    padding-bottom: 24px;
}

/* 通知条幅与其他浮动元素的协调 */
/* 确保页脚在通知条幅之上 */


/* 移动端商品页浮动按钮调整 */
body.has-notification-banners .mobile-product-actions {
    bottom: 24px !important;
}

/* 购物车页面浮动结算行调整 */
body.has-notification-banners .cart-mobile-checkout {
    bottom: 24px !important;
}

/* 桌面端购物车浮动结算区域调整 */
body.has-notification-banners .cart-floating-checkout {
    bottom: 24px !important;
}

/* 其他可能的浮动元素调整 */
body.has-notification-banners [class*="floating"],
body.has-notification-banners [class*="fixed-bottom"] {
    bottom: 24px !important;
}

/* 心愿单预览切换器调整 */
body.has-notification-banners .yith-wcwl-react-preview-toggle__wrapper {
    bottom: 24px !important;
}

/* 侧边栏购物车调整 */
body.has-notification-banners .sidebar-cart {
    height: calc(100% - 30px - 24px) !important;
}

/* 多个条幅时的动态调整 */
body.has-notification-banners.has-multiple-banners .mobile-product-actions,
body.has-notification-banners.has-multiple-banners .cart-mobile-checkout,
body.has-notification-banners.has-multiple-banners .cart-floating-checkout,
body.has-notification-banners.has-multiple-banners [class*="floating"],
body.has-notification-banners.has-multiple-banners [class*="fixed-bottom"],
body.has-notification-banners.has-multiple-banners .yith-wcwl-react-preview-toggle__wrapper {
    bottom: 48px !important;
}

body.has-notification-banners.has-multiple-banners .sidebar-cart {
    height: calc(100% - 30px - 48px) !important;
}

body.has-notification-banners.has-multiple-banners {
    padding-bottom: 48px;
}


/* 三个条幅时的调整 */
body.has-notification-banners.has-three-banners .mobile-product-actions,
body.has-notification-banners.has-three-banners .cart-mobile-checkout,
body.has-notification-banners.has-three-banners .cart-floating-checkout,
body.has-notification-banners.has-three-banners [class*="floating"],
body.has-notification-banners.has-three-banners [class*="fixed-bottom"],
body.has-notification-banners.has-three-banners .yith-wcwl-react-preview-toggle__wrapper {
    bottom: 72px !important;
}

body.has-notification-banners.has-three-banners .sidebar-cart {
    height: calc(100% - 30px - 72px) !important;
}

body.has-notification-banners.has-three-banners {
    padding-bottom: 72px;
}



/* 四个条幅时的调整 */
body.has-notification-banners.has-four-banners .mobile-product-actions,
body.has-notification-banners.has-four-banners .cart-mobile-checkout,
body.has-notification-banners.has-four-banners .cart-floating-checkout,
body.has-notification-banners.has-four-banners [class*="floating"],
body.has-notification-banners.has-four-banners [class*="fixed-bottom"],
body.has-notification-banners.has-four-banners .yith-wcwl-react-preview-toggle__wrapper {
    bottom: 96px !important;
}

body.has-notification-banners.has-four-banners .sidebar-cart {
    height: calc(100% - 30px - 96px) !important;
}

body.has-notification-banners.has-four-banners {
    padding-bottom: 96px;
}



/* 多个条幅堆叠时的间距 */
.notification-banner + .notification-banner {
    margin-top: 0;
}

/* 确保条幅在所有其他元素之上 */
.notification-banner {
    z-index: 9999;
}

/* 禁用文本选择，避免影响滚动效果 */
.notification-banner {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 确保条幅在移动端浏览器地址栏之上 */
@supports (-webkit-touch-callout: none) {
    #notification-banners-container {
        position: fixed;
        bottom: env(safe-area-inset-bottom, 0);
    }
}

/* 关闭按钮样式 */
.banner-close {
    background: transparent;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: 11px;
    font-weight: 800;
    line-height: 24px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
    outline: none;
    box-shadow: none;
}

.banner-close:hover {
    opacity: 0.7;
}

.banner-close:active {
    opacity: 0.5;
}

/* 移动端关闭按钮调整 */
@media (max-width: 768px) {
    .banner-close {
        font-size: 11px;
        width: 24px;
        height: 24px;
    }
} 