/* index.html的主要样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--outer-bg-color) !important;
    color: var(--text-color);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* 容器样式 */
.container {
    overflow-y: hidden !important;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 516px;
    margin: 0 auto;
}

/* 顶部导航栏 - 使用common-components.css中的.header样式 */
/* 仅保留特定于首页的header相关样式 */

/* 重要：强制设置header宽度 */
.header {
    width: 100%;
    max-width: 516px;
    margin: 0 auto;
}

/* 添加header-left样式 */
.header-left {
    display: flex;
    align-items: center;
    min-width: 100px;
    margin-left: -10px; /* 靠近container左侧10px */
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease !important;
}

.menu-btn.active {
    transform: rotate(180deg) !important;
}

.menu-btn-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.menu-btn i {
    font-size: 20px;
}

.logo {
    height: 50px; /* 从原来的40px增加到50px */
    display: block;
    margin: 0 auto;
    width: auto;
    max-width: 140px; /* 从原来的120px增加到140px */
    object-fit: contain;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: 5px;
}

.star-rating {
    display: flex;
    margin-top: 3px;
    justify-content: center;
}

.star-rating .star {
    color: var(--secondary-color);
    font-size: 12px;
    margin: 0 1px;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 150px;
}

.balance-display {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 3px 10px 3px 3px;
    margin-right: 5px;
    /* border: 1px solid #8B0000; */
    min-width: 80px;
    height: 30px;
}

/* 添加国旗样式 */
.currency-flag {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.balance-amount {
    color: var(--text-color);
    font-weight: bold;
    font-size: 14px;
    margin-right: 5px;
    margin-left: 5px;
}

/* 下拉菜单样式 */
.dropdown {
    position: relative;
    display: inline-block;
    margin-left: auto;
    margin-right: 5px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--secondary-color);
    min-width: 100%;
    width: auto;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
    right: 0;
    top: 100%;
    margin-top: 2px;
    white-space: nowrap;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background-color: var(--secondry-color);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px; /* 确保宽高相等 */
    position: relative;
}

.search-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px; /* 稍小于按钮本身 */
    height: 28px; /* 保持宽高相等 */
    background-color: rgba(255, 255, 255, 0.1); /* 透明白色背景 */
    border-radius: 50%; /* 圆形背景 */
    z-index: 0;
}

.search-btn i {
    color: var(--text-color);
    font-size: 18px;
    position: relative;
    z-index: 1; /* 确保图标在背景上方 */
}

.btn-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Banner轮播 */
.banner-slider {
    position: relative;
    height: 120px;
    overflow: hidden;
    border-radius: 10px;
    margin: 10px;
}

.banner-slide {
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-size: 24px;
    font-weight: bold;
    background-size: cover;
    background-position: center;
}

.banner-slide.active {
    display: flex;
}

