/**
 * 顶部通知栏样式
 * 
 * 需求：3.2, 3.3, 3.4, 3.6, 3.8, 7.1, 8.1, 8.2, 8.3, 8.5, 8.6, 8.7
 */

/* 通知栏容器 */
.notification-bar {
    position: fixed;
    top: 0;
    /* 固定在页面最顶部 */
    left: 0;
    right: 0;
    height: 45px;
    background: linear-gradient(90deg, #FF4D4F 0%, #FF7875 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 居中对齐 */
    padding: 0 60px 0 20px;
    /* 右侧留出关闭按钮空间 */
    z-index: 99999;
    /* 超高层级，确保在所有元素之上 */
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 内容区域 */
.notification-bar__content {
    display: flex;
    align-items: center;
    justify-content: center;
    /* 内容居中 */
    gap: 15px;
    font-size: 14px;
    max-width: 1200px;
    /* 限制最大宽度 */
    text-align: center;
    /* 文字居中 */
}

/* 活动标题 */
.notification-bar__title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 倒计时 */
.notification-bar__countdown {
    font-size: 13px;
    opacity: 0.9;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 关闭按钮 */
.notification-bar__close {
    position: absolute;
    /* 绝对定位到右侧 */
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
    background: transparent;
    border: none;
    color: #FFFFFF;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    z-index: 1;
    /* 确保在内容之上 */
}

.notification-bar__close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.notification-bar__close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* 滑入动画 */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

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

/* 
 * 页面内容偏移 - 强制所有可能的容器往下移
 * 使用多重选择器确保生效
 * 
 * 默认不预留空间，当通知栏出现时平滑过渡
 */
body {
    padding-top: 0 !important;
    margin-top: 0 !important;
    transition: padding-top 0.3s ease-out;
}

/* 当有通知栏时，预留空间，平滑过渡 */
body.has-notification-bar {
    padding-top: 45px !important;
}

/* 当通知栏被关闭或不显示时，移除预留空间 */
body.no-notification-bar {
    padding-top: 0 !important;
}

/* 修复固定定位的导航栏 - 默认不预留空间 */
body .navbar,
body .navbar-fixed-top,
body header.fixed,
body .fixed-header,
body>nav,
body>header {
    top: 0 !important;
    transition: top 0.3s ease-out;
}

/* 当有通知栏时，导航栏预留空间，平滑过渡 */
body.has-notification-bar .navbar,
body.has-notification-bar .navbar-fixed-top,
body.has-notification-bar header.fixed,
body.has-notification-bar .fixed-header,
body.has-notification-bar>nav,
body.has-notification-bar>header {
    top: 45px !important;
}

/* 当通知栏被关闭或不显示时，恢复导航栏位置 */
body.no-notification-bar .navbar,
body.no-notification-bar .navbar-fixed-top,
body.no-notification-bar header.fixed,
body.no-notification-bar .fixed-header,
body.no-notification-bar>nav,
body.no-notification-bar>header {
    top: 0 !important;
}

/* 导航栏本身的 transition 补充 */
.navbar,
.navbar-fixed-top,
header.fixed,
.fixed-header {
    transition: top 0.3s ease-out, margin-top 0.3s ease-out;
}


/* 响应式设计 - 移动设备 */
@media (max-width: 768px) {
    .notification-bar {
        height: 40px;
        padding: 0 50px 0 15px;
    }

    .notification-bar__content {
        gap: 10px;
        font-size: 13px;
    }

    .notification-bar__title {
        font-size: 13px;
    }

    .notification-bar__countdown {
        font-size: 12px;
    }

    .notification-bar__close {
        right: 15px;
        width: 20px;
        height: 20px;
        font-size: 18px;
    }

    /* 页面内容偏移 - 移动版，默认不预留空间，平滑过渡 */
    body {
        padding-top: 0 !important;
        transition: padding-top 0.3s ease-out;
    }

    body .navbar,
    body .navbar-fixed-top,
    body header.fixed,
    body .fixed-header,
    body>nav,
    body>header {
        top: 0 !important;
        transition: top 0.3s ease-out;
    }

    /* 当有通知栏时，预留空间，平滑过渡 */
    body.has-notification-bar {
        padding-top: 40px !important;
    }

    body.has-notification-bar .navbar,
    body.has-notification-bar .navbar-fixed-top,
    body.has-notification-bar header.fixed,
    body.has-notification-bar .fixed-header,
    body.has-notification-bar>nav,
    body.has-notification-bar>header {
        top: 40px !important;
    }

    /* 当通知栏被关闭或不显示时，移除预留空间 */
    body.no-notification-bar {
        padding-top: 0 !important;
    }

    body.no-notification-bar .navbar,
    body.no-notification-bar .navbar-fixed-bar .navbar-fixed-top,
    body.no-notification-bar header.fixed,
    body.no-notification-bar .fixed-header,
    body.no-notification-bar>nav,
    body.no-notification-bar>header {
        top: 0 !important;
    }

}

/* 小屏幕设备优化 */
@media (max-width: 480px) {
    .notification-bar__content {
        gap: 8px;
    }

    .notification-bar__title {
        font-size: 12px;
    }

    .notification-bar__countdown {
        font-size: 11px;
    }
}

/**
 * 弹窗样式文件 - 高级美化版
 * 
 * 职责：定义弹窗的视觉样式、高级动画和响应式体验
 * 风格：现代、简约、高级感（Glassmorphism & Soft Shadows）
 */

/* ========== 字体引用已移至 HTML 以优化性能 ========== */

:root {
    --popup-primary: #ee2225;
    /* 标准国旗红 */
    --popup-secondary: #ffde00;
    /* 五角星金色 */
    --popup-accent: #ff0000;
    --popup-gradient: linear-gradient(135deg, #ee1c25 0%, #de2910 100%);
    --popup-bg: #ffffff;
    --popup-text-main: #2b0000;
    --popup-text-muted: #5e0000;
    --popup-radius: 28px;
    --popup-shadow: 0 30px 70px -12px rgba(238, 28, 37, 0.35);
}

/* ========== 遮罩层 (已改为全透明) ========== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    /* 去掉遮罩颜色 */
    backdrop-filter: none;
    /* 去掉模糊 */
    -webkit-backdrop-filter: none;
    z-index: 9998;
    display: none;
    opacity: 1;
    /* 保持可见逻辑，但内容是透明的 */
    pointer-events: none;
    /* 允许点击穿透到背景页面 (可选) */
}

/* ========== 弹窗容器 ========== */
.popup-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%) scale(0.9);
    background: var(--popup-bg);
    border-radius: var(--popup-radius);
    box-shadow: var(--popup-shadow);
    max-width: 680px;
    /* 从800px缩小到680px */
    width: 90%;
    max-height: 85vh;
    overflow: visible;
    /* 关键：允许关闭按钮显示在外面 */
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.popup-container.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ========== 关闭按钮 (悬浮在右侧外部) ========== */
.popup-close {
    position: absolute;
    top: 0;
    right: -60px;
    /* 移动到右侧外部 */
    width: 40px;
    height: 40px;
    font-size: 20px;
    line-height: 40px;
    text-align: center;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    /* 深色半透明背景，确保在任何背景下都清晰 */
    backdrop-filter: blur(8px);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 装饰性连接线 */
.popup-close::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 40px;
    /* 连接到弹窗 */
    width: 20px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%);
}

.popup-close:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateX(3px);
    /* 向右移动 */
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* ========== 弹窗内容 ========== */
.popup-content {
    padding: 36px 30px;
    /* 从50px缩小到40px */
    position: relative;
    display: flex;
    flex-direction: column;
    /* 主轴：竖向 */
}

/* 顶部区域：徽章和标题 */
.popup-header {
    text-align: center;
    margin-bottom: 30px;
    /* 从35px缩小到30px */
}

/* 中间区域：图片和文字横向布局 */
.popup-body {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
    /* 从50px缩小到40px */
}

/* 左侧图片区域 */
.popup-image {
    flex: 0 0 320px;
    /* 从320px缩小到260px */
}

/* 右侧文字区域 */
.popup-text-content {
    flex: 1;
    /* 占据剩余空间 */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* 文字内容靠左，避免图片放大后文字拥挤 */
    text-align: left;
    min-width: 0;
}

/* 装饰性光晕背景 - 喜庆橙色光晕 */
.popup-content::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.15) 0%, transparent 70%);
    z-index: -1;
}

