/**
 * Blog Sync Manager - Professional Styling
 * =========================================
 * 
 * Styles for optimistic UI updates, loading states,
 * and real-time synchronization indicators.
 */

/* Optimistic Post States */
.optimistic-post {
    opacity: 0.7;
    position: relative;
    transition: opacity 0.3s ease;
}

.optimistic-post::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.5) 50%, 
        rgba(255,255,255,0) 100%);
    animation: shimmer 2s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Optimistic Badge */
.optimistic-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ffc107;
    color: #000;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.optimistic-badge::before {
    content: '⏳';
    font-size: 14px;
}

/* Failed State */
.post-failed {
    opacity: 0.5;
    border: 2px dashed #dc3545 !important;
}

.failed-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

.failed-badge::before {
    content: '❌ ';
}

/* Loading Button States */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

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

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-published {
    background: #28a745;
    color: #fff;
}

.status-draft {
    background: #6c757d;
    color: #fff;
}

/* Sync Status Indicator */
.sync-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sync-status.online {
    border-color: #28a745;
}

.sync-status.offline {
    border-color: #dc3545;
}

.sync-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #28a745;
    animation: pulse 2s infinite;
}

.sync-status.offline .sync-status-dot {
    background: #dc3545;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 400px;
    z-index: 9999;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    border-left: 4px solid #28a745;
}

.notification.error {
    border-left: 4px solid #dc3545;
}

.notification.info {
    border-left: 4px solid #17a2b8;
}

.notification.warning {
    border-left: 4px solid #ffc107;
}

.notification-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: #000;
}

/* Offline Queue Indicator */
.offline-queue {
    position: fixed;
    bottom: 70px;
    right: 20px;
    background: #ffc107;
    color: #000;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 14px;
    font-weight: 600;
    z-index: 1000;
    display: none;
}

.offline-queue.active {
    display: block;
    animation: slideUp 0.3s ease;
}

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

/* Blog Post Card Enhancements */
.blog-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* Admin Table Enhancements */
.admin-posts-list tr {
    transition: background-color 0.2s ease;
}

.admin-posts-list tr:hover {
    background-color: #f8f9fa;
}

.admin-posts-list tr[data-optimistic="true"] {
    background-color: #fff3cd;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .sync-status {
        bottom: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .offline-queue {
        bottom: 60px;
        right: 10px;
        left: 10px;
    }
}
