/* ============================================
   紧凑型首页布局样式
   猫哥创作 | 2026-01-17
   ============================================ */

/* 市场网格 - 更紧凑 */
.markets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

/* 紧凑型市场卡片 */
.market-card, .compact-card, .featured-compact {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.market-card:hover, .compact-card:hover, .featured-compact:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

/* 卡片内容填充（封面图下方的内容） */
.compact-card .compact-header,
.featured-compact .compact-header {
    padding: 0.75rem 1rem 0.5rem;
}

.compact-card .compact-title,
.featured-compact .compact-title,
.compact-card .compact-stats,
.featured-compact .compact-stats,
.compact-card .compact-odds,
.featured-compact .compact-odds,
.compact-card .participants-avatars,
.featured-compact .participants-avatars,
.compact-card .compact-footer,
.featured-compact .compact-footer {
    padding-left: 1rem;
    padding-right: 1rem;
}

.compact-card .compact-title,
.featured-compact .compact-title {
    padding-top: 0.5rem;
    margin-bottom: 0.75rem;
}

.compact-card .compact-stats,
.featured-compact .compact-stats {
    margin-bottom: 0.75rem;
}

.compact-card .compact-odds,
.featured-compact .compact-odds {
    margin-bottom: 0.75rem;
}

.compact-card .participants-avatars,
.featured-compact .participants-avatars {
    margin-bottom: 0.75rem;
}

.compact-card .compact-footer,
.featured-compact .compact-footer {
    padding-bottom: 1rem;
    margin-top: auto;
}

/* 标题样式 */
h4.compact-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

/* 卡片头部 - 紧凑排列 */
.market-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.market-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.market-badges {
    display: flex;
    gap: 0.375rem;
}

.hot-badge {
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-radius: 6px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

.new-badge {
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border-radius: 6px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* 市场标题 - 更紧凑 */
.market-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

/* 市场统计 - 单行紧凑 */
.market-stats-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.625rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
}

.stat-item-compact {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-muted);
}

.stat-item-compact i {
    font-size: 0.875rem;
    opacity: 0.7;
}

.stat-value {
    font-weight: 600;
    color: var(--text);
}

.stat-value.highlight {
    color: var(--success);
}

/* 赔率显示 - 紧凑双列 */
.market-odds-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.odd-item-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.625rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    font-size: 0.8125rem;
}

.odd-item-compact.yes {
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.odd-item-compact.no {
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.odd-label {
    font-weight: 600;
}

.odd-label.yes {
    color: var(--success);
}

.odd-label.no {
    color: var(--danger);
}

.odd-value {
    font-weight: 700;
    font-size: 0.875rem;
}

/* 参与者头像区域 */
.participants-avatars {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.avatars-stack {
    display: flex;
    align-items: center;
    position: relative;
    height: 36px;
    min-width: 180px;
}

/* 参与者头像统一样式 */
.avatar-wrapper {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid white;
    background: var(--bg);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: visible;
}

/* 大户标识（金色边框） */
.avatar-wrapper.whale-user {
    border-color: #fbbf24;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.avatar-wrapper:hover {
    transform: translateY(-4px) scale(1.15);
    z-index: 100 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.avatar-wrapper.whale-user:hover {
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.participant-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* 大户钻石标识 */
.whale-indicator {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 0.625rem;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    line-height: 1;
    z-index: 2;
}

.more-avatars {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    color: white;
}

.participants-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.total-participants {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.total-participants i {
    font-size: 0.875rem;
}

.no-participants {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.5rem;
}

/* 参与者Tooltip */
.avatar-tooltip {
    position: fixed;
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 0.75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -100%) translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    min-width: 180px;
}

.avatar-tooltip.show {
    opacity: 1;
    transform: translate(-50%, -100%) translateY(-8px);
}

.tooltip-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.tooltip-header strong {
    color: var(--text);
    font-size: 0.875rem;
}

.whale-badge-tooltip {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1.5;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.3);
}

.tooltip-body {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.tooltip-row span {
    color: var(--text-muted);
}

.tooltip-row .value {
    color: var(--text);
    font-weight: 600;
}

/* 市场页脚 - 移除或精简 */
.market-footer-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.market-creator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.creator-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.market-end-time {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.market-end-time i {
    font-size: 0.875rem;
}

/* 分类筛选 - 横向滚动 */
.category-filter-compact {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-filter-compact::-webkit-scrollbar {
    display: none;
}

.category-btn-compact {
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.category-btn-compact:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.category-btn-compact.active {
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    border-color: transparent;
    color: white;
}

/* 庄家头像特殊样式 */
.creator-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.creator-avatar-wrapper {
    position: relative;
    width: 32px;
    height: 32px;
}

.creator-avatar-wrapper img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
    object-fit: cover;
}

.creator-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.75rem;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.creator-name {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text);
}

.creator-label {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    border-radius: 8px;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1.2;
}

.creator-mini:hover .creator-avatar-wrapper img {
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.6);
    transform: scale(1.05);
}

.creator-mini:hover .creator-badge {
    animation: crown-bounce 0.5s ease;
}

@keyframes crown-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.category-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .markets-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .market-card {
        padding: 0.875rem;
    }
    
    .market-stats-compact {
        font-size: 0.75rem;
    }
    
    .avatars-stack {
        min-width: 140px;
    }
}

@media (min-width: 1400px) {
    .markets-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

/* 动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

.market-card {
    animation: slideInUp 0.4s ease backwards;
}

.market-card:nth-child(1) { animation-delay: 0.05s; }
.market-card:nth-child(2) { animation-delay: 0.1s; }
.market-card:nth-child(3) { animation-delay: 0.15s; }
.market-card:nth-child(4) { animation-delay: 0.2s; }
.market-card:nth-child(5) { animation-delay: 0.25s; }
.market-card:nth-child(6) { animation-delay: 0.3s; }
