/**
 * RiPro-V2 子主题 - 全局UI细节优化
 * 
 * 包含:
 * - 自定义滚动条样式
 * - 页面底部UI优化
 * - 返回顶部按钮
 * - 其他全局小细节
 * 
 * @package RiPro-V2-Child
 * @since 1.0.0
 */

/* ==========================================================================
   全局容器优化 - 防止横向滚动
   ========================================================================== */

/* 防止横向滚动条出现 */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* ==========================================================================
   自定义滚动条样式 - 现代化设计
   ========================================================================== */

/* 整体滚动条 - 适用于webkit浏览器(Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px !important; /* 垂直滚动条宽度 */
    height: 10px !important; /* 水平滚动条高度 */
}

/* 滚动条轨道 */
::-webkit-scrollbar-track {
    background: #f1f1f1 !important; /* 浅灰色轨道 */
    border-radius: 5px !important;
}

/* 滚动条滑块 - 深蓝灰色 */
::-webkit-scrollbar-thumb {
    background: #2F4254 !important;
    border-radius: 5px !important;
}

/* 滚动条滑块悬停 - 稍微变亮 */
::-webkit-scrollbar-thumb:hover {
    background: #3d5468 !important;
}

/* 滚动条滑块激活 */
::-webkit-scrollbar-thumb:active {
    background: #253342 !important;
}

/* 滚动条按钮隐藏 */
::-webkit-scrollbar-button {
    display: none !important;
}

/* Dark Mode 滚动条轨道 */
body.dark-mode ::-webkit-scrollbar-track,
.dark-open ::-webkit-scrollbar-track {
    background: #2c2c2c !important;
}