.popup-content::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -10%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(230, 57, 70, 0.1) 0%, transparent 70%);
    z-index: -1;
}

/* 哇塞图标容器 */
.popup-wow-icon {
    margin-bottom: 10px;
    filter: drop-shadow(0 5px 15px rgba(255, 222, 0, 0.4));
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {

    0%,
    100% {
        transform: translateY(0) rotate(-2deg);
    }

    50% {
        transform: translateY(-10px) rotate(2deg);
    }
}

/* 徽章 (Badge) - 喜庆版 */
.popup-badge {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(to right, #fee2e2, #ffedd5);
    color: #b91c1c;
    font-size: 13px;
    font-weight: 800;
    border-radius: 30px;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 1px solid rgba(230, 57, 70, 0.2);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.1);
    animation: pulseBadge 2s infinite;
    align-self: flex-start;
    /* 左对齐 */
}

@keyframes pulseBadge {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* 倒计时样式 */
.popup-countdown {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 25px;
}

.countdown-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 45px;
    padding: 6px 4px;
    background: rgba(238, 34, 37, 0.05);
    border: 1px solid rgba(238, 34, 37, 0.1);
    border-radius: 10px;
}

.countdown-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--popup-primary);
    line-height: 1.2;
}

.countdown-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--popup-text-muted);
    text-transform: uppercase;
}

