/* Blog Detail Page Enhancements */

/* Enhanced Search Styling */
#article-search {
    transition: all 0.3s ease;
    border: 2px solid #e5e7eb;
}

#article-search:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Search Results Highlighting */
mark {
    background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 500;
    animation: highlightPulse 0.5s ease-in-out;
}

@keyframes highlightPulse {
    0% { background: #fbbf24; }
    100% { background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%); }
}

/* Enhanced Mobile Sidebar */
@media (max-width: 1024px) {
    #sidebar-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
    }
    
    #sidebar-content.show {
        max-height: 1000px;
    }
}

/* Improved Form Validation States */
.form-textarea:invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-textarea:valid {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Enhanced Loading States */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Improved Button States */
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Enhanced Card Hover Effects */
.sidebar-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Better Focus States for Accessibility */
.focus-ring:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 0.375rem;
}

/* Enhanced Typography for Better Readability */
.blog-content {
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
    text-rendering: optimizeLegibility;
}

/* Improved Spacing for Better Visual Hierarchy */
.blog-content > * + * {
    margin-top: 1.5rem;
}

.blog-content h2 + p,
.blog-content h3 + p,
.blog-content h4 + p {
    margin-top: 1rem;
}

/* Enhanced Mobile Experience */
@media (max-width: 640px) {
    .blog-hero {
        padding: 1.5rem 0;
    }
    
    .blog-title {
        font-size: 1.5rem;
        line-height: 1.4;
    }
    
    .blog-content {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .sidebar-item {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .form-textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Print Optimizations */
@media print {
    .sidebar-sticky,
    #article-search,
    .comment-form,
    .social-share,
    .reading-progress {
        display: none !important;
    }
    
    .blog-content {
        font-size: 12pt;
        line-height: 1.6;
        color: #000;
    }
    
    .blog-title {
        font-size: 18pt;
        color: #000;
        page-break-after: avoid;
    }
    
    .blog-content h2,
    .blog-content h3,
    .blog-content h4 {
        page-break-after: avoid;
        color: #000;
    }
    
    .blog-content p {
        orphans: 3;
        widows: 3;
    }
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    .blog-content mark {
        background: linear-gradient(120deg, #451a03 0%, #78350f 100%);
        color: #fbbf24;
    }
    
    #article-search {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    #article-search:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
    
    .form-textarea:invalid {
        border-color: #f87171;
        box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
    }
    
    .form-textarea:valid {
        border-color: #34d399;
        box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: none;
    }
    
    mark {
        animation: none;
    }
}