/**
 * Post View Tracking Styles
 */

/* View Count Badge */
.post-view-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    color: #6c757d;
    transition: all 0.3s ease;
}

.post-view-count i {
    font-size: 1rem;
}

.post-view-count.view-count-updated {
    animation: viewCountPulse 0.3s ease;
}

@keyframes viewCountPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        color: #0d6efd;
    }
}

/* Post Stats Bar */
.post-stats-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    border-top: 1px solid #dee2e6;
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.post-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-stat-item:hover {
    color: #0d6efd;
}

.post-stat-item i {
    font-size: 1rem;
}

/* View Viewers Button */
.view-viewers-btn,
.view-stats-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-viewers-btn:hover,
.view-stats-btn:hover {
    background: #f8f9fa;
    color: #0d6efd;
    border-color: #0d6efd;
}

.view-viewers-btn i,
.view-stats-btn i {
    font-size: 1rem;
}

/* Viewers Modal */
.viewer-item {
    transition: background-color 0.2s ease;
}

.viewer-item:hover {
    background-color: #f8f9fa;
}

.viewer-item:last-child {
    border-bottom: none !important;
}

.viewers-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Stats Chart */
.views-chart {
    width: 100%;
}

.chart-bar {
    width: 100%;
}

.chart-bar .progress {
    background-color: #e9ecef;
}

.chart-bar .progress-bar {
    transition: width 0.3s ease;
}

/* Post Card Integration */
.post-card[data-post-id] {
    position: relative;
}

/* Owner Badge (for posts with viewer access) */
.post-owner-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: #e7f3ff;
    color: #0d6efd;
    border-radius: 12px;
    font-weight: 500;
}

.post-owner-badge i {
    font-size: 0.875rem;
}

/* Loading States */
.post-views-loading {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #6c757d;
    font-size: 0.875rem;
}

.post-views-loading .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

/* Responsive Design */
@media (max-width: 576px) {
    .post-stats-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .view-viewers-btn,
    .view-stats-btn {
        font-size: 0.8125rem;
        padding: 0.2rem 0.5rem;
    }

    .viewers-list {
        max-height: 300px;
    }
}

/* Dark Mode Support (if applicable) */
@media (prefers-color-scheme: dark) {
    .post-view-count,
    .post-stat-item {
        color: #adb5bd;
    }

    .post-stats-bar {
        border-top-color: #495057;
    }

    .view-viewers-btn,
    .view-stats-btn {
        background: #343a40;
        border-color: #495057;
        color: #adb5bd;
    }

    .view-viewers-btn:hover,
    .view-stats-btn:hover {
        background: #495057;
        color: #0d6efd;
    }

    .viewer-item:hover {
        background-color: #343a40;
    }

    .chart-bar .progress {
        background-color: #343a40;
    }
}

/* Animation for new viewers appearing */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.viewer-item.new-viewer {
    animation: slideInRight 0.3s ease;
}

/* Tooltip for view count */
.post-view-count[title] {
    cursor: help;
}

/* Stats Summary Cards */
.stats-summary-card {
    padding: 1rem;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.stats-summary-card h3 {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.stats-summary-card p {
    margin: 0;
    opacity: 0.9;
}

/* Empty State */
.views-empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.views-empty-state i {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.views-empty-state p {
    color: #6c757d;
    margin: 0;
}
