/* PWA应用字体缩放控制 */

/* 基础字体缩放控制 */
html, body {
    -webkit-text-size-adjust: 100% !important;
    -ms-text-size-adjust: 100% !important;
    text-size-adjust: 95% !important;
}

/* PWA模式下的字体大小优化 */
@media (display-mode: standalone) {
    html {
        font-size: 16px !important; /* 增大基础字体到18px */
    }
    
    body {
        -webkit-text-size-adjust: none !important;
        -ms-text-size-adjust: none !important;
        text-size-adjust: none !important;
        /* PWA模式下的滚动优化 */
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* PWA模式下的容器滚动优化 */
    .container {
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        /* 确保底部有足够空间 */
        padding-bottom: var(--pwa-bottom-padding, 2rem) !important;
        margin-bottom: var(--pwa-bottom-padding, 2rem) !important;
    }
    
    /* PWA模式下的body优化 */
    body.pwa-mode {
        padding-bottom: var(--pwa-bottom-padding, 2rem) !important;
        min-height: calc(100vh + var(--pwa-bottom-padding, 2rem)) !important;
    }
    
    /* 针对性的字体缩放，避免影响布局元素 */
    p, span, div:not(.header):not(.container):not(.modal):not(.sidebar), 
    a, li, td, th, label {
        font-size: 1em !important;
    }
    
    /* 标题元素保持层次关系 */
    h1 { font-size: 1.5em !important; }
    h2 { font-size: 1.2em !important; }
    h3 { font-size: 1.1em !important; }
    h4 { font-size: 1em !important; }
    h5 { font-size: 0.9em !important; }
    h6 { font-size: 0.8em !important; }
    
    /* 表单元素和按钮 */
    button, input, select, textarea, .btn {
        font-size: 1em !important;
    }
    
    /* 导航和菜单元素 */
    .nav, .navbar, .menu, .nav-link {
        font-size: 1em !important;
    }
    
    /* 卡片和内容区域 */
    .card, .card-body, .content {
        font-size: 1em !important;
    }
    
    /* 小文本元素 */
    .small, small, .text-sm {
        font-size: 0.9em !important;
    }
    
    /* 大文本元素 */
    .lead, .text-lg {
        font-size: 1em !important;
    }
    
    /* 特定组件的字体调整 */
    .sidebar {
        font-size: 1em !important;
    }
    
    .header {
        font-size: 1em !important;
    }
    
    /* 视频相关元素 */
    .video-title {
        font-size: 1em !important;
    }
    
    .video-description {
        font-size: 0.9em !important;
    }
    
    /* 聊天相关元素 */
    .chat-message {
        font-size: 1em !important;
    }
    
    .chat-input {
        font-size: 1em !important;
    }
    
    /* 表格元素 */
    table, th, td {
        font-size: 1em !important;
    }
    
    /* 模态框和弹窗 */
    .modal, .modal-body, .modal-header {
        font-size: 1em !important;
    }
    
    /* 工具提示和提示信息 */
    .tooltip, .popover {
        font-size: 0.9em !important;
    }
    
    /* 面包屑导航 */
    .breadcrumb {
        font-size: 0.9em !important;
    }
    
    /* 分页组件 */
    .pagination {
        font-size: 1em !important;
    }
}

/* iOS Safari PWA特殊处理 */
@supports (-webkit-touch-callout: none) {
    @media (display-mode: standalone) {
        html {
            font-size: 16px !important; /* iOS下保持原始大小 */
        }
    }
}

/* 小屏幕设备下的额外缩放 */
@media (display-mode: standalone) and (max-width: 480px) {
    html {
        font-size: 15px !important; /* 小屏幕下轻微缩小 */
    }
    
    * {
        font-size: 0.8em !important;
    }
}