/* 奖池显示 */
.jackpot-container {
    text-align: center;
    padding: 0;
    margin: 10px auto;
    background-image: url('/assets/img/frontend/common/jackpot-bg.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-color: transparent;
    border-radius: 10px;
    position: relative;
    width: 100%;
    max-width: 516px;
    height: calc(516px / 5); /* 设置高度为宽度的1/5 */
    max-height: calc(516px / 5);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.jackpot-amount {
    font-size: 28px;
    color: var(--jackpot-colot);
    position: relative;
    z-index: 1;
    text-shadow: -1px -1px 0 #fb0606,1px -1px 0 #fb0606,-1px 1px 0 #fb0606,1px 1px 0 #fb0606;
    font-weight: 700;
    font-family: none;
    padding-top: 24px;
    letter-spacing: 0.5px; /* 增加字母间距使分隔符更清晰 */
}

/* 公告栏 */
.notice-bar {
    display: flex;
    align-items: center;
    position: relative;
    padding: 10px 15px;
    background-color: transparent !important;
}

.notice-icon {
    width: 40px;
    margin-right: 10px;
    z-index: 2;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notice-icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    animation: blink 1s infinite;
}

/* 中间容器 - 限制公告内容的显示范围 */
.notice-content-container {
    flex: 1;
    position: relative;
    overflow: hidden; /* 关键：隐藏溢出内容 */
    height: 24px;
}

/* 公告内容样式 - 增加选择器特异性并使用!important */
html body .notice-content {
    white-space: nowrap;
    color: var(--notice-content-color) !important; /* 使用专门的变量并添加!important */
    font-size: 14px;
    position: absolute;
    left: 0;
    width: 100%;
    text-align: center; /* 居中显示 */
    animation: notice-scroll-confined 15s linear infinite;
}

/* 确保在js-loading状态下也应用颜色 */
html.js-loading .notice-content {
    color: var(--notice-content-color) !important;
}

/* 添加更多特定选择器以增加优先级 */
html .notice-bar .notice-content-container .notice-content {
    color: var(--notice-content-color) !important;
}

/* 确保所有子元素也使用正确的颜色 */
.notice-content * {
    color: var(--notice-content-color) !important;
}

.notice-mail {
    width: 40px;
    margin-left: 10px;
    cursor: pointer;
    z-index: 2;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notice-mail-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* 公告滚动动画 - 只在容器内滚动 */
@keyframes notice-scroll-confined {
    0% {
        transform: translateX(100%); /* 从容器右边界开始 */
    }
    10% {
        transform: translateX(0); /* 滚动到容器左边 */
    }
    90% {
        transform: translateX(0); /* 在容器内停留 */
    }
    100% {
        transform: translateX(-100%); /* 滚动到容器左边界外 */
    }
}

/* 公告项样式 */
.notice-item {
    display: inline-block;
    padding: 0 5px;
}

.notice-separator {
    color: rgba(255, 255, 255, 0.5);
    margin: 0 5px;
}

/* 游戏分类标签 */
.horizontal-tabs {
    display: flex;
    justify-content: space-around;
    padding: 10px 5px;
    background-color: var(--darker-bg-color);
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    margin: 0 auto;
    width: 100%;
    max-width: 516px;
    box-sizing: border-box;
}

.horizontal-tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.tab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0.7;
    border-right: 1px solid rgba(255, 255, 255, 0.1); /* 添加浅色竖线分隔符 */
}

/* 移除最后一个tab的右边框 */
.tab:last-child {
    border-right: none;
}

.tab.active {
    color: var(--secondary-color);
    font-weight: bold;
    opacity: 1;
    cursor: default; /* 改变鼠标样式，表示不可点击 */
    pointer-events: none; /* 禁用点击事件 */
}

.tab.active:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 2px;
    background-color: var(--secondary-color);
}

.tab .tab-icon {
    display: block;
    margin: 0 auto 5px;
    position: relative;
    width: 24px;
    height: 24px;
}

.tab .icon-normal,
.tab .icon-selected {
    width: 24px;
    height: 24px;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s;
}

.tab .icon-normal {
    opacity: 1;
}

.tab .icon-selected {
    opacity: 0;
}

.tab.active .icon-normal {
    opacity: 0;
}

.tab.active .icon-selected {
    opacity: 1;
}

/* 游戏列表 */
.game-container {
    padding-top: 15px;
    /* padding: 15px,0px,0px,0px; */
    position: relative;
    min-height: 100px; /* 减少最小高度 */
    padding-bottom: 0px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 5px 10px;
}

.game-category-title {
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.category-icon {
    margin-right: 5px;
    color: var(--button-active);
}

.view-all {
    color: var(--view-all-color);
    font-size: 12px;
    cursor: pointer;
}

.view-all:hover {
    text-decoration: underline;
}

/* 动画效果 */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 公告栏滚动动画 - 从右往左移动 */
@keyframes notice-scroll-confined {
    0% {
        transform: translateX(100%); /* 从容器右边界开始 */
    }
    10% {
        transform: translateX(100%); /* 短暂停留 */
    }
    45% {
        transform: translateX(0); /* 滚动到容器中间 */
    }
    55% {
        transform: translateX(0); /* 在中间停留一段时间 */
    }
    90% {
        transform: translateX(-100%); /* 滚动到容器左边界 */
    }
    100% {
        transform: translateX(-100%); /* 结束于容器左边界 */
    }
}

/* 保留原始动画定义，以防其他地方使用 */
@keyframes scroll {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* 选项2：渐变淡入淡出效果 - 取消注释使用 */
/*
@keyframes fade-scroll {
    0% {
        transform: translateX(30%);
        opacity: 0;
    }
    10% {
        transform: translateX(0);
        opacity: 1;
    }
    90% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(-30%);
        opacity: 0;
    }
}
*/

/* 选项3：弹跳效果 - 取消注释使用 */
/*
@keyframes bounce-scroll {
    0% { transform: translateX(100%); }
    10% { transform: translateX(0); }
    15% { transform: translateX(5px); }
    20% { transform: translateX(0); }
    80% { transform: translateX(0); }
    85% { transform: translateX(-5px); }
    90% { transform: translateX(-100%); }
    100% { transform: translateX(-100%); }
}
*/

/* 响应式设计 */
@media (min-width: 481px) {
    /* 大屏幕下样式已在theme.css中设置 */
}

@media (max-width: 516px) {
    /* 确保小屏幕宽度控制 */
    .container, .fixed-header-section, .scrollable-content, .bottom-nav {
        width: 100%;
    }

    .jackpot-container {
        width: calc(100% - 20px);
        max-width: 100%;
        height: calc((100vw - 20px) / 5); /* 高度与宽度保持5:1的比例 */
        max-height: none;
    }
}

@media (max-width: 370px) {
    .jackpot-container {
        height: calc((100vw - 20px) / 4); /* 较小屏幕上宽高比为4:1 */
    }

    .jackpot-amount {
        font-size: 24px;
        padding-top: 20px;
    }

    .balance-amount {
        font-size: 12px;
    }

    .notice-icon-img,
    .notice-mail-img {
        width: 22px; /* 在小屏幕上稍微小一点 */
        height: 22px;
    }
}

/* 登录/注册按钮样式 */
.login-btn {
    background-color: var(--white-add);
    color: var(--darker-bg-color);
    padding: 5px 15px;
    border-radius: 5px;
    text-decoration: none;
    margin-right: 10px;
    font-weight: bold;
    border: 1px solid var(--white-add); /* 添加透明边框以保持对齐，或直接使用box-sizing */
}

.register-btn {
    background-color: var(--button-register);
    color: var(--text-color);
    padding: 5px 15px;
    border-radius: 5px;
    text-decoration: none;
    border: 1px solid var(--white-add);
    font-weight: bold;
    margin-right: 10px;
}

/* 添加关键路径CSS，确保元素尺寸在页面加载过程中不会突变 */
.header-left, .header-right, .logo-container, .balance-display, .dropdown, .search-btn {
    visibility: visible;
    opacity: 1;
    transition: none;
}

/* 禁用可能造成布局突变的CSS过渡效果 */
.header * {
    transition: none;
}

/* 强制预先渲染布局 */
.header-right.logged-in,
.header-right.logged-out {
    display: none;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.header-right.logged-in.active,
.header-right.logged-out.active {
    display: flex;
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    margin-right: -8px; /* 向右移动，使其更靠近右边缘 */
}

/* 固定头部和可滚动内容区样式 */
.fixed-header-section {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--main-bg-color);
    width: 100%;
    max-width: 516px;
    margin: 0 auto;
}

.scrollable-content {
    flex: 1;
    overflow: visible; /* 取消滚动，让内容自然流动 */
    width: 100%;
    max-width: 516px;
    margin: 0 auto;
    /* margin-bottom: 60px; 添加底部边距等于bottom-nav高度 */
}



/* 确保.header元素宽度固定为516px */
/* 提高选择器优先级 */
body .header,
.fixed-header-section .header {
    max-width: 516px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* 响应式设计调整 */
@media (max-width: 516px) {
    /* 确保小屏幕宽度控制 */
    .container, .fixed-header-section, .scrollable-content, .bottom-nav {
        width: 100%;
    }
}


/* middle-content 滚动区域样式 */
#middle-content {
    overflow-y: auto;
    height: calc(100vh - 60px); /* 设置高度为视口高度减去bottom-nav高度 */
    /* padding-bottom: 20px; 添加底部内边距，确保game-providers-section能完整显示 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */

    /* 添加顺滑滚动效果 */
    scroll-behavior: smooth;

    /* 添加滚动缓动效果 - 使用CSS滚动捕捉和动量滚动 */
    -webkit-overflow-scrolling: touch; /* iOS Safari 动量滚动 */

    /* 优化滚动性能 */
    will-change: scroll-position;
    transform: translateZ(0); /* 启用硬件加速 */

    /* 添加滚动边界行为 */
    overscroll-behavior: contain;

    /* 优化滚动条样式（如果需要显示） */
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* 隐藏Chrome, Safari和Opera的滚动条 */
#middle-content::-webkit-scrollbar {
    display: none;
}

/* 为滚动内容添加缓动动画效果 */
#middle-content > * {
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 为移动设备优化触摸滚动 */
@media (hover: none) and (pointer: coarse) {
    #middle-content {
        /* 增强移动设备的滚动体验 */
        scroll-snap-type: y proximity;

        /* 减少滚动惯性，使滚动更精确 */
        overscroll-behavior-y: contain;
    }
}

/* 为桌面设备优化滚动 */
@media (hover: hover) and (pointer: fine) {
    #middle-content {
        /* 添加滚动时的微妙过渡效果 */
        transition: all 0.1s ease-out;
    }

    /* 鼠标悬停时的滚动条显示（可选） */
    #middle-content:hover::-webkit-scrollbar {
        /* display: block; */ /* 取消注释以在悬停时显示滚动条 */
        width: 4px;
    }

    #middle-content:hover::-webkit-scrollbar-thumb {
        background-color: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }
}
