/* 滑雪教练约课平台 - 蓝色主题样式 */
:root {
    --primary-color: #1e88e5;
    --primary-dark: #1565c0;
    --primary-light: #64b5f6;
    --secondary-color: #e3f2fd;
    --accent-color: #bbdefb;
    --text-primary: #212121;
    --text-secondary: #757575;
    --bg-light: #f5f9ff;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --shadow: 0 2px 8px rgba(30, 136, 229, 0.15);
    --shadow-hover: 0 4px 16px rgba(30, 136, 229, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 雪花飘落效果 */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.snowflake {
    position: absolute;
    top: -10px;
    color: #fff;
    font-size: 1em;
    animation: fall linear infinite;
    opacity: 0.8;
    text-shadow: 0 0 5px rgba(30, 136, 229, 0.5);
}

@keyframes fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 0.8;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0.3;
    }
}

/* 头部导航 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
}

.nav-menu {
    display: flex;
    gap: 20px;
    list-style: none;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
}

.nav-menu a:hover, .nav-menu a.active {
    background: rgba(255, 255, 255, 0.2);
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 卡片样式 */
.card {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
    font-size: 18px;
    color: var(--primary-dark);
}

.card-body {
    padding: 20px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.4);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--primary-color);
}

.btn-secondary:hover {
    background: var(--accent-color);
}

.btn-block {
    display: block;
    width: 100%;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

/* 滑雪场卡片 */
.resort-card {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: all 0.3s;
}

.resort-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.resort-image {
    width: 200px;
    height: 150px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--secondary-color);
}

.resort-info {
    flex: 1;
}

.resort-name {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.resort-address {
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.resort-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-open {
    background: #e8f5e9;
    color: var(--success-color);
}

.status-closed {
    background: #ffebee;
    color: var(--danger-color);
}

/* 教练卡片 */
.coach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.coach-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s;
}

.coach-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.coach-avatar {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--secondary-color);
}

.coach-info {
    padding: 16px;
}

.coach-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--primary-dark);
}

.coach-skill {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.coach-price {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.coach-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
}

.stars {
    color: #ffc107;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 24px;
}

.nav-text {
    font-size: 12px;
}

/* 地图容器 */
.map-container {
    width: 100%;
    height: 400px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* 视频列表 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.video-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    aspect-ratio: 16/9;
    background: var(--secondary-color);
}

.video-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 订单列表 */
.order-item {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.order-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.order-sn {
    font-weight: bold;
    color: var(--primary-dark);
}

.order-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .resort-card {
        flex-direction: column;
    }
    
    .resort-image {
        width: 100%;
        height: 200px;
    }
    
    .coach-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-menu {
        display: none;
    }
    
    .container {
        padding: 10px;
    }
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--secondary-color);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 12px;
    margin-right: 8px;
    margin-bottom: 8px;
}

/* 评分 */
.rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rating-score {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--primary-dark);
}

/* 工具类 */
.text-center { text-align: center; }
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--text-secondary); }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.p-20 { padding: 20px; }

/* ==================== 流畅度优化 ==================== */

