/* blogzee-analytics.css - Complete Fixed Analytics Styling */

/* Reading Progress Bar */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: rgba(0, 0, 0, 0.1);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.reading-progress-bar.visible {
    opacity: 1;
}

.reading-progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-fill {
    height: 100%;
    width: 0%;
    transition: width 0.1s ease, background-color 0.3s ease;
    border-radius: 0 3px 3px 0;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
    border-radius: 0 3px 3px 0;
}

.progress-fill.scrolling-down {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.progress-fill.scrolling-up {
    background: linear-gradient(90deg, #f44336, #ff9800);
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
}

/* Featured Image Styling */
.post-featured-image {
    margin: 20px 0;
    text-align: center;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.post-featured-image .featured-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-featured-image:hover .featured-image {
    transform: scale(1.02);
}

/* FIXED: Enhanced Post Meta Analytics */
.post-meta-analytics-wrap {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.post-meta-wrap {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

/* CRITICAL: Base styling for all meta elements */
.post-meta-wrap > div {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
    opacity: 1 !important;
    transform: translateY(0) !important;
    visibility: visible !important;
    min-height: 36px;
    white-space: nowrap;
}

.post-meta-wrap > div:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.post-meta-wrap i {
    color: #ff6b35;
    font-size: 16px;
    flex-shrink: 0;
}

/* Author Info */
.byline {
    font-weight: 600;
    color: #333 !important;
    display: flex !important;
    align-items: center !important;
}

.byline img {
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.byline .author-name {
    color: #333 !important;
}

/* Date */
.post-date {
    display: flex !important;
    align-items: center !important;
    color: #666 !important;
}

.post-date i {
    color: #ff6b35 !important;
    margin-right: 8px;
}

.post-date span {
    color: #666 !important;
}

/* Reading Time */
.reading-time {
    display: flex !important;
    align-items: center !important;
    color: #666 !important;
}

.reading-time i {
    color: #ff6b35 !important;
    margin-right: 8px;
}

.reading-time span {
    color: #666 !important;
}

/* Comments Count */
.comments-count {
    display: flex !important;
    align-items: center !important;
    color: #666 !important;
}

.comments-count i {
    color: #ff6b35 !important;
    margin-right: 8px;
}

.comments-count span {
    color: #666 !important;
}

/* CRITICAL: Views Count - Forced Visibility */
.views-count {
    display: flex !important;
    align-items: center !important;
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    font-weight: 600 !important;
    transform: scale(1) !important;
    transition: all 0.3s ease !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: 80px !important;
    justify-content: center !important;
    border: none !important;
    position: relative !important;
    z-index: 10 !important;
}

.views-count:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

.views-count.animate-in {
    animation: bounceIn 0.8s ease !important;
}

.views-count i {
    color: white !important;
    font-size: 16px !important;
    margin-right: 5px !important;
}

.views-number {
    display: inline-block !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 14px !important;
    line-height: 1 !important;
}

/* Downloads Count - Forced Visibility */
.downloads-count {
    display: flex !important;
    align-items: center !important;
    background: linear-gradient(135deg, #ff6b35, #e55a2b) !important;
    color: white !important;
    font-weight: 600 !important;
    transform: scale(1) !important;
    transition: all 0.3s ease !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: 100px !important;
    justify-content: center !important;
    border: none !important;
    position: relative !important;
    z-index: 10 !important;
}

.downloads-count:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4) !important;
}

.downloads-count.animate-in {
    animation: bounceIn 0.8s ease !important;
}

.downloads-count i {
    color: white !important;
    font-size: 16px !important;
    margin-right: 5px !important;
}

.downloads-number {
    display: inline-block !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 14px !important;
    line-height: 1 !important;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Enhanced Reactions Section */
.post-reactions-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 15px;
}

.reactions-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Enhanced Reaction Button States */
.reaction-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid #e0e0e0 !important;
    background: white !important;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    min-width: 70px;
    justify-content: center;
}

.reaction-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.2), transparent);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.reaction-btn:hover::before {
    width: 120px;
    height: 120px;
}

.reaction-btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
}

.like-btn {
    border-color: #4CAF50 !important;
    color: #4CAF50 !important;
}

.like-btn:hover, .like-btn.active {
    background: #4CAF50 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
    text-decoration: none;
}

.dislike-btn {
    border-color: #f44336 !important;
    color: #f44336 !important;
}

.dislike-btn:hover, .dislike-btn.active {
    background: #f44336 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.3);
    text-decoration: none;
}

.reaction-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.reaction-btn.loading i {
    animation: spin 1s linear infinite;
}

.reaction-btn.reaction-success {
    animation: reactionPulse 0.6s ease;
}

.reaction-btn.hover-effect {
    transform: scale(1.05);
}

.reaction-btn.pulse-effect {
    animation: pulse 0.6s ease;
}

.reaction-count {
    font-weight: bold;
    margin-left: 5px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes reactionPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 107, 53, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 53, 0); }
}

