/**
 * 首页移动端完整自适应样式
 * 专门针对 inject-home.js 注入的首页内容
 */

/* ========================================
   基础响应式设置
   ======================================== */
.home-injected-content {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

/* ========================================
   平板端 (768px - 992px)
   ======================================== */
@media (max-width: 992px) {
    .home-injected-content > div {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    /* 搜索框区域 */
    .search-section {
        padding: 12px 15px !important;
    }
    
    .search-section > div {
        flex-wrap: nowrap !important;
    }
    
    .search-section input {
        min-width: 0 !important;
        flex: 1 !important;
    }
    
    .search-section select {
        min-width: 100px !important;
        font-size: 12px !important;
    }
    
    /* 轮播图 */
    #dashboardCarouselWrapper {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    /* 信息卡片网格 - 平板2列 */
    .info-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
        padding: 0 15px !important;
        max-width: 100% !important;
    }
}

/* ========================================
   手机端 (小于768px)
   ======================================== */
@media (max-width: 768px) {
    /* 主容器 */
    .home-injected-content {
        background: #f5f5f5 !important;
    }
    
    .home-injected-content > div {
        max-width: 100% !important;
        margin: 0 !important;
        box-shadow: none !important;
    }
    
    /* 搜索框区域 */
    .search-section {
        padding: 10px !important;
    }
    
    .search-section > div {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .search-section input {
        flex: 1 1 100% !important;
        height: 42px !important;
        font-size: 16px !important; /* 防止iOS缩放 */
        border-radius: 4px !important;
    }
    
    .search-section select {
        flex: 1 !important;
        height: 42px !important;
        min-width: 0 !important;
        font-size: 14px !important;
        border: 1px solid #ccc !important;
        border-radius: 4px !important;
    }
    
    .search-section button {
        height: 42px !important;
        width: 50px !important;
        border-radius: 4px !important;
    }
    
    /* 轮播图 */
    #dashboardCarouselWrapper {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    #dashboardCarousel {
        box-shadow: none !important;
    }
    
    #dashboardCarousel img {
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }
    
    #dashboardCarousel .carousel-control-prev,
    #dashboardCarousel .carousel-control-next {
        width: 35px !important;
    }
    
    .carousel-indicators-bottom {
        margin: 15px 0 !important;
        gap: 8px !important;
    }
    
    .carousel-indicators-bottom li {
        width: 10px !important;
        height: 10px !important;
    }
    
    .carousel-indicators-bottom li.active {
        width: 12px !important;
        height: 12px !important;
    }
    
    /* 信息卡片网格 - 手机1列 */
    .info-cards-grid,
    .news-section-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 25px !important;
        padding: 0 10px !important;
        max-width: 100% !important;
    }
    
    /* 信息卡片 */
    .info-card-item {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
    
    /* 卡片圆形图标 */
    .info-card-item > div:first-child {
        height: 50px !important;
        margin-bottom: -25px !important;
    }
    
    .info-card-item > div:first-child > div {
        width: 65px !important;
        height: 65px !important;
    }
    
    .info-card-item > div:first-child > div > div {
        font-size: 10px !important;
    }
    
    .info-card-item > div:first-child > div > div > div:first-child {
        font-size: 14px !important;
    }
    
    /* 卡片标题栏 */
    .card-header-area,
    .info-card-item > div:nth-child(2) {
        height: 90px !important;
        min-height: 90px !important;
        max-height: 90px !important;
        padding: 30px 15px 15px !important;
    }
    
    .card-header-area > div:first-child,
    .info-card-item > div:nth-child(2) > div:first-child {
        font-size: 18px !important;
        padding: 4px 15px !important;
    }
    
    /* 卡片向下箭头 */
    .card-header-area > div:last-child,
    .info-card-item > div:nth-child(2) > div:last-child {
        border-left-width: 12px !important;
        border-right-width: 12px !important;
        border-top-width: 12px !important;
        bottom: -12px !important;
    }
    
    /* 卡片内容区 */
    .card-content-area,
    .info-card-item > div:nth-child(3) {
        height: 320px !important;
        min-height: 320px !important;
        max-height: 320px !important;
        padding: 20px 15px !important;
    }
    
    /* 新闻列表项 */
    .card-content-area a,
    .info-card-item > div:nth-child(3) a {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
    
    .card-content-area > div {
        margin-bottom: 12px !important;
    }
    
    /* 视频区域 */
    .home-injected-content [style*="padding: 40px"] {
        padding: 25px 10px !important;
    }
    
    .home-injected-content [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    /* 视频卡片 */
    .home-injected-content [style*="aspect-ratio: 16/9"] {
        aspect-ratio: 16/9 !important;
    }
    
    /* 相关链接栏 */
    .related-links-bar,
    #related-links-bar {
        flex-direction: column !important;
        gap: 8px !important;
        padding: 15px !important;
        text-align: center !important;
    }
    
    .related-links-bar span[style*="rgba(255,255,255,0.5)"],
    #related-links-bar span[style*="rgba(255,255,255,0.5)"] {
        display: none !important;
    }
    
    .related-links-bar a,
    #related-links-bar a {
        display: block !important;
        padding: 10px 15px !important;
        background: rgba(255,255,255,0.1) !important;
        border-radius: 4px !important;
        margin: 3px 0 !important;
    }
    
    /* 底部区域 */
    footer,
    #home-footer {
        padding: 25px 15px !important;
    }
    
    footer > div,
    #home-footer > div {
        max-width: 100% !important;
    }
    
    footer [style*="display: flex"][style*="justify-content: space-between"],
    #home-footer [style*="display: flex"][style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: center !important;
        gap: 25px !important;
    }
    
    footer [style*="flex: 0 0 280px"],
    #home-footer [style*="flex: 0 0 280px"] {
        flex: 1 1 100% !important;
        width: 100% !important;
        text-align: center !important;
    }
    
    /* 底部二维码区域 */
    #home-footer-qrcodes {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 15px !important;
    }
    
    #home-footer-qrcodes > div {
        flex: 0 0 calc(50% - 10px) !important;
        max-width: calc(50% - 10px) !important;
    }
    
    #home-footer-qrcodes img {
        width: 70px !important;
        height: 70px !important;
    }
    
    /* 底部标章 */
    #home-footer-badges {
        flex-direction: row !important;
        gap: 15px !important;
    }
    
    #home-footer-badges img {
        height: 35px !important;
    }
}