/* 全局点击反馈 - 消除300ms延迟 */
* {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 可点击元素的通用过渡效果 */
a, button, .clickable, 
.nav-item, .tag, .coach-card, .resort-card,
.conversation-item, .moment-item, .emoji-item,
.moment-action, .chat-back, .publish-btn,
.content-tab, .message-tab, .emoji-tab {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-user-select: none;
    user-select: none;
}

/* 点击缩放效果 */
a:active, button:active, .clickable:active,
.nav-item:active, .tag:active, .coach-card:active,
.resort-card:active, .conversation-item:active,
.moment-item:active, .emoji-item:active,
.moment-action:active, .publish-btn:active,
.chat-back:active, .chat-send:active, .emoji-btn:active {
    transform: scale(0.96);
    opacity: 0.85;
}

/* 卡片悬浮效果 */
.coach-card, .resort-card, .conversation-item, .moment-item {
    will-change: transform, box-shadow;
}

.coach-card:hover, .resort-card:hover, 
.conversation-item:hover, .moment-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* 按钮点击波纹效果 */
.btn, .chat-send, .publish-btn, .btn-follow, .btn-message {
    position: relative;
    overflow: hidden;
}

.btn::after, .chat-send::after, .publish-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:active::after, .chat-send:active::after, .publish-btn:active::after {
    width: 200px;
    height: 200px;
}

/* 页面切换淡入效果 */
.container {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 聊天界面滑入效果 */
.chat-container {
    animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 消息气泡出现动画 */
.chat-message {
    animation: messageIn 0.2s ease-out;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 表情包弹出动画 */
.emoji-panel {
    animation: panelSlideUp 0.2s ease-out;
}

@keyframes panelSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.emoji-item {
    transition: transform 0.15s ease-out, background 0.15s ease-out;
}

.emoji-item:active {
    transform: scale(1.3) !important;
}

/* 底部导航切换动画 */
.bottom-nav {
    transition: transform 0.3s ease-out;
}

.nav-item {
    transition: transform 0.2s ease-out, color 0.2s ease-out;
}

.nav-item:active {
    transform: scale(0.9);
}

.nav-item.active .nav-icon {
    animation: navBounce 0.3s ease-out;
}

@keyframes navBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Tab切换动画 */
.content-tab, .message-tab {
    transition: all 0.25s ease-out;
}

.content-tab.active, .message-tab.active {
    animation: tabActive 0.3s ease-out;
}

@keyframes tabActive {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 图片懒加载淡入（不影响动态渲染的图片） */
img {
    transition: opacity 0.3s ease-out;
    opacity: 1;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* 加载状态脉冲动画 */
.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* 骨架屏效果 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 头像点击效果 */
.moment-item-avatar, .chat-message-avatar, .conversation-avatar,
.profile-avatar-large, .coach-avatar {
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.moment-item-avatar:active, .chat-message-avatar:active,
.conversation-avatar:active, .profile-avatar-large:active,
.coach-avatar:active {
    transform: scale(0.92);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.3);
}

/* 评论区域点击效果 */
.moment-comment-user {
    transition: color 0.2s ease-out;
    cursor: pointer;
}

.moment-comment-user:active {
    color: var(--primary-dark);
}

/* 返回按钮旋转效果 */
.chat-back:active, .back-btn:active {
    transform: scale(0.9) rotate(-10deg);
}

/* 优化滚动性能 */
.chat-messages, .moment-list, #conversationList {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* 减少重绘 */
.chat-container, .emoji-panel, .publish-modal {
    will-change: opacity, transform;
}

/* 输入框聚焦效果 */
.chat-input, .form-control, input[type="text"], input[type="password"], textarea {
    transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

.chat-input:focus, .form-control:focus, 
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
    outline: none;
}

/* 点赞动画优化 */
.moment-action.liked .action-icon {
    animation: likeJump 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes likeJump {
    0% { transform: scale(1); }
    25% { transform: scale(1.4) rotate(-10deg); }
    50% { transform: scale(0.9) rotate(5deg); }
    75% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* 发布按钮呼吸效果 */
.publish-btn {
    animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { box-shadow: 0 4px 16px rgba(30, 136, 229, 0.4); }
    50% { box-shadow: 0 4px 24px rgba(30, 136, 229, 0.6); }
}

.publish-btn:active {
    animation: none;
    transform: scale(0.9);
}

/* 消息发送成功提示 */
.message-toast {
    animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    /* 加快移动端动画速度 */
    a, button, .clickable, .nav-item, .tag, .coach-card, 
    .resort-card, .conversation-item, .moment-item {
        transition-duration: 0.15s;
    }
    
    /* 减少移动端动画幅度 */
    a:active, button:active, .clickable:active {
        transform: scale(0.97);
    }
}

/* 减少动画偏好设置 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
