/* ============================================
   移动端优化层 — 不改变 HTML 结构与内容
   仅保留 style.css 媒体查询中未覆盖的
   移动端专属微调
   ============================================ */

/* ---------- 480px 以下 ---------- */
@media (max-width: 480px) {

    /* 限制 logo-grid 溢出 */
    .logo-grid {
        overflow: hidden;
        width: 100%;
    }

    /* logo-row 横向滚动 */
    .logo-row {
        flex-wrap: nowrap;
        gap: 16px;
        max-width: none;
        padding: 0 8px;
        overflow-x: scroll;
        overflow-y: hidden;
        width: 100%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        touch-action: pan-x;
    }

    .logo-row::-webkit-scrollbar {
        display: none;
    }

    .logo-card {
        width: 140px;
        flex-shrink: 0;
        padding: 16px 10px;
        border-radius: 12px;
    }

    .logo-img {
        width: 52px;
        height: 52px;
    }

    .logo-name {
        font-size: 12px;
    }

    .logo-industry {
        font-size: 10px;
    }

    /* Hero 修复 iOS 100vh 问题 */
    .hero {
        min-height: auto;
        padding-top: calc(var(--nav-height) + 24px);
        padding-bottom: 40px;
    }

    /* 隐藏桌面端鼠标滚轮提示 */
    .hero-scroll-hint {
        display: none;
    }

    .hero-title {
        font-size: 36px;
        line-height: 1.1;
    }

    .hero-subtitle {
        font-size: 15px;
        margin-bottom: 28px;
    }

    /* 统计数据：竖排 */
    .hero-stats {
        flex-direction: column;
        gap: 16px;
        margin-top: 28px;
    }

    .stat-divider {
        width: 48px;
        height: 1px;
        margin: 2px 0;
    }

    .stat-number {
        font-size: 32px;
    }

    .stat-suffix {
        font-size: 18px;
    }

    .stat-label {
        font-size: 12px;
    }

    /* 间距压缩 */
    .section {
        padding: 56px 0;
    }

    .section-header {
        margin-bottom: 40px;
    }

    .section-tag {
        font-size: 12px;
        margin-bottom: 10px;
    }

    .section-title {
        font-size: 26px;
        margin-bottom: 10px;
    }

    .section-desc {
        font-size: 14px;
        white-space: normal;
    }

    /* 服务卡片 */
    .services-grid {
        gap: 12px;
    }

    .service-card {
        padding: 24px 20px;
        border-radius: 14px;
    }

    .service-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 14px;
    }

    .service-title {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .service-desc {
        font-size: 13px;
        margin-bottom: 14px;
    }

    .service-features li {
        font-size: 12px;
    }

    /* 优势区 */
    .advantage-item {
        padding: 28px 20px;
        border-radius: 10px;
    }

    .advantage-number {
        font-size: 12px;
        margin-bottom: 10px;
    }

    .advantage-title {
        font-size: 19px;
        margin-bottom: 8px;
    }

    .advantage-desc {
        font-size: 13px;
    }

    /* 合作伙伴 */
    .partners-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        max-width: 100%;
    }

    .partner-card {
        padding: 20px 14px;
    }

    .partner-name {
        font-size: 15px;
    }

    .partner-desc {
        font-size: 11px;
    }

    /* CTA */
    .cta-section {
        padding: 56px 0;
    }

    .cta-title {
        font-size: 28px;
    }

    .cta-desc {
        font-size: 14px;
        margin-bottom: 28px;
    }

    .cta-links {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin-bottom: 24px;
    }

    /* 表单 */
    .form-input,
    .form-textarea {
        font-size: 16px;
        padding: 14px 14px;
        border-radius: 12px;
    }

    .btn-large {
        padding: 16px 32px;
        font-size: 17px;
    }

    /* 关于我们 */
    .about-paragraph {
        font-size: 14px;
        line-height: 1.7;
    }

    .about-stats {
        gap: 16px;
        padding: 20px 0;
    }

    .about-stat-number {
        font-size: 24px;
    }

    .about-stat-label {
        font-size: 12px;
    }

    .about-stat-divider {
        height: 36px;
    }

    /* Footer */
    .footer {
        padding: 40px 0 24px;
    }

    .footer-grid {
        gap: 28px;
    }

    .footer-title {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .footer-links a,
    .footer-links > li {
        font-size: 13px;
    }

    .footer-desc {
        font-size: 13px;
    }

    .footer-bottom p {
        font-size: 11px;
    }

    /* 回到顶部按钮 */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }

    /* 成功提示 */
    .cta-success {
        padding: 32px 16px;
        margin-top: 12px;
    }

    .success-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
        margin-bottom: 16px;
    }

    .success-title {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .success-desc {
        font-size: 14px;
    }

    /* 二维码区块 */
    .cta-qr-section {
        margin-top: 40px;
        padding-top: 32px;
    }

    .cta-qr-title {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .cta-qr-card {
        padding: 12px;
        border-radius: 12px;
    }

    .cta-qr-img {
        width: 180px;
    }

    .cta-qr-hint {
        font-size: 12px;
        margin-top: 12px;
    }
}

/* ---------- 481px ~ 768px ---------- */
@media (min-width: 481px) and (max-width: 768px) {

    .logo-grid {
        overflow: hidden;
        width: 100%;
    }

    .logo-row {
        flex-wrap: nowrap;
        gap: 18px;
        max-width: none;
        padding: 0 8px;
        overflow-x: scroll;
        overflow-y: hidden;
        width: 100%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        touch-action: pan-x;
    }

    .logo-row::-webkit-scrollbar {
        display: none;
    }

    .logo-card {
        width: 160px;
        flex-shrink: 0;
        padding: 18px 14px;
    }

    .logo-img {
        width: 64px;
        height: 64px;
    }

    .logo-name {
        font-size: 13px;
    }

    .logo-industry {
        font-size: 11px;
    }

    .hero {
        min-height: auto;
        padding-top: calc(var(--nav-height) + 32px);
        padding-bottom: 48px;
    }

    .hero-scroll-hint {
        display: none;
    }

    .hero-title {
        font-size: 42px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .hero-stats {
        gap: 24px;
        margin-top: 32px;
    }

    .stat-number {
        font-size: 36px;
    }

    .stat-suffix {
        font-size: 20px;
    }

    .section {
        padding: 72px 0;
    }

    .section-header {
        margin-bottom: 48px;
    }

    .section-title {
        font-size: 30px;
    }

    .section-desc {
        white-space: normal;
    }

    .services-grid {
        gap: 14px;
    }

    .service-card {
        padding: 28px 24px;
    }

    .service-icon {
        width: 52px;
        height: 52px;
    }

    .service-title {
        font-size: 19px;
    }

    .advantage-item {
        padding: 32px 24px;
    }

    .advantage-title {
        font-size: 20px;
    }

    .partners-grid {
        gap: 12px;
    }

    .partner-card {
        padding: 24px 18px;
    }

    .cta-section {
        padding: 72px 0;
    }

    .cta-title {
        font-size: 32px;
    }

    .cta-desc {
        font-size: 15px;
        margin-bottom: 36px;
    }

    .cta-links {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin-bottom: 28px;
    }

    .about-stats {
        gap: 20px;
    }

    .about-stat-number {
        font-size: 28px;
    }

    .footer {
        padding: 48px 0 28px;
    }

    .footer-grid {
        gap: 32px;
    }

    .footer-title {
        font-size: 12px;
    }

    .footer-links a,
    .footer-links > li {
        font-size: 13px;
    }

    .cta-success {
        padding: 36px 16px;
        margin-top: 16px;
    }

    .success-icon {
        width: 60px;
        height: 60px;
        font-size: 30px;
        margin-bottom: 18px;
    }

    .success-title {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .success-desc {
        font-size: 15px;
    }

    .cta-qr-section {
        margin-top: 44px;
        padding-top: 36px;
    }

    .cta-qr-title {
        font-size: 15px;
        margin-bottom: 18px;
    }

    .cta-qr-card {
        padding: 14px;
        border-radius: 14px;
    }

    .cta-qr-img {
        width: 190px;
    }

    .cta-qr-hint {
        font-size: 12px;
        margin-top: 14px;
    }
}

/* ---------- 通用移动端优化（所有屏幕） ---------- */

/* 触摸友好的最小点击区域 48px */
.nav-links a,
.mobile-nav-links a,
.footer-links a {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
}

/* ========== 移动端菜单专项优化 ========== */
@media (max-width: 768px) {
    .nav-toggle {
        width: 44px;
        height: 44px;
        padding: 10px;
    }

    .mobile-nav-links {
        padding: 16px;
        gap: 6px;
    }

    .mobile-nav-links a {
        font-size: 17px;
        min-height: 54px;
        padding: 14px 18px;
    }

    .mobile-nav-cta {
        margin: 12px 16px;
        padding: 16px;
        font-size: 17px;
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ========== 服务端/客户端按钮触摸优化 ========== */
@media (max-width: 768px) {
    .cta-link-btn {
        min-height: 52px;
        padding: 16px 24px !important;
        font-size: 17px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 10px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        user-select: none;
    }

    .cta-link-btn:active {
        transform: scale(0.97);
        opacity: 0.85;
    }

    .cta-link-btn svg {
        pointer-events: none;
        flex-shrink: 0;
    }

    .form-input,
    .form-textarea {
        min-height: 48px;
        font-size: 16px;
    }

    .btn-large {
        min-height: 52px;
        font-size: 17px;
    }
}

/* 禁用桌面端 hover 效果在触屏设备上的伪交互 */
@media (hover: none) and (pointer: coarse) {
    .service-card:hover,
    .partner-card:hover,
    .logo-card:hover,
    .advantage-item:hover,
    .cta-link-btn:hover {
        transform: none;
    }

    .partner-card::after,
    .advantage-item::after,
    .logo-card::after {
        display: none;
    }
}

@supports (padding: max(0px)) {
    .nav {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .hero-content {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }

    .container {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }

    .footer {
        padding-bottom: max(32px, env(safe-area-inset-bottom));
    }
}

/* ---------- AI Chat Widget Mobile ---------- */

/* --- 480px 以下（小屏手机） --- */
@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100vw - 16px);
        height: calc(100dvh - 80px);
        bottom: 8px;
        right: 8px;
        left: 8px;
        border-radius: var(--radius-md);
        transition: height 0.3s ease, bottom 0.3s ease, opacity 0.3s ease;
        will-change: height, bottom;
    }

    .ai-chat-window.open {
        transform: translateY(0) scale(1);
    }

    .ai-chat-header {
        padding: 16px 16px 14px;
    }

    .ai-chat-header-icon {
        width: 32px;
        height: 32px;
    }

    .ai-chat-header-text h3 {
        font-size: 15px;
    }

    .ai-chat-header-text p {
        font-size: 11px;
    }

    .ai-chat-status {
        display: none;
    }

    .ai-chat-new-btn {
        width: 36px;
        height: 36px;
    }

    .ai-chat-new-btn svg {
        width: 16px;
        height: 16px;
    }

    .ai-chat-messages {
        padding: 16px;
    }

    .ai-message {
        margin-bottom: 12px;
    }

    .ai-message-avatar {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .ai-message.user .ai-message-bubble {
        max-width: calc(100% - 40px);
    }

    .ai-message.assistant .ai-message-bubble {
        max-width: calc(100% - 40px);
    }

    .ai-chat-input-area {
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .ai-chat-input-row {
        gap: 8px;
    }

    .ai-chat-input {
        font-size: 16px;
        padding: 12px 14px;
        min-height: 44px;
    }

    .ai-chat-send {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .ai-chat-new-btn {
        flex-shrink: 0;
    }

    .ai-chat-footer {
        padding: 4px 12px 8px;
        font-size: 10px;
    }

    .ai-chat-toggle {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .ai-chat-toggle svg {
        width: 26px;
        height: 26px;
    }
}

/* --- 481px ~ 768px（平板/大屏手机） --- */
@media (min-width: 481px) and (max-width: 768px) {
    .ai-chat-window {
        width: calc(100vw - 32px);
        height: calc(100dvh - 100px);
        max-height: 600px;
        bottom: 16px;
        right: 16px;
        left: auto;
        transition: height 0.3s ease, bottom 0.3s ease;
    }

    .ai-chat-header {
        padding: 16px 18px;
    }

    .ai-chat-messages {
        padding: 18px;
    }

    .ai-chat-input-area {
        padding: 14px 16px;
    }

    .ai-chat-input {
        font-size: 16px;
    }

    .ai-chat-send {
        width: 44px;
        height: 44px;
    }

    .ai-chat-new-btn {
        width: 44px;
        height: 44px;
    }

    .ai-chat-footer {
        font-size: 11px;
    }

    .ai-chat-toggle {
        bottom: 24px;
        right: 24px;
        width: 52px;
        height: 52px;
    }

    .ai-chat-toggle svg {
        width: 24px;
        height: 24px;
    }
}

/* --- 通用移动端触摸优化 --- */
@media (hover: none) and (pointer: coarse) {
    .ai-chat-toggle,
    .ai-chat-send,
    .ai-chat-new-btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        user-select: none;
    }

    .ai-chat-send svg,
    .ai-chat-new-btn svg {
        pointer-events: none;
    }

    .ai-chat-messages {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    .ai-chat-messages::-webkit-scrollbar {
        width: 3px;
    }

    .ai-code-block {
        font-size: 12px;
        padding: 10px 12px;
        margin: 6px -4px;
        border-radius: 6px;
    }

    .ai-code-inline {
        font-size: 12px;
        padding: 1px 4px;
    }
}
