/* 
 * 移动端适配 - 微信风格
 */

/* 设备适配 */
@media screen and (max-width: 375px) {
    html { font-size: 15px; }
}

@media screen and (min-width: 414px) {
    html { font-size: 17px; }
}

@media screen and (min-width: 768px) {
    html { font-size: 16px; }
    
    .app-container {
        max-width: 420px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
        min-height: 100vh;
    }
    
    .header,
    .tab-bar,
    .chat-input-area {
        max-width: 420px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .modal-overlay {
        background: rgba(0, 0, 0, 0.4);
    }
}

/* 安全区域适配 */
@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        padding-top: env(safe-area-inset-top);
        height: calc(44px + env(safe-area-inset-top));
    }
    
    .main-content {
        padding-top: calc(44px + env(safe-area-inset-top));
    }
    
    .tab-bar {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(50px + env(safe-area-inset-bottom));
    }
    
    .chat-input-area {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
    
    .chat-messages {
        padding-bottom: calc(120px + env(safe-area-inset-bottom));
    }
}

/* 触摸优化 */
* {
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

input, textarea, select {
    -webkit-appearance: none;
    appearance: none;
}

/* 滚动优化 */
.scroll-container {
    -webkit-overflow-scrolling: touch;
}

/* 底部弹出层 */
.bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    visibility: hidden;
}

.bottom-sheet.show { visibility: visible; }

.bottom-sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.25s;
}

.bottom-sheet.show .bottom-sheet-overlay { opacity: 1; }

.bottom-sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
    transition: transform 0.25s ease-out;
    max-height: 80vh;
    overflow-y: auto;
}

.bottom-sheet.show .bottom-sheet-content {
    transform: translateY(0);
}

.bottom-sheet-header {
    padding: 16px;
    text-align: center;
    border-bottom: 0.5px solid var(--border-color);
}

.bottom-sheet-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-black);
}

.bottom-sheet-close {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-gray);
    background: none;
    border: none;
    cursor: pointer;
}

.bottom-sheet-body {
    padding: 16px;
}

/* 日期选择器样式 */
.datetime-picker {
    padding: 16px;
}

.datetime-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.datetime-select {
    flex: 1;
    height: 40px;
    border: 0.5px solid var(--border-color);
    border-radius: 6px;
    padding: 0 12px;
    font-size: 15px;
    color: var(--text-black);
    background: var(--bg-white);
}

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton 1.2s ease infinite;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 6px;
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-line.short { width: 50%; }
