/* Custom CSS for TechChina */

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loading animation */
.loading-dots::after {
    content: '';
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Article card hover effects */
.article-card {
    transition: all 0.3s ease;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Category badge hover effect */
.category-badge {
    transition: all 0.3s ease;
}

.category-badge:hover {
    transform: scale(1.05);
}

/* Image lazy loading placeholder */
.img-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Custom button styles */
.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Newsletter form styles */
#newsletter-form input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Mobile menu animation */
#mobile-nav {
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

#mobile-nav.show {
    max-height: 200px;
}

/* Article content styles */
.article-content {
    line-height: 1.8;
}

.article-content h1, 
.article-content h2, 
.article-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content ul, 
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.article-content blockquote {
    border-left: 4px solid #2563eb;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
}

/* Comment styles */
.comment {
    border-left: 3px solid #e5e7eb;
    transition: border-color 0.3s ease;
}

.comment:hover {
    border-left-color: #2563eb;
}

.comment-reply {
    margin-left: 2rem;
    border-left-color: #f59e0b;
}

/* Ad block styles */
.ad-block {
    position: relative;
    overflow: hidden;
}

.ad-block::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #f59e0b, #ef4444, #8b5cf6, #06b6d4);
    z-index: -1;
    opacity: 0.3;
    animation: gradient-animation 3s ease infinite;
}

@keyframes gradient-animation {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Search styles */
.search-overlay {
    backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.7);
}

/* Statistics counter animation */
.counter {
    font-variant-numeric: tabular-nums;
}

/* Tag cloud */
.tag-cloud .tag {
    transition: all 0.3s ease;
}

.tag-cloud .tag:hover {
    background-color: #2563eb;
    color: white;
    transform: scale(1.1);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination button {
    min-width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    background-color: #2563eb;
    color: white;
}

.pagination button.active {
    background-color: #2563eb;
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive design helpers */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Print styles */
@media print {
    header, footer, .ad-block, #newsletter-form {
        display: none;
    }
    
    .article-content {
        color: black;
    }
}

/* Dark mode support (future feature) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1f2937;
        --text-color: #f9fafb;
        --card-bg: #374151;
    }
}

/* Focus states for accessibility */
button:focus,
input:focus,
textarea:focus,
select:focus,
a:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Skip to content link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #2563eb;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Image optimization */
img {
    max-width: 100%;
    height: auto;
}

.lazy-image {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Performance optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Social sharing buttons */
.share-buttons {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-btn.telegram { background: #0088cc; }
.share-btn.vk { background: #4c75a3; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.whatsapp { background: #25d366; }

/* Content Layers Styles - Трёхуровневая архитектура контента */
.content-layers {
    min-height: 500px;
}

.layer-content {
    transition: all 0.3s ease-in-out;
    opacity: 0;
    transform: translateY(10px);
}

.layer-content.active {
    opacity: 1;
    transform: translateY(0);
}

.layer-tab {
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.layer-tab:hover {
    color: #2563eb !important;
}

.layer-tab.active {
    color: #2563eb !important;
    border-color: #2563eb !important;
}

/* Layer-specific styling */
#fact-layer {
    background: linear-gradient(to bottom, rgba(59, 130, 246, 0.02), rgba(59, 130, 246, 0.01));
}

#analysis-layer {
    background: linear-gradient(to bottom, rgba(16, 185, 129, 0.02), rgba(16, 185, 129, 0.01));
}

#context-layer {
    background: linear-gradient(to bottom, rgba(245, 158, 11, 0.02), rgba(245, 158, 11, 0.01));
}

/* Layer headers */
.layer-content h4 {
    position: relative;
    padding-left: 3rem;
}

.layer-content h4::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2px;
    border-radius: 1px;
}

#analysis-layer h4::before {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

#context-layer h4::before {
    background: linear-gradient(90deg, #10b981, #047857);
}

/* Cross-references styling */
.cross-references {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    background: #f9fafb;
    margin: 1.5rem 0;
}

.cross-references h5 {
    color: #374151;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.cross-references a {
    display: block;
    padding: 0.5rem 0;
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.cross-references a:hover {
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.05);
    padding-left: 0.5rem;
    border-radius: 0.25rem;
}

.cross-references a:last-child {
    border-bottom: none;
}

/* Tech wiki section */
#tech-wiki-section {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border: 2px dashed #9ca3af;
    border-radius: 0.75rem;
    position: relative;
    overflow: hidden;
}

#tech-wiki-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    animation: tech-wiki-shimmer 2s infinite;
}

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

#tech-wiki-link {
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

#tech-wiki-link::after {
    content: '🔗';
    transition: transform 0.3s ease;
}

#tech-wiki-link:hover::after {
    transform: scale(1.2);
}

/* AI-generated content indicators */
.ai-generated-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, #ddd6fe 0%, #c7d2fe 100%);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #5b21b6;
    border: 1px solid #a78bfa;
}

.ai-generated-indicator i {
    animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Layer navigation improvements */
#content-layers-nav {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 0.75rem 0.75rem 0 0;
    padding: 0 1rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 4rem;
    z-index: 10;
}

/* Layer content animations */
@keyframes layer-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.layer-content.active {
    animation: layer-slide-in 0.5s ease-out;
}

/* Interactive elements in layers */
.layer-interactive {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.layer-interactive:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

/* Responsive layer navigation */
@media (max-width: 768px) {
    #content-layers-nav {
        padding: 0 0.5rem;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    #content-layers-nav::-webkit-scrollbar {
        display: none;
    }
    
    .layer-tab {
        white-space: nowrap;
        min-width: auto;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* Progressive enhancement for layer switching */
@media (prefers-reduced-motion: reduce) {
    .layer-content,
    .layer-tab {
        transition: none;
    }
    
    .layer-content.active {
        animation: none;
    }
}