/* Analytics System Styles */
.analytics-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(0, 255, 136, 0.2);
    border: 1px solid #00ff88;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #00ff88;
    margin-left: 10px;
    animation: pulse 2s infinite;
}

.analytics-live-badge .live-dot {
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.2);
    }
}

/* Analytics Cards Enhancement */
.analytics-card {
    position: relative;
    overflow: hidden;
}

.analytics-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.6s;
}

.analytics-card.live-updating::before {
    left: 100%;
}

/* Compact Trend Items */
.trend-item-compact {
    position: relative;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, rgba(30, 30, 60, 0.9), rgba(20, 20, 40, 0.9));
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 15px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.trend-item-compact:hover {
    transform: translateY(-2px);
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
    background: linear-gradient(135deg, rgba(40, 40, 70, 0.9), rgba(25, 25, 45, 0.9));
}

.trend-item-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.trend-rank-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
}

.trend-rank {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    color: white;
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.trend-rank.rank-1 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.3);
}

.trend-rank.rank-2 {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
    box-shadow: 0 3px 10px rgba(192, 192, 192, 0.3);
}

.trend-rank.rank-3 {
    background: linear-gradient(135deg, #CD7F32, #A0522D);
    box-shadow: 0 3px 10px rgba(205, 127, 50, 0.3);
}

.trend-trophy {
    margin-top: 4px;
    font-size: 1.2rem;
}

.trend-main-info {
    flex: 1;
    min-width: 0;
}

.trend-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.trend-title {
    font-size: 1rem;
    font-weight: 600;
    color: #e0e0ff;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trend-category-badge {
    padding: 3px 10px;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    font-size: 0.65rem;
    color: #667eea;
    white-space: nowrap;
}

.trend-description {
    color: #a0a0cc;
    font-size: 0.8rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trend-item-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 12px;
    margin-top: 12px;
}

.trend-stats-compact {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.trend-stat-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.stat-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 0.9rem;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 0.7rem;
    color: #a0a0cc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trend-source-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(96, 165, 250, 0.1);
    border-radius: 10px;
    font-size: 0.7rem;
    color: #60a5fa;
}

.trend-trending-indicator {
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.trend-trending-indicator.hot {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.4);
    animation: pulse-hot 2s infinite;
}

.trend-trending-indicator.rising {
    background: rgba(76, 175, 80, 0.2);
    color: #4ade80;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.trend-trending-indicator.stable {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.4);
}

@keyframes pulse-hot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Loading Skeletons */
.trend-item-skeleton {
    display: flex;
    gap: 12px;
    padding: 15px;
    margin-bottom: 12px;
    background: rgba(30, 30, 60, 0.5);
    border-radius: 12px;
    animation: skeleton-loading 1.5s infinite alternate;
}

.skeleton-rank {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.skeleton-content {
    flex: 1;
}

.skeleton-title {
    width: 70%;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-description {
    width: 90%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-stats {
    display: flex;
    gap: 15px;
}

.skeleton-stat {
    width: 60px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

@keyframes skeleton-loading {
    0% { opacity: 0.5; }
    100% { opacity: 0.8; }
}

/* No Trends/Error Messages */
.no-trends-message,
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #a0a0cc;
}

.no-trends-message i,
.error-message i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #667eea;
}

.error-message i {
    color: #f87171;
}

.message-title,
.error-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #e0e0ff;
}

.message-subtitle,
.error-subtitle {
    font-size: 0.9rem;
    max-width: 300px;
    line-height: 1.4;
}

/* Enhanced Sentiment Display */
.sentiment-item {
    padding: 12px;
    margin: 8px 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    background: rgba(30, 30, 60, 0.7);
}

.sentiment-item.positive {
    border-left: 4px solid #4ade80;
}

.sentiment-item.neutral {
    border-left: 4px solid #60a5fa;
}

.sentiment-item.negative {
    border-left: 4px solid #f87171;
}

.sentiment-item:hover {
    transform: translateX(5px);
    background: rgba(40, 40, 70, 0.9);
}

.sentiment-value {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 4px;
    color: #ffffff;
}

.sentiment-item.positive .sentiment-value {
    color: #4ade80;
}

.sentiment-item.neutral .sentiment-value {
    color: #60a5fa;
}

.sentiment-item.negative .sentiment-value {
    color: #f87171;
}

.sentiment-indicator {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.sentiment-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.sentiment-item.positive .sentiment-fill {
    background: linear-gradient(90deg, #4ade80, #22c55e);
}

.sentiment-item.neutral .sentiment-fill {
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.sentiment-item.negative .sentiment-fill {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

.dominant-sentiment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.1);
}

.sentiment-positive {
    background: rgba(76, 175, 80, 0.2);
    color: #4ade80;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.sentiment-neutral {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.4);
}

.sentiment-negative {
    background: rgba(244, 67, 54, 0.2);
    color: #f87171;
    border: 1px solid rgba(244, 67, 54, 0.4);
}

.sentiment-emoji {
    font-size: 1.2rem;
}

.sentiment-text {
    font-size: 0.9rem;
}

.sentiment-trend {
    font-size: 0.9rem;
    opacity: 0.8;
}

.sentiment-confidence,
.sentiment-sample {
    font-size: 0.75rem;
    color: #a0a0cc;
    margin-top: 5px;
    text-align: center;
}

/* Real-time Metrics */
.realtime-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.realtime-metric {
    text-align: center;
    padding: 12px 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.realtime-metric:hover {
    transform: translateY(-2px);
    background: rgba(102, 126, 234, 0.15);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.realtime-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #00ff88;
    margin-bottom: 5px;
}

.realtime-label {
    font-size: 0.75rem;
    color: #a0a0cc;
}

/* Update Timestamp */
.update-timestamp {
    font-size: 0.7rem;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
}

.update-timestamp::before {
    content: '↻';
    animation: spin 2s linear infinite;
}

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

/* Data Update Animation */
.data-updating {
    animation: highlightUpdate 1s ease;
}

@keyframes highlightUpdate {
    0%, 100% { 
        background-color: transparent; 
        transform: scale(1);
    }
    50% { 
        background-color: rgba(102, 126, 234, 0.1); 
        transform: scale(1.05);
    }
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .trend-stats-compact {
        flex-wrap: wrap;
    }
    
    .trend-stat-compact {
        min-width: calc(50% - 5px);
    }
}

@media (max-width: 768px) {
    .trend-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .trend-rank-wrapper {
        flex-direction: row;
        gap: 10px;
    }
    
    .trend-title {
        font-size: 0.95rem;
    }
    
    .trend-stats-compact {
        flex-direction: column;
        gap: 8px;
    }
    
    .trend-stat-compact {
        min-width: 100%;
    }
    
    .trend-source-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .realtime-metrics {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .trend-item-compact {
        padding: 12px;
    }
    
    .trend-description {
        font-size: 0.75rem;
        -webkit-line-clamp: 3;
    }
    
    .trend-category-badge {
        font-size: 0.6rem;
        padding: 2px 8px;
    }
}