/* 主要布局样式 */

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* iOS Safari 视口修复 */
    height: calc(var(--vh, 1vh) * 100);
    min-height: -webkit-fill-available;
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 4px 16px rgba(0, 0, 0, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    /* iOS 安全区域支持 */
    padding-top: var(--safe-area-inset-top);
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
}



/* 主体区域 */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 消息列表区域 */
.message-list {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    scroll-behavior: smooth;
}

.message-list::-webkit-scrollbar {
    width: 6px;
}

.message-list::-webkit-scrollbar-track {
    background: transparent;
}

.message-list::-webkit-scrollbar-thumb {
    background: rgba(7, 193, 96, 0.3);
    border-radius: 3px;
}

.message-list::-webkit-scrollbar-thumb:hover {
    background: rgba(7, 193, 96, 0.5);
}

/* 输入区域 - 微信移动端风格 + iOS 修复 */
.input-container {
    border-top: 1px solid #e7e7e7;
    padding: 8px 12px;
    background-color: #f7f7f7;
    position: sticky;
    bottom: 0;
    z-index: 100;
    min-height: 56px;
    display: flex;
    align-items: center;
    /* iOS Safari 底部固定修复 */
    padding-bottom: calc(8px + var(--safe-area-inset-bottom));
    /* 确保在iOS上始终可见 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* iOS虚拟键盘适配 */
    transition: transform 0.3s ease;
}



/* 加载和空状态 */
.loading {
    text-align: center;
    color: #07c160;
    padding: 3rem 2rem;
    font-size: 1.1rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-spinner {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.empty-icon {
    font-size: 4rem;
    opacity: 0.6;
    background: linear-gradient(135deg, #07c160, #00d4aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(7, 193, 96, 0.2));
}

.empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes float {
    from {
        transform: translateX(-100px);
    }
    to {
        transform: translateX(calc(100vw + 100px));
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.fade-in {
    animation: fadeIn 0.1s ease-out;
}

/* 优化消息列表性能 */
.message-list {
    will-change: scroll-position;
    contain: layout style paint;
}

.message {
    will-change: transform, opacity;
    contain: layout style paint;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}