/* 标题 - 节日红渐变 */
.popup-title {
    margin: 0 0 20px 0;
    font-size: 28px;
    /* 从32px缩小到28px */
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -1px;
    background: linear-gradient(to bottom, #991b1b, #dc2626);
    -webkit-background-clip: text;
    background-clip: text;
    /* 修复 lint 警告 */
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

/* 图片 - 金色边框（PC端横屏优化） */
.popup-image {
    width: 320px;
    /* 从320px缩小到260px */
    margin: 0;
    /* 移除自动居中 */
    border-radius: 24px;
    position: relative;
    padding: 12px;
    background: #ffffff;
    box-shadow: 0 20px 40px -10px rgba(230, 57, 70, 0.2);
}

.popup-image::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 2px;
    background: linear-gradient(135deg, #f59e0b, #e63946, #7c2d12);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    opacity: 0.4;
}

.popup-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

/* 内容文本 */
.popup-text {
    margin: 0 0 20px 0;
    /* 从30px缩小到25px */
    font-size: 14px;
    /* 从15px缩小到14px */
    line-height: 1.7;
    color: var(--popup-text-muted);
    font-weight: 400;
}

/* 强调第一行文案 */
.popup-highlight {
    display: block;
    color: var(--popup-text-main);
    font-weight: 700;
    font-size: 15px;
    /* 从16px缩小到15px */
    margin-bottom: 8px;
}

/* 操作按钮 */
.popup-button {
    position: relative;
    overflow: hidden;
    display: inline-block;
    /* PC端：不占满宽度 */
    padding: 16px 50px;
    text-align: center;
    /* 按钮内文字始终居中，避免受父级 text-align: left 影响 */
    /* 从18px 60px缩小到16px 50px */
    background: var(--popup-gradient);
    color: #ffffff;
    font-size: 16px;
    /* 从17px缩小到16px */
    font-weight: 700;
    text-decoration: none;
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 12px 28px -8px rgba(238, 34, 37, 0.5);
}

.popup-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px -5px rgba(59, 130, 246, 0.6);
}

/* 按钮扫光特效 */
.popup-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 50%;
    height: 200%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: rotate(35deg);
    transition: none;
}

.popup-button:hover::after {
    left: 150%;
    transition: all 0.8s ease;
}

/* ========== 响应式设计 ========== */

/* 针对高度或宽度较窄的屏幕 (极致缩小版) */
@media (max-width: 480px) or (max-height: 700px) {
    .popup-container {
        width: 85%;
        max-width: 320px;
        max-height: 90vh;
        border-radius: 20px;
    }

    /* 既然空间有限，关闭按钮必须缩回容器内，否则 100% 会显示不全 */
    .popup-close {
        top: 12px;
        right: 12px;
        bottom: auto;
        left: auto;
        margin: 0;
        width: 32px;
        height: 32px;
        background: rgba(0, 0, 0, 0.6);
        color: #ffffff;
        border: 2px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        backdrop-filter: blur(4px);
    }

    .popup-close svg {
        width: 16px;
        height: 16px;
    }

    .popup-close::after {
        display: none;
        /* 隐藏装饰线 */
    }

    /* 小屏幕：竖屏布局 */
    .popup-content {
        padding: 30px 20px 25px 20px;
    }

    .popup-header {
        margin-bottom: 15px;
    }

    .popup-body {
        flex-direction: column;
        gap: 15px;
        align-items: center;
        /* 小屏下整体内容居中，图片居中 */
    }

    .popup-badge {
        font-size: 11px;
        padding: 3px 10px;
        margin-bottom: 12px;
    }

    .popup-title {
        font-size: 18px;
        margin-bottom: 0;
    }

    .popup-image {
        flex: none;
        width: 100%;
        max-width: 180px;
        padding: 6px;
        margin-left: auto;
        margin-right: auto;
        /* 确保图片容器水平居中 */
    }

    .popup-text-content {
        align-items: stretch;
        text-align: left;
        width: 100%;
        /* 小屏下文字左对齐，列表更易读不显乱 */
    }

    .popup-text {
        font-size: 13px;
        margin-bottom: 20px;
        line-height: 1.6;
    }

    .popup-highlight {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .popup-button {
        display: block;
        width: 100%;
        padding: 12px 0;
        font-size: 14px;
        border-radius: 10px;
    }

    .popup-countdown {
        justify-content: flex-start;
    }
}

/* 针对宽度小于 360px 的超窄屏幕 */
@media (max-width: 360px) {
    .popup-container {
        width: 90%;
    }

    .popup-content {
        padding: 25px 15px 20px 15px;
    }

    .popup-title {
        font-size: 16px;
    }
}

/* 窄屏PC (768px - 1024px) - 缩小横屏布局 */
@media (max-width: 1024px) and (min-width: 768px) {
    .popup-container {
        max-width: 580px;
        /* 窄屏PC缩小尺寸 */
    }

    .popup-content {
        padding: 30px 24px;
    }

    .popup-body {
        gap: 20px;
    }

    .popup-image {
        flex: 0 0 260px;
        /* 图片缩小 */
    }

    .popup-title {
        font-size: 24px;
    }

    .popup-text {
        font-size: 13px;
    }

    .popup-button {
        padding: 14px 40px;
        font-size: 15px;
    }
}

/* 针对高度较窄的屏幕 (防止按钮溢出) */
@media (max-height: 600px) {
    .popup-close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.6);
        color: #ffffff;
        border: 2px solid rgba(255, 255, 255, 0.3);
    }

    .popup-close::after {
        display: none;
    }
}

