/* 🚀 高性能自定义样式文件 - 与Tailwind CSS配合使用 */
/* 只保留Tailwind CSS无法实现或需要特殊处理的样式 */

/* 🔧 性能优化基础样式 */
* {
    box-sizing: border-box;
}

html {
    /* 启用硬件加速 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* 优化字体渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 优化滚动性能 */
    scroll-behavior: smooth;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
    /* 优化重绘性能 */
    will-change: scroll-position;
}

/* 📱 移动端布局优化 */
@media (max-width: 767px) {
    /* 移动端容器优化 */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 移动端卡片间距优化 */
    .card-container {
        margin-bottom: 1.5rem;
    }
    
    /* 移动端按钮优化 */
    .btn-mobile {
        min-height: 44px; /* iOS推荐的最小触摸区域 */
        padding: 0.75rem 1.5rem;
    }
}

/* 🎯 Google One Tap 移动端定位 - 让Google自己选择最佳位置 */
@media (max-width: 767px) {
    [data-gsi-one-tap-container] {
        /* 移除强制定位，让Google One Tap使用默认定位逻辑 */
        z-index: 10000 !important;
        max-width: calc(100vw - 40px) !important;
    }
}

/* 🎯 Google One Tap 桌面端定位 - 默认位置（让Google自己选择最佳位置） */
@media (min-width: 768px) {
    [data-gsi-one-tap-container] {
        /* 让Google One Tap使用默认定位，通常会出现在页面右上角或登录按钮附近 */
        z-index: 10000 !important;
        max-width: 400px !important;
    }
}

/* 渐变背景 - Tailwind无法实现复杂的三色渐变 */
.disney-gradient {
    background: linear-gradient(135deg, #00a8e8 0%, #8a2be2 50%, #ff69b4 100%);
}

/* 上传区域特殊样式 */
.upload-area {
    border: 2px dashed #ccc;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #8a2be2;
    background-color: rgba(138, 43, 226, 0.05);
}

.drop-zone.drag-over {
    border-color: #3498db;
    background-color: rgba(52, 152, 219, 0.1);
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 滑动动画 */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* 🎯 登录模态框已完全使用Tailwind实现，无需额外CSS */

/* Toast通知样式 */
.toast {
    transition: all 0.3s ease;
}

.toast-warning {
    background-color: #faad14 !important;
    border-left: 4px solid #fa8c16;
}

.toast-error {
    background-color: #ff4d4f !important;
    border-left: 4px solid #cf1322;
}

.toast-success {
    background-color: #52c41a !important;
    border-left: 4px solid #389e0d;
}

/* 用户信息组件样式 - 复杂的组件样式保留 */
.user-info-container {
    position: relative;
    font-family: 'Google Sans', 'Roboto', sans-serif;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
    z-index: 10;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: #1a73e8;
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-points {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.user-points i {
    color: #f39c12;
    font-size: 10px;
}

/* 用户下拉菜单 - 重要：设置高z-index确保不被遮挡 */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 9999 !important; /* 确保下拉菜单在最上层 */
    display: none;
    /* 🚀 性能优化的动画效果 */
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(-10px);
    opacity: 0;
    /* 启用硬件加速 */
    will-change: transform, opacity;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* 显示状态的下拉菜单 */
.user-dropdown.show {
    display: block !important;
    transform: translateY(0);
    opacity: 1;
}



.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: #333;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* 积分相关特殊样式 */
.user-points.low-points {
    color: #ff4d4f !important;
    font-weight: 600;
}

.user-points.low-points i {
    color: #ff4d4f !important;
    animation: pulse 2s infinite;
}

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

/* 导航栏滚动效果 */
nav.scrolled {
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

/* 确保图片响应式 */
img {
    max-width: 100%;
    height: auto;
}

/* 移动端用户组件适配 */
@media (max-width: 768px) {
    .user-profile {
        padding: 4px 8px;
        gap: 6px;
    }
    
    .user-avatar {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .user-name {
        font-size: 12px;
    }
    
    .user-points {
        font-size: 10px;
    }
    
    .user-dropdown {
        min-width: 180px;
        right: -10px;
        z-index: 9999 !important; /* 移动端也确保高z-index */
    }
}

@media (max-width: 480px) {
    .user-profile {
        padding: 2px 4px;
        background: transparent;
        border: none;
    }
    
    .user-profile:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .user-dropdown {
        z-index: 9999 !important; /* 小屏幕也确保高z-index */
    }
}

/* 🚀 性能优化专用样式 */

/* 硬件加速动画元素 */
.animate-element {
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* 优化图片加载 */
img {
    /* 防止布局偏移 */
    max-width: 100%;
    height: auto;
    /* 优化解码 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 优化按钮交互 */
button, .btn {
    /* 触摸优化 */
    touch-action: manipulation;
    /* 防止双击缩放 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 优化滚动容器 */
.scroll-container {
    /* 启用GPU加速滚动 */
    -webkit-overflow-scrolling: touch;
    /* 优化滚动性能 */
    will-change: scroll-position;
}

/* 优化文本渲染 */
.optimized-text {
    /* 优化文本渲染 */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 预加载动画 */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

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

/* 性能监控指示器 */
.performance-indicator {
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10000;
    opacity: 0.7;
    pointer-events: none;
}

.performance-indicator.good { background: rgba(34, 197, 94, 0.8); }
.performance-indicator.warning { background: rgba(251, 191, 36, 0.8); }
.performance-indicator.poor { background: rgba(239, 68, 68, 0.8); }