/* Modern View Counter Styles for News Website */

/* Base Counter Styles */
.aft-view-count {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0 8px;
}

/* Hide counter initially until loaded */
.aft-view-count-hidden {
    opacity: 0 !important;
    transition: opacity 0.3s ease-in-out;
}

/* Hide loading text completely */
.aft-view-loading:empty {
    min-width: 0;
    min-height: 0;
}

/* Prevent very long text from breaking layout */
.aft-view-loading:not(:empty) {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* CSS-based error text hiding - targets common error message patterns */
.aft-view-loading[data-error],
.aft-view-count[data-error] {
    display: none !important;
    visibility: hidden !important;
}

/* Style 1: Animated Counter with Pulse Effect */
.aft-view-count.style-pulse {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    padding: 4px 12px !important;
    border-radius: 20px !important;
    color: white !important;
    font-weight: 600 !important;
    animation: subtle-pulse 2s ease-in-out infinite;
    display: inline-flex !important;
}

.aft-view-count.style-pulse a,
.aft-view-count.style-pulse a:hover,
.aft-view-count.style-pulse a:visited {
    color: white !important;
    text-decoration: none !important;
}

@keyframes subtle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Style 2: Live Badge - Dark Red Rectangle */
.aft-view-count.style-live {
    background: #8B0000 !important; /* Dark red color */
    padding: 2px 10px !important; /* Reduced padding for compact height */
    border-radius: 0 !important; /* Rectangle shape - no rounded corners */
    color: white !important;
    position: relative !important;
    overflow: visible !important;
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid #660000 !important; /* Darker red border */
    font-size: 12px !important; /* Slightly smaller font for compactness */
    line-height: 1.2 !important; /* Tighter line height */
    height: 22px !important; /* Fixed compact height */
}

.aft-view-count.style-live a,
.aft-view-count.style-live a:hover,
.aft-view-count.style-live a:visited,
.aft-view-count.style-live a:focus {
    color: white !important;
    text-decoration: none !important;
}

.aft-view-count.style-live i.fa-eye {
    color: white !important;
    font-size: 11px !important; /* Smaller icon for compact design */
}

/* No shine effect - removed completely */

/* Live dot indicator */
.aft-view-count.style-live .live-dot {
    width: 6px !important;
    height: 6px !important;
    background: #fff !important;
    border-radius: 50% !important;
    display: inline-block !important;
    margin-right: 4px !important;
    animation: live-blink 1.5s infinite;
    flex-shrink: 0;
}

@keyframes live-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Style 3: Modern Gradient with Icon Animation */
.aft-view-count.style-gradient {
    background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%) !important;
    padding: 6px 14px !important;
    border-radius: 8px !important;
    color: white !important;
    font-weight: 500 !important;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3) !important;
    transition: all 0.3s ease;
    display: inline-flex !important;
}

.aft-view-count.style-gradient a,
.aft-view-count.style-gradient a:hover {
    color: white !important;
    text-decoration: none !important;
}

.aft-view-count.style-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4) !important;
}

.aft-view-count.style-gradient i {
    animation: eye-blink 3s infinite;
}

@keyframes eye-blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

/* Style 4: Trending/Fire Effect for High Views */
.aft-view-count.trending {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    padding: 6px 14px;
    border-radius: 20px;
    color: white !important;
    font-weight: bold;
    position: relative;
}

.aft-view-count.trending .fire-icon {
    display: inline-block;
    margin-right: 5px;
    animation: fire-dance 1s infinite alternate;
}

@keyframes fire-dance {
    0% { transform: scale(1) rotate(-5deg); }
    100% { transform: scale(1.1) rotate(5deg); }
}

/* Style 5: Minimal Clean Counter */
.aft-view-count.style-minimal {
    background: rgba(0, 0, 0, 0.05) !important;
    padding: 4px 10px !important;
    border-radius: 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #666 !important;
    transition: all 0.3s ease;
    display: inline-flex !important;
}

.aft-view-count.style-minimal a,
.aft-view-count.style-minimal a:hover {
    color: #666 !important;
    text-decoration: none !important;
}

.aft-view-count.style-minimal:hover {
    background: rgba(0, 0, 0, 0.1) !important;
    transform: scale(1.05);
}

/* Style 6: Neumorphic Design */
.aft-view-count.style-neumorphic {
    background: #e0e5ec !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    box-shadow: 6px 6px 12px #b8b9be, -6px -6px 12px #ffffff !important;
    font-weight: 600 !important;
    color: #666 !important;
    transition: all 0.3s ease;
    display: inline-flex !important;
}

.aft-view-count.style-neumorphic a,
.aft-view-count.style-neumorphic a:hover {
    color: #666 !important;
    text-decoration: none !important;
}

.aft-view-count.style-neumorphic:hover {
    box-shadow: inset 6px 6px 12px #b8b9be, inset -6px -6px 12px #ffffff !important;
}

/* Number Counter Animation */
.aft-view-count .count-number {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.aft-view-count .count-number.animating {
    animation: number-flip 0.6s ease-out;
}

@keyframes number-flip {
    0% {
        transform: rotateX(0deg);
        opacity: 1;
    }
    50% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

/* Milestone Celebration Effects */
.aft-view-count.milestone-reached {
    animation: celebrate 1s ease-out;
}

@keyframes celebrate {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(5deg); }
    50% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.15) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Milestone Badges */
.aft-view-count .milestone-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: gold;
    color: #333;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    animation: badge-pop 0.5s ease-out;
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Format for Large Numbers */
.aft-view-count .count-formatted {
    font-weight: 700;
}

.aft-view-count .count-suffix {
    font-size: 0.85em;
    font-weight: 500;
    margin-left: 2px;
    opacity: 0.9;
}

/* Live Viewers Animation */
.aft-view-count.live-viewers::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,71,87,0.3) 0%, transparent 70%);
    animation: pulse-wave 2s infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes pulse-wave {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* Dark Mode Support */
body.dark-mode .aft-view-count.style-minimal {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

body.dark-mode .aft-view-count.style-neumorphic {
    background: #2a2a2a;
    box-shadow: 6px 6px 12px #1a1a1a, -6px -6px 12px #3a3a3a;
    color: #fff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .aft-view-count {
        font-size: 12px;
        padding: 3px 8px;
    }

    .aft-view-count .milestone-badge {
        display: none;
    }
}