/* 手机设备 - 竖屏布局 */
@media (max-width: 767px) {
    .popup-container {
        width: 85%;
        /* 从88%缩小到85% */
        max-width: 340px;
        /* 从360px缩小到340px */
        border-radius: 24px;
        /* 移动端稍微往上提一点，避开可能的底部操作栏 */
        transform: translate(-50%, -55%) scale(0.9);
    }

    /* 移动端：恢复竖屏布局 */
    .popup-content {
        padding: 28px 18px;
        /* 从30px 20px缩小到28px 18px */
    }

    .popup-header {
        text-align: center;
        margin-bottom: 18px;
        /* 从20px缩小到18px */
    }

    /* 移动端：竖向排列，内容居中使图片居中 */
    .popup-body {
        flex-direction: column;
        gap: 18px;
        align-items: center;
    }

    /* 移动端：图片在上方并水平居中 */
    .popup-image {
        flex: none;
        width: 100%;
        max-width: 200px;
        margin-left: auto;
        margin-right: auto;
    }

    /* 移动端：文字内容在下方，左对齐更易读 */
    .popup-text-content {
        align-items: stretch;
        text-align: left;
        width: 100%;
    }

    .popup-title {
        font-size: 20px;
        /* 从22px缩小到20px */
    }

    .popup-text {
        font-size: 13px;
        /* 从默认14px缩小到13px */
    }

    /* 移动端：按钮占满宽度 */
    .popup-button {
        display: block;
        width: 100%;
        padding: 13px 0;
        /* 从14px缩小到13px */
        font-size: 15px;
        /* 从16px缩小到15px */
    }

    /* 移动端：倒计时与正文一致左对齐 */
    .popup-countdown {
        justify-content: flex-start;
    }

    /* 移动端将关闭按钮放在底部中心，更方便点击且不会溢出顶部 */
    .popup-close {
        top: auto;
        bottom: -60px;
        right: auto;
        left: 50%;
        margin-left: -20px;
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.6);
        border: 2px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .popup-close::after {
        top: -20px;
        bottom: auto;
        width: 2px;
        height: 20px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ========== 华丽的细节装饰 ========== */

/* 进场小动画 */
.popup-content>* {
    opacity: 0;
    transform: translateY(20px);
}

.popup-container.show .popup-content>* {
    animation: fadeInUp 0.5s ease forwards;
}

.popup-container.show .popup-content>*:nth-child(1) {
    animation-delay: 0.1s;
}

.popup-container.show .popup-content>*:nth-child(2) {
    animation-delay: 0.2s;
}

.popup-container.show .popup-content>*:nth-child(3) {
    animation-delay: 0.3s;
}

.popup-container.show .popup-content>*:nth-child(4) {
    animation-delay: 0.4s;
}

.popup-container.show .popup-content>*:nth-child(5) {
    animation-delay: 0.5s;
}

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

/* ========== 导航栏布局辅助 ========== */

/* 统一降低导航栏高度（网页端） */
.navbar .nav-content {
    padding: 0.5rem 0 !important;
}

/* 桌面端：logo / nav-links / nav-user 三栏对齐 */
.navbar .logo {
    min-width: 160px !important;
}

.navbar .nav-links {
    flex: 1 !important;
    justify-content: center !important;
    display: flex !important;
}

.navbar .nav-user {
    min-width: 160px !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
}

/* 移动端：菜单默认收起，通过 .open 展开 */
@media (max-width: 768px) {
    .navbar .logo {
        min-width: auto !important;
    }

    .navbar .nav-links {
        display: none !important;
        flex-direction: column !important;
        width: 100% !important;
        flex: none !important;
    }

    .navbar .nav-links.open {
        display: flex !important;
    }

    /* 登录/免费注册与 logo、汉堡同排，不另起一行 */
    .navbar .nav-user {
        min-width: auto !important;
        width: auto !important;
    }
}