/* ========================================
   小屏手机 (小于480px)
   ======================================== */
@media (max-width: 480px) {
    /* 搜索框 */
    .search-section {
        padding: 8px !important;
    }
    
    .search-section input {
        height: 40px !important;
    }
    
    .search-section select {
        height: 40px !important;
        font-size: 13px !important;
        padding: 0 8px !important;
    }
    
    .search-section button {
        height: 40px !important;
        width: 45px !important;
    }
    
    /* 信息卡片 */
    .info-cards-grid {
        gap: 20px !important;
        padding: 0 8px !important;
    }
    
    /* 卡片圆形图标 */
    .info-card-item > div:first-child {
        height: 40px !important;
        margin-bottom: -20px !important;
    }
    
    .info-card-item > div:first-child > div {
        width: 55px !important;
        height: 55px !important;
    }
    
    /* 卡片标题栏 */
    .card-header-area,
    .info-card-item > div:nth-child(2) {
        height: 80px !important;
        min-height: 80px !important;
        max-height: 80px !important;
        padding: 25px 10px 10px !important;
    }
    
    .card-header-area > div:first-child,
    .info-card-item > div:nth-child(2) > div:first-child {
        font-size: 16px !important;
        padding: 3px 12px !important;
    }
    
    /* 卡片内容区 */
    .card-content-area,
    .info-card-item > div:nth-child(3) {
        height: 280px !important;
        min-height: 280px !important;
        max-height: 280px !important;
        padding: 15px 12px !important;
    }
    
    /* 底部二维码 */
    #home-footer-qrcodes img {
        width: 60px !important;
        height: 60px !important;
    }
    
    #home-footer-qrcodes > div {
        flex: 0 0 calc(50% - 8px) !important;
    }
    
    /* 相关链接 */
    .related-links-bar a,
    #related-links-bar a {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }
}

/* ========================================
   超小屏手机 (小于360px)
   ======================================== */
@media (max-width: 360px) {
    .info-cards-grid {
        padding: 0 5px !important;
    }
    
    .card-content-area,
    .info-card-item > div:nth-child(3) {
        height: 250px !important;
        min-height: 250px !important;
        max-height: 250px !important;
        padding: 12px 10px !important;
    }
    
    .card-header-area > div:first-child,
    .info-card-item > div:nth-child(2) > div:first-child {
        font-size: 14px !important;
    }
}

/* ========================================
   触摸优化
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* 触摸设备上增大点击区域 */
    .card-content-area a,
    .info-card-item a {
        padding: 8px 0 !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .related-links-bar a,
    #related-links-bar a {
        min-height: 44px !important;
    }
    
    /* 查看更多按钮 */
    .card-content-area a[style*="border-radius: 20px"],
    .info-card-item a[style*="border-radius: 20px"] {
        padding: 12px 30px !important;
        min-height: 44px !important;
    }
}

/* ========================================
   横屏模式
   ======================================== */
@media (max-width: 992px) and (orientation: landscape) {
    /* 横屏时信息卡片2列 */
    .info-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* 视频区域2列 */
    .home-injected-content [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* 卡片内容区高度调整 */
    .card-content-area,
    .info-card-item > div:nth-child(3) {
        height: 280px !important;
        min-height: 280px !important;
        max-height: 280px !important;
    }
}

/* ========================================
   滚动条美化
   ======================================== */
.card-content-area::-webkit-scrollbar {
    width: 4px;
}

.card-content-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.card-content-area::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.card-content-area::-webkit-scrollbar-thumb:hover {
    background: #999;
}

