/* 全站响应式自适应补丁 - 集中管理移动端页面内容适配 */
/* 注意：导航栏和菜单的移动端样式由 header.css 统一管理，此处不覆盖 */

/* =========================================
   全局背景与层级设置
   ========================================= */
/* 强制全站粒子背景永远沉到底层并允许点击穿透 */
#canvas-background {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: -10 !important;
    background: transparent !important;
}

/* 强制全站主体内容漂浮于粒子背景之上 */
body>main,
body>section,
body>div.container,
.main,
.hero,
.features-section,
.container {
    position: relative;
    z-index: 1;
}

/* 防止画布被前面的重置规则干扰 */
body>#canvas-background {
    z-index: -10 !important;
}

/* =========================================
   1. 首页 Hero 与按钮适配
   ========================================= */
@media (max-width: 768px) {

    /* Hero 标题优化 */
    .hero {
        padding: 90px 0 40px;
        text-align: center;
    }

    .hero h1 {
        font-size: 26px;
        line-height: 1.4;
        margin-bottom: 25px;
        padding: 0 10px;
    }

    .hero p {
        font-size: 14px;
        color: rgba(255, 255, 255, 0.7);
        line-height: 1.8;
        margin-bottom: 35px;
    }

    /* 下载按钮垂直堆叠 */
    .product-buttons,
    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 15px;
        width: 100%;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
    }

    .btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 15px;
        border-radius: 8px;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 0;
    }

    /* 浮动球位置微调：居中显示 */
    .floating-widget {
        right: 10px !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) scale(0.9) !important;
    }
}

/* =========================================
   2. 课程详情页适配 (Android/iOS)
   ========================================= */
@media (max-width: 1023px) {

    /* 侧边栏转为垂直布局 */
    .lg\:flex-row {
        flex-direction: column !important;
    }

    .lg\:w-64,
    .xl\:w-72 {
        width: 100% !important;
        max-width: 100% !important;
    }

    .sidebar {
        margin-bottom: 2rem !important;
        position: relative !important;
        top: 0 !important;
        width: 100% !important;
        padding: 1rem !important;
        box-shadow: none !important;
        background: rgba(255, 255, 255, 0.02) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
}

@media (max-width: 768px) {
    .course-intro {
        padding: 1.5rem !important;
    }

    .main.container {
        margin-top: 130px !important;
    }

    /* 课程工具栏吸顶位置优化 */
    .header.sticky {
        top: 60px !important;
        /* 同步 60px 导航栏 */
        padding: 10px 15px !important;
    }
}

/* =========================================
   3. 首页 (index.html) 增强适配
   ========================================= */
@media (max-width: 992px) {

    .features-grid,
    .products-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
}

/* =========================================
   4. 更新日志与群控页增强适配
   ========================================= */
@media (max-width: 768px) {

    /* 分页按钮自动换行 */
    .pagination-container {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px !important;
    }

    /* 服务项目垂直堆叠 */
    .services-section .container {
        flex-direction: column !important;
        align-items: center !important;
    }

    .service-item {
        width: 100% !important;
        max-width: 400px !important;
    }
}

/* =========================================
   5. 课程选择页 (lrclasschoose.html) 适配
   ========================================= */
@media (max-width: 768px) {
    .grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3 {
        grid-template-columns: 1fr !important;
        /* 强制单列 */
    }

    /* 缩小课程卡片内边距 */
    .p-6 {
        padding: 1.25rem !important;
    }
}

/* =========================================
   6. 全局公告弹窗样式 (business-announcement.js 使用)
   ========================================= */
.announcement-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    padding: 20px;
}

.announcement-modal.show {
    display: flex;
    opacity: 1;
}

.announcement-content {
    background: rgba(20, 25, 30, 0.98);
    border: 1px solid rgba(0, 204, 255, 0.4);
    border-radius: 20px;
    padding: 0;
    width: 95%;
    max-width: 1400px;
    /* 增加宽度以适配侧边栏 */
    height: 85vh;
    display: flex;
    flex-direction: row;
    /* 改为左右布局 */
    position: relative;
    box-shadow: 0 0 50px rgba(0, 204, 255, 0.3);
    overflow: hidden;
}

/* 公告侧边栏 */
.announcement-sidebar {
    width: 240px;
    background: rgba(15, 20, 25, 0.95);
    border-right: 1px solid rgba(0, 204, 255, 0.2);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 25px 20px;
    font-size: 18px;
    font-weight: 700;
    color: #00ccff;
    border-bottom: 1px solid rgba(0, 204, 255, 0.1);
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 15px 10px;
}

.nav-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 10px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.02);
}

.nav-item:hover {
    background: rgba(0, 204, 255, 0.1);
    color: #00ccff;
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(0, 204, 255, 0.2), transparent);
    color: #00ccff;
    border-left: 3px solid #00ccff;
    font-weight: 600;
}

/* 公告主内容区 */
.announcement-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #fff;
    /* 腾讯文档背景通常是白的 */
}

.close-announcement {
    position: absolute;
    top: 100px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 100;
}

.close-announcement:hover {
    color: #00ccff;
}

.announcement-iframe-container {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

/* 适配移动端弹窗高度 */
@media (max-width: 768px) {
    .announcement-content {
        flex-direction: column;
        height: 85vh;
        width: 100%;
        border-radius: 15px;
    }

    .announcement-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(0, 204, 255, 0.1);
    }

    .sidebar-header {
        padding: 15px 20px;
        font-size: 16px;
        text-align: center;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding: 5px 10px;
        gap: 8px;
    }

    .nav-item {
        margin-bottom: 0;
        white-space: nowrap;
        padding: 8px 15px;
    }

    .close-announcement {
        top: 65px;
        /* 在移动端向下移动，避免遮挡标题 */
        right: 15px;
    }
}

/* 官方公告加载动画旋转效果 */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}