/**
 * 移动端通用样式
 * 用于网站所有页面的移动端适配
 */

/* ========================================
   移动端基础设置
   ======================================== */
@media screen and (max-width: 768px) {
    /* 禁止双击缩放 */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    /* 导航栏优化 */
    .navbar {
        padding: 0 15px !important;
        height: 56px !important;
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    .navbar .logo {
        font-size: 18px !important;
    }

    .navbar .logo img {
        height: 32px !important;
    }

    /* 汉堡菜单 */
    .navbar .menu-toggle {
        display: block !important;
        background: none;
        border: none;
        color: white;
        font-size: 24px;
        cursor: pointer;
        padding: 8px;
    }

    .navbar .nav-links,
    .navbar .nav-menu {
        display: none;
    }

    /* 移动端菜单 */
    .mobile-menu {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background: #1a1f2d;
        padding: 20px;
        z-index: 999;
        box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    }

    .mobile-menu.active {
        display: block;
    }

    .mobile-menu a {
        display: block;
        color: #fff;
        text-decoration: none;
        font-size: 16px;
        padding: 12px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .mobile-menu a:last-child {
        border-bottom: none;
    }

    /* 容器优化 */
    .container {
        margin-top: 80px !important;
        padding: 0 15px !important;
        max-width: 100% !important;
    }

    /* 页面区域优化 */
    .page-section {
        padding: 20px 15px !important;
        border-radius: 12px !important;
        margin-bottom: 15px !important;
    }

    .page-section h2 {
        font-size: 20px !important;
        margin-bottom: 20px !important;
    }

    /* 表单优化 */
    .form-group {
        margin-bottom: 18px;
    }

    .form-group label {
        font-size: 14px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 14px !important;
        font-size: 16px !important; /* 防止iOS自动缩放 */
    }

    /* 按钮优化 */
    .btn {
        width: 100% !important;
        margin: 5px 0 !important;
        padding: 14px 20px !important;
        font-size: 16px;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .btn-group .btn {
        margin: 0 !important;
    }

    /* 卡片优化 */
    .price-card {
        padding: 20px !important;
        border-radius: 12px !important;
    }

    .price-card .price {
        font-size: 32px !important;
    }

    /* 列表优化 */
    .account-item,
    .order-item,
    .list-item {
        padding: 15px !important;
        margin-bottom: 12px !important;
        border-radius: 10px !important;
        flex-direction: column !important;
        gap: 10px;
    }

    .account-item .info,
    .order-item .info {
        flex: 1;
    }

    .account-item .actions,
    .order-item .actions {
        width: 100%;
        display: flex;
        gap: 8px;
        justify-content: flex-start;
    }

    /* 表格优化 - 转换为卡片 */
    table {
        display: none !important;
    }

    .table-mobile-view {
        display: block !important;
    }

    .mobile-table-row {
        background: white;
        padding: 15px;
        margin-bottom: 12px;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        border-left: 3px solid #00d4aa;
    }

    .mobile-table-row .cell {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid #f0f0f0;
        font-size: 14px;
    }

    .mobile-table-row .cell:last-child {
        border-bottom: none;
    }

    .mobile-table-row .cell-label {
        color: #64748b;
        font-weight: 500;
    }

    .mobile-table-row .cell-value {
        color: #1a1f2d;
        font-weight: 600;
        text-align: right;
    }

    /* 标签页优化 */
    .tabs {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        margin-bottom: 20px;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        flex-shrink: 0;
        padding: 10px 20px;
        background: #f8f9fa;
        border-radius: 8px;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.3s;
        white-space: nowrap;
    }

    .tab.active {
        background: #00d4aa;
        color: white;
    }

    /* 模态框优化 */
    .modal {
        max-width: 90% !important;
        margin: 50px auto !important;
        padding: 20px !important;
    }

    /* 警告和提示 */
    .alert,
    .message {
        padding: 12px 15px !important;
        font-size: 14px !important;
        margin-bottom: 15px !important;
        border-radius: 8px !important;
    }

    /* 底部操作栏 */
    .mobile-bottom-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 999;
        padding: 10px 15px;
        justify-content: space-around;
    }

    .mobile-bottom-bar .btn {
        flex: 1;
        margin: 0 5px !important;
        padding: 12px !important;
    }

    /* 统计卡片 */
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .stat-card {
        padding: 15px !important;
        border-radius: 10px !important;
    }

    .stat-card .value {
        font-size: 24px !important;
    }

    .stat-card .label {
        font-size: 12px !important;
    }

    /* 图片和二维码 */
    .qr-image {
        max-width: 150px !important;
        height: auto !important;
    }

    .logo-image {
        max-height: 40px !important;
    }

    /* 空状态 */
    .empty-state {
        padding: 40px 20px;
        text-align: center;
        color: #64748b;
    }

    .empty-state .icon {
        font-size: 48px;
        margin-bottom: 15px;
    }

    /* 分页 */
    .pagination {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .pagination button,
    .pagination a {
        padding: 8px 12px;
        font-size: 14px;
    }

    /* 加载动画 */
    .loading {
        padding: 40px;
        text-align: center;
    }

    /* 布局调整 */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* 面板折叠 */
    .collapsible-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        background: #f8f9fa;
        border-radius: 8px;
        cursor: pointer;
        font-weight: 600;
    }

    .collapsible-content {
        display: none;
        padding: 15px;
        margin-top: 10px;
    }

    .collapsible-content.open {
        display: block;
    }

    /* 隐藏桌面端元素 */
    .desktop-only {
        display: none !important;
    }

    /* 显示移动端元素 */
    .mobile-only {
        display: block !important;
    }

    /* 拨号链接样式 */
    a[href^="tel:"] {
        color: #00d4aa;
        text-decoration: none;
        font-weight: 600;
    }

    /* 底部留白(为固定操作栏) */
    .content-with-bottom-bar {
        padding-bottom: 70px;
    }
}

/* 桌面端样式 */
@media screen and (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }

    .mobile-menu {
        display: none !important;
    }

    .navbar .menu-toggle {
        display: none !important;
    }

    .mobile-bottom-bar {
        display: none !important;
    }

    .table-mobile-view {
        display: none !important;
    }
}

/* 移动端横屏优化 */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .navbar {
        height: 48px !important;
    }

    .mobile-menu {
        top: 48px !important;
    }

    .container {
        margin-top: 70px !important;
    }

    .hero {
        padding: 30px 20px !important;
    }

    .hero h1 {
        font-size: 22px !important;
    }
}

/* 超小屏幕优化 */
@media screen and (max-width: 375px) {
    .navbar .logo {
        font-size: 16px !important;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .mobile-table-row .cell {
        font-size: 13px;
    }
}

/* iOS Safari优化 */
@supports (-webkit-touch-callout: none) {
    .btn {
        -webkit-appearance: none;
    }
}

/* Dark模式支持 */
@media (prefers-color-scheme: dark) {
    @media screen and (max-width: 768px) {
        body {
            background: #1a1f2d;
            color: #e2e8f0;
        }

        .page-section,
        .price-card,
        .mobile-table-row {
            background: #2d3748;
            border-color: #4a5568;
        }

        .form-group input,
        .form-group select {
            background: #2d3748;
            border-color: #4a5568;
            color: #e2e8f0;
        }

        .tab {
            background: #2d3748;
            color: #e2e8f0;
        }
    }
}
