/* 通用移动端响应式优化 */

/* 防止所有元素溢出屏幕 */
* {
    box-sizing: border-box;
    max-width: 100vw;
    word-wrap: break-word;
    word-break: break-word;
}

html, body {
    overflow-x: hidden;
}

/* 通用移动端适配规则 */
@media (max-width: 768px) {
    /* 强制所有内联flex元素在移动端换行 */
    [style*="display: flex"] {
        flex-wrap: wrap !important;
    }
    
    /* 所有容器最大宽度不超过屏幕 */
    .container, 
    .main-content,
    .panel,
    .post-card,
    .comment-form,
    .comment-item,
    .video-card {
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: hidden;
    }
    
    /* 图片自适应 */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* 按钮和输入框自适应 */
    button,
    input,
    textarea,
    select {
        max-width: 100% !important;
    }
    
    /* 导航栏优化 */
    .navbar {
        padding: 0 12px !important;
    }
    
    /* 表单优化 */
    .form-group {
        margin-bottom: 16px !important;
    }
    
    .form-input,
    .form-textarea {
        font-size: 16px !important; /* 防止iOS缩放 */
        padding: 12px !important;
    }
    
    /* 按钮组优化 */
    .btn-group,
    .actions,
    .post-actions,
    .comment-actions {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }
    
    /* 表格优化 */
    table {
        display: block;
        overflow-x: auto;
    }
    
    /* 文本优化 */
    h1 { font-size: 1.75rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.25rem !important; }
    p { font-size: 1rem !important; }
    
    /* 页脚图片链接（LOGO）优化 */
    #footerImageLinks {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px !important;
    }
    
    #footerImageLinks img {
        height: 45px !important;
        width: auto !important;
        max-width: calc(50% - 10px) !important;
        border: none !important;
    }
}

@media (max-width: 576px) {
    /* 更小屏幕的额外优化 */
    .navbar {
        height: 56px !important;
    }
    
    .logo {
        font-size: 1rem !important;
    }
    
    .logo img {
        width: 28px !important;
        height: 28px !important;
    }
    
    .container {
        padding: 16px 12px !important;
    }
    
    .page-title {
        font-size: 1.35rem !important;
        margin-bottom: 16px !important;
    }
    
    /* 按钮尺寸优化 */
    .btn-primary,
    .btn-secondary {
        padding: 10px 18px !important;
        font-size: 0.9rem !important;
    }
    
    /* 卡片内边距优化 */
    .post-card,
    .comment-item,
    .video-card {
        padding: 14px !important;
    }
}

/* 确保所有模态框在移动端正确显示 */
.modal-content {
    width: 95% !important;
    max-width: 380px !important;
    margin: 20px !important;
}

/* 防止长文本溢出 */
.long-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
