/**
 * 移动端增强样式
 * 针对特定元素的优化
 */

/* ========================
   导航栏优化
   ======================== */
@media (max-width: 768px) {
    /* 顶部信息栏在移动端隐藏 */
    .top-bar {
        display: none;
    }
    
    /* 导航栏样式优化 */
    .navbar {
        background: white;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        padding: 10px 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
    }
    
    .navbar .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .navbar-brand {
        display: flex;
        align-items: center;
    }
    
    .navbar-brand img {
        height: 40px;
        width: auto;
    }
    
    /* 主内容区顶部间距 */
    .main-content {
        padding-top: 60px;
    }
    
    /* 导航菜单样式 */
    .navbar-menu ul {
        margin: 0;
        padding: 0;
        list-style: none;
    }
    
    .navbar-menu .nav-item {
        border-bottom: 1px solid #eee;
    }
    
    .navbar-menu .nav-link {
        color: var(--text-primary);
        padding: 15px 20px;
        display: block;
        text-decoration: none;
        transition: background-color 0.3s;
    }
    
    .navbar-menu .nav-link:hover,
    .navbar-menu .nav-item.active .nav-link {
        background-color: var(--primary-bg);
        color: var(--primary-color);
    }
    
    /* 下拉菜单 */
    .navbar-menu .dropdown-menu {
        position: static;
        float: none;
        width: 100%;
        margin: 0;
        background-color: #f8f9fa;
        border: none;
        box-shadow: none;
        display: none;
    }
    
    .navbar-menu .dropdown.show .dropdown-menu {
        display: block;
    }
    
    .navbar-menu .dropdown-item {
        padding: 10px 30px;
        border-bottom: 1px solid #e9ecef;
    }
}

/* ========================
   表格响应式
   ======================== */
@media (max-width: 768px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    .table td,
    .table th {
        padding: 8px;
        font-size: 13px;
    }
}

/* ========================
   卡片组件优化
   ======================== */
@media (max-width: 768px) {
    .card {
        margin-bottom: 20px;
        border-radius: 8px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .card-title {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .card-text {
        font-size: 14px;
    }
    
    /* 服务卡片 */
    .service-card {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        transition: transform 0.3s;
    }
    
    .service-card:active {
        transform: scale(0.98);
    }
}

/* ========================
   图片优化
   ======================== */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 轮播图图片 */
    .swiper-slide img {
        width: 100%;
        height: auto;
        object-fit: cover;
    }
    
    /* 新闻图片 */
    .news-card-image img {
        width: 100%;
        height: 180px;
        object-fit: cover;
    }
    
    /* 服务图片 */
    .service-image {
        width: 100%;
        height: 200px;
        object-fit: cover;
    }
}

/* ========================
   表单优化
   ======================== */
@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 12px 15px;
    }
    
    .form-label {
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    .btn {
        font-size: 16px;
        padding: 12px 24px;
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 4px !important;
        margin-bottom: 10px;
    }
}

/* ========================
   文本优化
   ======================== */
@media (max-width: 768px) {
    /* 标题大小调整 */
    h1 { font-size: 28px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
    h4 { font-size: 18px; }
    h5 { font-size: 16px; }
    h6 { font-size: 14px; }
    
    /* 段落间距 */
    p {
        line-height: 1.6;
        margin-bottom: 15px;
    }
    
    /* 列表样式 */
    ul, ol {
        padding-left: 20px;
    }
    
    li {
        margin-bottom: 8px;
    }
}

/* ========================
   间距调整
   ======================== */
@media (max-width: 768px) {
    /* 区块内边距 */
    .section {
        padding: 40px 0;
    }
    
    /* 容器内边距 */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* 行间距 */
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .row > * {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* ========================
   工具类
   ======================== */
@media (max-width: 768px) {
    /* 文本对齐 */
    .text-sm-center { text-align: center !important; }
    .text-sm-left { text-align: left !important; }
    .text-sm-right { text-align: right !important; }
    
    /* 显示隐藏 */
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-inline { display: inline !important; }
    .d-sm-inline-block { display: inline-block !important; }
    
    /* 间距 */
    .mb-sm-3 { margin-bottom: 1rem !important; }
    .mt-sm-3 { margin-top: 1rem !important; }
    .pb-sm-3 { padding-bottom: 1rem !important; }
    .pt-sm-3 { padding-top: 1rem !important; }
}

/* ========================
   动画优化
   ======================== */
@media (max-width: 768px) {
    /* 禁用复杂动画 */
    .wow {
        animation: none !important;
        visibility: visible !important;
    }
    
    /* 简化过渡效果 */
    * {
        transition-duration: 0.2s !important;
    }
}

/* ========================
   触摸优化
   ======================== */
@media (hover: none) and (pointer: coarse) {
    /* 增大可点击区域 */
    a, button, .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 移除悬停效果 */
    a:hover,
    button:hover,
    .btn:hover {
        opacity: 1;
    }
    
    /* 点击反馈 */
    a:active,
    button:active,
    .btn:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* ========================
   横屏适配
   ======================== */
@media (max-width: 768px) and (orientation: landscape) {
    /* 减小顶部高度 */
    .navbar {
        padding: 5px 0;
    }
    
    .navbar-brand img {
        height: 30px;
    }
    
    /* 减小banner高度 */
    .page-banner {
        padding: 40px 0 !important;
    }
    
    .hero-slide {
        height: 200px;
    }
    
    /* 隐藏次要元素 */
    .top-bar,
    .breadcrumb,
    .page-meta {
        display: none;
    }
}

/* ========================
   深色模式支持（可选）
   ======================== */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    /* 根据需要添加深色模式样式 */
}

/* ========================
   性能优化
   ======================== */
@media (max-width: 768px) {
    /* 使用GPU加速 */
    .navbar,
    .mobile-menu-overlay,
    .back-to-top {
        transform: translateZ(0);
        will-change: transform;
    }
    
    /* 优化滚动性能 */
    .navbar-menu {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
}
