/* 移动端H5适配样式 */

/* 移动端断点: 768px及以下 */
@media screen and (max-width: 768px) {
    /* === 全局重置 === */
    html, body {
        width: 100% !important;
        min-width: 100% !important;
        overflow-x: hidden !important;
        height: auto !important; /* ✅ 关键修复：允许高度自适应 */
        min-height: 100vh !important; /* 保持最小高度 */
    }

    body {
        display: block !important; /* 禁用 flex 布局 */
    }

    .layout {
        width: 100% !important;
        min-width: 100% !important;
        min-height: 100vh !important; /* 最小高度 */
        height: auto !important; /* ✅ 关键修复：自适应内容高度 */
    }

    /* === 头部导航 === */
    .header {
        min-width: 100% !important;
        height: 50px !important;
    }

    .header .head {
        padding: 0 12px !important;
        max-width: 100% !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 50px;
    }

    .header .head .logo {
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }

    .header .head .logo img {
        height: 22px !important;
        margin-top: 0 !important;
        padding-left: 0 !important;
    }

    .header .head .menu {
        display: flex;
        align-items: center;
        gap: 2px;
        float: none !important;
    }

    .header .head .menu > a {
        line-height: 50px !important;
        padding: 0 !important;
    }

    .header .head .menu > a span {
        padding: 0 8px !important;
        margin: 0 !important;
        border-right: none !important;
        font-size: 13px !important;
    }

    /* active状态 */
    .header .head .menu .active {
        font-weight: 700;
    }

    .header .head .menu .active::after {
        content: "" !important;
        width: 20px !important;
        border: 1px solid #fff !important;
        border-radius: 2px !important;
        position: absolute !important;
        top: 20px !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }

    /* 用户头像菜单 */
    #userMenuContainer {
        margin-left: 4px !important;
    }

    #userMenuContainer #userMenu {
        margin-left: 0 !important;
    }

    #userMenuContainer #userMenu img {
        width: 28px !important;
        height: 28px !important;
    }

    #userDropdown {
        right: 0 !important;
        top: 42px !important;
        min-width: 100px !important;
    }

    #userDropdown a {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }

    /* === 内容区域 === */
    .account-container,
    .course-list,
    .course-detail-container {
        max-width: 100% !important;
        margin: 60px 0 0 0 !important;
        padding: 12px !important;
        min-height: calc(100vh - 120px) !important;
    }

    .account-container h1,
    .course-list h1,
    .course-detail-container h1 {
        font-size: 20px !important;
        margin-bottom: 16px !important;
    }

    /* === 我的账户页面 === */
    .account-card {
        padding: 20px 12px !important;
        border-radius: 8px !important;
    }

    .user-avatar {
        margin-bottom: 20px !important;
    }

    .user-avatar img {
        width: 70px !important;
        height: 70px !important;
    }

    .info-item {
        padding: 10px 0 !important;
        display: flex;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .info-label {
        font-size: 14px !important;
        color: #666 !important;
    }

    .info-value {
        font-size: 14px !important;
        text-align: right;
    }

    /* === 课程列表 === */
    .courses {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-bottom: 20px !important;
    }

    .course-card {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        border-radius: 8px !important;
    }

    .course-card-body {
        padding: 14px !important;
    }

    .course-title {
        font-size: 15px !important;
        height: auto !important;
        min-height: 40px !important;
        margin-bottom: 10px !important;
    }

    .course-teacher {
        margin-bottom: 8px !important;
    }

    .teacher-avatar {
        width: 30px !important;
        height: 30px !important;
        margin-right: 8px !important;
    }

    .teacher-name {
        font-size: 13px !important;
    }

    .course-info {
        padding-top: 10px !important;
    }

    .lesson-count {
        font-size: 13px !important;
    }

    .enroll-badge {
        font-size: 11px !important;
        padding: 3px 8px !important;
        border-radius: 10px !important;
    }

    /* === 课程详情页 === */
    .back-link {
        margin-bottom: 12px !important;
    }

    .back-link a {
        font-size: 13px !important;
    }

    .lesson-list {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        border-radius: 8px !important;
    }

    .lesson-item {
        padding: 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }

    .lesson-info {
        width: 100%;
    }

    .lesson-name {
        font-size: 15px !important;
        margin-bottom: 10px !important;
    }

    .lesson-meta {
        flex-direction: column !important;
        gap: 6px !important;
        align-items: flex-start !important;
    }

    .lesson-time {
        font-size: 12px !important;
    }

    .lesson-teacher {
        gap: 6px !important;
    }

    .lesson-teacher-avatar {
        width: 20px !important;
        height: 20px !important;
    }

    .lesson-teacher-name {
        font-size: 12px !important;
    }

    .lesson-actions {
        width: 100%;
    }

    .replay-btn {
        width: 100%;
        padding: 10px 20px !important;
        font-size: 14px !important;
    }

    /* === 分页 === */
    .pagination {
        margin-top: 16px !important;
        display: none !important; /* 移动端隐藏分页,使用触底加载 */
    }

    /* === 底部版权 === */
    .footer {
        padding: 16px 12px !important;
        margin-top: 20px;
        width: auto;
    }

    .footer > div {
        font-size: 11px !important;
        line-height: 1.6 !important;
        margin-bottom: 8px !important;
    }

    .footer span,
    .footer a {
        font-size: 11px !important;
        word-break: break-word !important;
    }

    .footer img {
        width: 14px !important;
        height: 14px !important;
        vertical-align: middle !important;
        margin-right: 4px !important;
    }

    .footer .media-copyright {
        font-size: 11px !important;
        margin-top: 4px !important;
        line-height: 1.6 !important;
    }

    /* === 关于我们页面主体内容 === */
    /* 左侧标签导航 */
    .label {
        display: none !important; /* 移动端隐藏侧边导航 */
    }

    /* 内容区域 */
    .content {
        width: 100% !important;
        margin: 60px 0 0 0 !important;
        padding: 0 !important;
    }

    .content-space {
        padding: 12px !important;
        max-width: 100% !important;
    }

    .caption {
        width: 100% !important;
    }

    .caption .title {
        font-size: 20px !important;
        margin-bottom: 16px !important;
        padding: 0 !important;
    }

    .caption .title-two {
        font-size: 16px !important;
        margin-top: 20px !important;
        margin-bottom: 8px !important;
    }

    .caption p {
        font-size: 14px !important;
        line-height: 1.8 !important;
        margin-bottom: 12px !important;
        word-break: break-word !important;
    }

    /* 业务展示模块 */
    .content-business {
        padding-top: 12px !important;
        margin-bottom: 20px !important;
    }

    .content-business .item {
        flex-direction: column !important;
        height: auto !important;
        margin-bottom: 30px !important;
        padding-bottom: 0 !important;
    }

    .content-business .item.leftIcon {
        flex-direction: column-reverse !important; /* 反转顺序,图片在上 */
        padding-bottom: 0 !important;
    }

    .content-business .item .cover {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        margin-bottom: 16px !important;
        background-position: center !important;
        min-height: 200px !important;
    }

    .content-business .item.leftIcon .cover {
        position: relative !important;
        right: auto !important;
    }

    .content-business .item .cover.cover0,
    .content-business .item .cover.cover1,
    .content-business .item .cover.cover2 {
        width: 100% !important;
        aspect-ratio: 16/9 !important; /* 保持宽高比 */
    }

    .content-business .item .cover .icon {
        width: 60px !important;
        height: 60px !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
    }

    .content-business .item .text {
        width: 100% !important;
        height: auto !important;
        padding: 0 !important;
        font-size: 14px !important;
        line-height: 1.6 !important;
    }

    .content-business .item .text .icon {
        display: none !important; /* 移动端隐藏装饰图标 */
    }

    .content-business .item .text .title {
        padding-top: 0 !important;
        font-size: 18px !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
    }

    .content-business .item .text .sub-title {
        padding-top: 8px !important;
        font-size: 13px !important;
        opacity: 0.6 !important;
        line-height: 1.6 !important;
    }

    .content-business .item .text .english-title {
        padding-top: 8px !important;
        font-size: 11px !important;
        opacity: 0.3 !important;
        line-height: 1.4 !important;
    }

    .content-business .item:first-child .text,
    .content-business .item:nth-child(2) .text {
        padding-top: 0 !important;
    }

    /* 分割线 */
    .line {
        margin: 20px 0 !important;
    }

    /* === 视频播放器 === */
    .video-modal .video-container {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
    }

    .video-header {
        padding: 10px 12px !important;
    }

    .video-header h3 {
        font-size: 15px !important;
    }

    .video-close {
        font-size: 24px !important;
    }

    .video-wrapper {
        padding-bottom: 56.25% !important;
    }

    /* === iframe模态框 === */
    .iframe-modal .iframe-container {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
    }

    .iframe-modal {
        background: rgba(0, 0, 0, 0.95) !important;
    }

    .iframe-header {
        padding: 10px 12px !important;
    }

    .iframe-header h3 {
        font-size: 15px !important;
    }

    .iframe-wrapper {
        height: calc(100% - 45px) !important;
    }

    /* === 加载和空状态 === */
    .loading,
    .empty,
    .error {
        padding: 40px 12px !important;
        font-size: 14px !important;
    }

    /* === 触底加载提示 === */
    .load-more-trigger {
        text-align: center;
        padding: 20px;
        color: #999;
        font-size: 13px;
    }
}

/* 小屏手机优化 (375px及以下) */
@media screen and (max-width: 375px) {
    .header .head {
        padding: 0 10px !important;
    }

    .header .head .menu > a span {
        padding: 0 6px !important;
        font-size: 12px !important;
    }

    .account-container h1,
    .course-list h1,
    .course-detail-container h1 {
        font-size: 18px !important;
    }

    .course-title {
        font-size: 14px !important;
    }
}