/* Dark Mode 滚动条适配 */
body.dark-mode ::-webkit-scrollbar-thumb,
.dark-open ::-webkit-scrollbar-thumb {
    background: #2F4254 !important;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover,
.dark-open ::-webkit-scrollbar-thumb:hover {
    background: #3d5468 !important;
}

/* Firefox 滚动条样式 */
* {
    scrollbar-width: thin !important;
    scrollbar-color: #2F4254 #f1f1f1 !important;
}

body.dark-mode *,
.dark-open * {
    scrollbar-color: #2F4254 #2c2c2c !important;
}


/* ==========================================================================
   页面底部彩虹波浪效果 - 连续正弦波
   ========================================================================== */

/* 波浪容器 - 绝对定位在Footer内部底部 */
.rainbow-wave-footer {
    position: absolute;
    bottom: 0; /* 贴在Footer底部(备案信息下方) */
    left: 0;
    width: 100%;
    height: 40px;
    overflow: hidden; /* 隐藏超出部分,防止横向滚动条 */
    z-index: 100;
    pointer-events: none; /* 不阻挡鼠标点击 */
}

/* Footer需要相对定位作为参考,并确保有足够的z-index */
.site-footer {
    position: relative;
    z-index: 1;
    overflow-x: hidden !important; /* 禁止横向滚动 */
    overflow-y: visible !important; /* 允许纵向溢出(预览窗口) */
    padding-bottom: 40px; /* 为波浪留出空间 */
}

/* SVG波浪层 */
.rainbow-wave-footer svg {
    position: absolute;
    bottom: 0; /* 从底部开始 */
    left: 0;
    width: 200%;
    height: 100%;
    animation: wave-move 10s linear infinite;
}

/* 波浪移动动画 - 缓慢流动 */
@keyframes wave-move {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* 第二层波浪 - 反向移动,速度稍快 */
.rainbow-wave-footer svg:nth-child(2) {
    opacity: 0.6;
    animation: wave-move-reverse 8s linear infinite;
}

@keyframes wave-move-reverse {
    0% {
        transform: translateX(-50%);
    }
    100% {
        transform: translateX(0);
    }
}


/* ==========================================================================
   页面底部 Footer UI优化
   ========================================================================== */

/* Footer 容器优化 - 纯白色背景 + 允许溢出 */
.site-footer {
    background: #ffffff !important;
    border-top: 1px solid #e0e0e0;
    padding: 40px 0 20px;
}

/* Footer所有容器允许溢出 - 确保预览窗口不被截断 */
.site-footer,
.site-footer > *,
.footer-widget,
.footer-widget .container,
.footer-widget .row,
.footer-widget .col-lg-4,
.footer-widget .col-md-4,
.footer-ad-right,
.footer-ad-images {
    overflow: visible !important;
}

/* Dark Mode Footer - 保持深色 */
body.dark-mode .site-footer,
.dark-open .site-footer {
    background: #1a1a1a !important;
    border-top: 1px solid #333333;
}

/* Footer 链接优化 */
.site-footer a {
    transition: all 0.3s ease;
    color: #6c757d;
}

.site-footer a:hover {
    color: #667eea;
    transform: translateX(3px);
}

body.dark-mode .site-footer a,
.dark-open .site-footer a {
    color: #999999;
}

body.dark-mode .site-footer a:hover,
.dark-open .site-footer a:hover {
    color: #667eea;
}

/* Footer 版权信息 */
.site-footer .copyright {
    color: #999999;
    font-size: 13px;
    padding: 15px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

body.dark-mode .site-footer .copyright,
.dark-open .site-footer .copyright {
    color: #666666;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}


/* ==========================================================================
   返回顶部按钮优化
   ========================================================================== */

/* 返回顶部按钮 - 圆形渐变 */
.go-to-top {
    position: fixed;
    bottom: 80px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9999;
}

/* 显示状态 */
.go-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 悬停效果 */
.go-to-top:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

/* 激活效果 */
.go-to-top:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Dark Mode 适配 */
body.dark-mode .go-to-top,
.dark-open .go-to-top {
    background: linear-gradient(135deg, #4a5fc1 0%, #5a3d8a 100%);
    box-shadow: 0 4px 12px rgba(74, 95, 193, 0.4);
}

body.dark-mode .go-to-top:hover,
.dark-open .go-to-top:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

/* 移动端优化 */
@media (max-width: 768px) {
    .go-to-top {
        bottom: 60px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}


/* ==========================================================================
   页面加载动画优化
   ========================================================================== */

/* 页面加载指示器 */
.page-loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% 100%;
    animation: loading-animation 1.5s ease-in-out infinite;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.page-loading-indicator.active {
    opacity: 1;
    visibility: visible;
}

@keyframes loading-animation {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}


/* ==========================================================================
   选中文本样式优化
   ========================================================================== */

/* 文本选中高亮 - 紫色渐变背景 */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: #1a1a1a;
}

::-moz-selection {
    background: rgba(102, 126, 234, 0.3);
    color: #1a1a1a;
}

/* Dark Mode 文本选中 */
body.dark-mode ::selection,
.dark-open ::selection {
    background: rgba(102, 126, 234, 0.5);
    color: #ffffff;
}

body.dark-mode ::-moz-selection,
.dark-open ::-moz-selection {
    background: rgba(102, 126, 234, 0.5);
    color: #ffffff;
}


/* ==========================================================================
   输入框焦点优化
   ========================================================================== */

/* 输入框焦点发光效果 */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    transition: all 0.3s ease;
}

/* Dark Mode 输入框焦点 */
body.dark-mode input[type="text"]:focus,
body.dark-mode input[type="email"]:focus,
body.dark-mode input[type="password"]:focus,
body.dark-mode input[type="search"]:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus,
.dark-open input[type="text"]:focus,
.dark-open input[type="email"]:focus,
.dark-open input[type="password"]:focus,
.dark-open input[type="search"]:focus,
.dark-open textarea:focus,
.dark-open select:focus {
    border-color: #4a5fc1 !important;
    box-shadow: 0 0 0 3px rgba(74, 95, 193, 0.2) !important;
}


/* ==========================================================================
   图片加载优化
   ========================================================================== */

/* 图片懒加载占位符 */
img[data-src]:not([src]) {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Dark Mode 图片占位符 */
body.dark-mode img[data-src]:not([src]),
.dark-open img[data-src]:not([src]) {
    background: linear-gradient(90deg, #2a2a2a 25%, #1a1a1a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
}


/* ==========================================================================
   右侧浮动菜单(Rollbar)文字标签优化
   ========================================================================== */

/* Rollbar容器 - 向左移动10px,增加宽度,常亮显示 */
.rollbar {
    right: 10px !important; /* 向左移动10px */
    width: 60px !important; /* 增加宽度以容纳文字 */
    display: block !important; /* 常亮显示,覆盖父主题的display:none */
    opacity: 1 !important; /* 强制不透明,防止闪烁 */
    visibility: visible !important; /* 强制可见 */
    transform: none !important; /* 禁用任何变换 */
    animation: none !important; /* 禁用任何动画 */
}

/* 菜单项链接 - 垂直布局(图标上,文字下) */
.rollbar .actions li > a {
    display: flex !important;
    flex-direction: column !important; /* 垂直排列 */
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 5px !important;
    line-height: 1.2 !important;
    height: auto !important;
    min-height: 50px !important;
}

/* 返回顶部按钮 - 垂直布局 */
.rollbar .rollbar-item.back-to-top {
    display: flex !important;
    flex-direction: column !important; /* 垂直排列 */
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 5px !important;
    line-height: 1.2 !important;
    height: auto !important;
    min-height: 50px !important;
}

/* 图标样式 */
.rollbar .actions li > a i,
.rollbar .rollbar-item i {
    display: block !important;
    font-size: 18px !important;
    margin-bottom: 3px !important; /* 图标和文字间距 */
}

/* 文字标签样式 - 始终显示 */
.rollbar-text {
    display: block !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    color: inherit !important;
    text-align: center !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    transition: color 0.3s ease !important;
}

/* Hover效果 - 按钮变蓝色 */
.rollbar .actions li:hover,
.rollbar .rollbar-item.back-to-top:hover {
    background-color: rgba(102, 126, 234, 0.1) !important;
    transition: all 0.3s ease !important;
}

.rollbar .actions li:hover > a,
.rollbar .actions li:hover > a i,
.rollbar .actions li:hover > a .rollbar-text {
    color: #667eea !important;
    transition: color 0.3s ease !important;
}

.rollbar .rollbar-item.back-to-top:hover,
.rollbar .rollbar-item.back-to-top:hover i {
    color: #667eea !important;
    transition: color 0.3s ease !important;
}

/* 隐藏返回顶部按钮的文字,只显示箭头 */
.rollbar .rollbar-item.back-to-top .rollbar-text {
    display: none !important;
}

/* 返回顶部按钮图标居中,无文字时调整 */
.rollbar .rollbar-item.back-to-top {
    min-height: 40px !important;
}

.rollbar .rollbar-item.back-to-top i {
    margin-bottom: 0 !important;
}

/* Dark Mode 文字颜色适配 */
body.dark-mode .rollbar-text,
.dark-open .rollbar-text {
    color: #fff !important;
}

/* 移动端保持原样(rollbar本身已隐藏) */
@media (max-width: 767px) {
    .rollbar {
        right: 0 !important;
        width: 40px !important;
        display: none !important; /* 移动端依然隐藏 */
    }
    
    .rollbar-text {
        display: none !important;
    }
}


/* ==========================================================================
   响应式优化
   ========================================================================== */

/* 平板端优化 */
@media (max-width: 991px) {
    .site-footer {
        padding: 30px 0 15px;
    }
    
    .site-footer .copyright {
        font-size: 12px;
        padding: 12px 0;
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px !important;
        height: 6px !important;
    }
    
    .site-footer {
        padding: 25px 0 12px;
    }
    
    .site-footer .copyright {
        font-size: 11px;
        padding: 10px 0;
    }
}