.avg-reading-time {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 15px;
}

.avg-reading-time i {
    color: #ff6b35;
}

/* Affiliate Products Section */
.affiliate-products-section {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.affiliate-products-section h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 24px;
    text-align: center;
}

.affiliate-product {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.affiliate-product:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.affiliate-product h4 {
    color: white;
    margin-bottom: 10px;
}

.affiliate-link {
    display: inline-block;
    background: #ff6b35;
    color: white !important;
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.affiliate-link:hover {
    background: #e55a2b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
    text-decoration: none;
}

/* Downloadable Files Section */
.downloadable-files-section {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.downloadable-files-section h3 {
    color: #333;
    margin-bottom: 25px;
    font-size: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.downloadable-files-section h3 i {
    color: #ff6b35;
    font-size: 28px;
}

.downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.download-item {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

.download-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b35, #e55a2b);
}

.download-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.download-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 15px;
}

.download-info h4 {
    color: #333;
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
}

.download-info p {
    color: #666;
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.5;
}

.file-size {
    display: inline-block;
    background: rgba(255, 107, 53, 0.1);
    color: #ff6b35;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 15px;
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ff6b35;
    color: white !important;
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-top: 10px;
    width: 100%;
    justify-content: center;
}

.download-link:hover {
    background: #e55a2b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
    text-decoration: none;
}

.download-link i {
    font-size: 16px;
}

/* Animation Enhancements */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.download-item:nth-child(1) { animation-delay: 0.1s; }
.download-item:nth-child(2) { animation-delay: 0.2s; }
.download-item:nth-child(3) { animation-delay: 0.3s; }
.download-item:nth-child(4) { animation-delay: 0.4s; }

/* Success/Error States */
.download-success {
    background: #d4edda !important;
    border-color: #c3e6cb !important;
    animation: successPulse 0.6s ease;
}

.download-error {
    background: #f8d7da !important;
    border-color: #f5c6cb !important;
    animation: errorShake 0.6s ease;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Loading States */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Success States */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #c3e6cb;
    margin: 10px 0;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Enhanced Archive Layout Support */
.downloadable-files-section .downloads-grid {
    grid-template-columns: 1fr;
}

.downloadable-files-section .download-item {
    display: flex;
    align-items: center;
    padding: 20px;
}

.downloadable-files-section .download-icon {
    margin-bottom: 0;
    margin-right: 20px;
    font-size: 36px;
    flex-shrink: 0;
}

.downloadable-files-section .download-info {
    flex: 1;
}

.downloadable-files-section .download-link {
    width: auto;
    margin-top: 0;
    margin-left: 15px;
}

/* Tooltip for file types */
.download-icon[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}

/* CRITICAL: Force visibility fixes */
.post-meta-wrap .views-count,
.post-meta-wrap .downloads-count {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 100 !important;
}

/* Prevent disappearing on animations */
.post-meta-wrap > div {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
}

/* Override any theme animations that might hide elements */
.post-meta-wrap > div:nth-child(1),
.post-meta-wrap > div:nth-child(2),
.post-meta-wrap > div:nth-child(3),
.post-meta-wrap > div:nth-child(4),
.post-meta-wrap > div:nth-child(5),
.post-meta-wrap > div:nth-child(6) {
    animation-delay: 0s !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .post-featured-image {
        margin: 15px -15px;
        border-radius: 0;
    }
    
    .post-meta-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .post-meta-wrap > div {
        justify-content: center;
        text-align: center;
        min-width: auto;
        width: 100%;
    }
    
    .views-count,
    .downloads-count {
        min-width: auto !important;
        width: 100% !important;
        justify-content: center !important;
    }
    
    .post-reactions-wrap {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .reactions-container {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .reaction-btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
    
    .affiliate-products-section {
        padding: 20px;
        margin: 20px -15px;
        border-radius: 0;
    }
    
    .downloads-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .download-item {
        padding: 20px;
    }
    
    .download-icon {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .download-info h4 {
        font-size: 16px;
    }
    
    .downloadable-files-section {
        padding: 20px;
        margin: 20px -15px;
        border-radius: 0;
    }
    
    .downloadable-files-section .download-item {
        flex-direction: column;
        text-align: center;
    }
    
    .downloadable-files-section .download-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .downloadable-files-section .download-link {
        margin-left: 0;
        margin-top: 15px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .reaction-btn {
        padding: 10px 15px;
        font-size: 13px;
        min-width: 100px;
    }
    
    .post-meta-analytics-wrap {
        padding: 15px;
        margin: 15px -15px;
        border-radius: 0;
    }
    
    .reactions-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .download-item {
        padding: 15px;
    }
    
    .downloadable-files-section h3 {
        font-size: 20px;
        flex-direction: column;
        gap: 5px;
    }
    
    .views-count,
    .downloads-count {
        padding: 10px 12px !important;
        min-width: auto !important;
        font-size: 13px !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .post-meta-analytics-wrap {
        background: linear-gradient(135deg, #2d3748, #4a5568);
        color: #f7fafc;
    }
    
    .post-meta-wrap > div {
        background: rgba(0, 0, 0, 0.3);
        color: #e2e8f0;
    }
    
    .downloadable-files-section {
        background: linear-gradient(135deg, #2d3748, #4a5568);
        color: #f7fafc;
    }
    
    .downloadable-files-section h3 {
        color: #f7fafc;
    }
    
    .download-item {
        background: #1a202c;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .download-info h4 {
        color: #f7fafc;
    }
    
    .download-info p {
        color: #a0aec0;
    }
    
    .reaction-btn {
        background: #2d3748 !important;
        border-color: #4a5568 !important;
        color: #e2e8f0 !important;
    }
}

/* Print Styles */
@media print {
    .reading-progress-bar,
    .reaction-btn,
    .download-link {
        display: none;
    }
    
    .post-meta-analytics-wrap {
        background: white;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .views-count,
    .downloads-count {
        background: #f0f0f0 !important;
        color: #333 !important;
    }
}

/* Focus States for Accessibility */
.reaction-btn:focus,
.download-link:focus,
.affiliate-link:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .reaction-btn {
        border-width: 3px !important;
    }
    
    .reaction-btn.active {
        border-color: currentColor !important;
    }
    
    .views-count,
    .downloads-count {
        border: 2px solid currentColor !important;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .reaction-btn,
    .download-item,
    .post-meta-wrap > div {
        animation: none !important;
        transition: none !important;
    }
    
    .progress-fill {
        transition: width 0.1s linear;
    }
    
    .views-count.animate-in,
    .downloads-count.animate-in {
        animation: none !important;
    }
}

/* Browser-specific fixes */
/* Safari */
@supports (-webkit-appearance: none) {
    .views-count,
    .downloads-count {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Firefox */
@-moz-document url-prefix() {
    .views-count,
    .downloads-count {
        display: -moz-box !important;
        display: flex !important;
    }
}

/* Edge/IE */
@supports (-ms-ime-align: auto) {
    .views-count,
    .downloads-count {
        display: -ms-flexbox !important;
        display: flex !important;
    }
}

/* Additional fallback for visibility issues */
.post-meta-wrap .views-count:not([style*="display: none"]),
.post-meta-wrap .downloads-count:not([style*="display: none"]) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force override any inherited display properties */
.views-count,
.downloads-count {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    width: auto !important;
    min-width: 80px !important;
    position: static !important;
    float: none !important;
    clear: none !important;
    overflow: visible !important;
}
