/* Design Fixes for HackPC Theme */

/* Enhanced gradient text with better fallbacks */
.gradient-text {
    background: linear-gradient(135deg, var(--hackpc-primary), #154d84);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: var(--hackpc-primary); /* Fallback color */
    font-weight: 700;
}

/* Fallback for browsers that don't support gradient text */
@supports not (-webkit-background-clip: text) {
    .gradient-text {
        color: var(--hackpc-primary) !important;
        background: none !important;
        -webkit-text-fill-color: var(--hackpc-primary) !important;
    }
}

/* Alternative gradient text approach */
.bg-clip-text.text-transparent {
    background: linear-gradient(135deg, var(--hackpc-primary), #154d84);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* Strong fallback */
    color: var(--hackpc-primary) !important;
}

/* Firefox fallback */
@-moz-document url-prefix() {
    .bg-clip-text.text-transparent {
        color: var(--hackpc-primary) !important;
        background: none !important;
    }
}

/* Enhanced card styling with proper padding */
.article-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 2rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.article-card:hover {
    border-color: var(--hackpc-primary);
    box-shadow: 0 4px 12px rgba(30, 115, 190, 0.15);
    transform: translateY(-2px);
}

/* Fix category badge contrast */
.category-badge,
.bg-brand-600 {
    background-color: var(--hackpc-primary) !important;
    color: #ffffff !important;
    border: none;
    font-weight: 600;
}

/* Improve text contrast on colored backgrounds */
.bg-accent-100 {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1;
}

.text-accent-700 {
    color: #334155 !important;
}

/* Enhanced article preview cards */
.featured-article {
    background: #ffffff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    padding: 0;
}

.featured-article .featured-content {
    padding: 2rem;
}

.featured-article .featured-image {
    margin-bottom: 0;
}

.featured-article:hover {
    box-shadow: 0 8px 25px rgba(30, 115, 190, 0.12);
    border-color: var(--hackpc-primary);
}

/* Side article improvements - removed duplicate */

.side-article:hover {
    border-color: var(--hackpc-primary);
    background: #f8fafc;
}

/* Side article layout improvements */
.side-article {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.side-article .flex-1 {
    flex: 1;
    min-width: 0;
}

/* Специальные стили для иконок в боковых статьях */
.side-article .article-icon {
    width: 5rem;
    height: 4rem;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.side-article .article-icon i {
    font-size: 1.375rem;
    line-height: 1;
    display: block;
}

/* Убираем конфликтующие стили */
.side-article .flex-shrink-0 {
    flex-shrink: 1;
}

/* Category section improvements */
.category-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(30, 115, 190, 0.02));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-card:hover::before {
    opacity: 1;
}

.category-card:hover {
    border-color: var(--hackpc-primary);
    box-shadow: 0 8px 25px rgba(30, 115, 190, 0.1);
    transform: translateY(-4px);
}

/* Category icon improvements */
.category-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

/* Color-specific improvements */
.text-brand-600 {
    color: var(--hackpc-primary) !important;
}

.bg-brand-100 {
    background-color: #f0f8ff !important;
    border: 1px solid #dbeafe;
}

.bg-accent-600 {
    background-color: #64748b !important;
}

.bg-emerald-600 {
    background-color: #059669 !important;
}

.bg-orange-600 {
    background-color: #ea580c !important;
}

/* Article grid improvements */
.articles-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    margin-top: 2rem;
}

/* Grid container improvements */
.grid.grid-cols-1.lg\\:grid-cols-2.gap-8 {
    gap: 2rem;
}

.grid.grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-4.gap-6 {
    gap: 1.5rem;
}

/* Featured section improvements */
.featured-section {
    margin-bottom: 3rem;
}

.featured-section .grid {
    gap: 2rem;
}

/* Category section spacing */
.category-section {
    padding: 4rem 0;
}

.category-section .grid {
    margin-top: 3rem;
}

/* Newsletter section text fix */
.newsletter-section {
    background: linear-gradient(135deg, var(--hackpc-primary), #154d84);
}

.newsletter-section .text-brand-100 {
    color: rgba(255, 255, 255, 0.9) !important;
}

.newsletter-section .text-brand-200 {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Button improvements */
.btn-primary {
    background: var(--hackpc-primary);
    color: #ffffff;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 9999px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(30, 115, 190, 0.2);
}

.btn-primary:hover {
    background: #154d84;
    box-shadow: 0 4px 12px rgba(30, 115, 190, 0.3);
    transform: translateY(-1px);
    color: #ffffff;
}

.btn-secondary {
    border: 2px solid #d1d5db;
    color: #374151;
    background: #ffffff;
    padding: 0.75rem 2rem;
    border-radius: 9999px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--hackpc-primary);
    color: var(--hackpc-primary);
    background: #f8fafc;
}

/* Footer improvements */
.footer-section {
    background: #1f2937;
    color: #d1d5db;
}

.footer-section a {
    color: #d1d5db;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--hackpc-primary);
}

/* Improved spacing for content elements */
.article-card .space-y-3 > * + * {
    margin-top: 1rem;
}

.article-card h3 {
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.article-card p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.article-card .text-xs {
    margin-top: 1rem;
}

.side-article h4 {
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.side-article p {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.featured-content h3 {
    margin-bottom: 1rem;
    line-height: 1.3;
}

.featured-content p {
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.category-card h3 {
    margin-bottom: 0.75rem;
}

.category-card p {
    margin: 0;
    line-height: 1.4;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .category-card {
        padding: 1.5rem 1rem;
        min-height: 120px;
    }
    
    .article-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .side-article {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .featured-article .featured-content {
        padding: 1.5rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Animation improvements */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Accessibility improvements */
.focus-visible:focus {
    outline: 3px solid var(--hackpc-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .article-card,
    .category-card,
    .side-article {
        border: 2px solid #000;
        background: #fff;
    }
    
    .bg-clip-text.text-transparent {
        color: #000 !important;
        background: none !important;
        -webkit-text-fill-color: #000 !important;
    }
    
    .category-badge,
    .bg-brand-600 {
        background: #000 !important;
        color: #fff !important;
        border: 2px solid #000 !important;
    }
}

/* Print styles */
@media print {
    .article-card,
    .category-card,
    .side-article {
        border: 1px solid #000;
        box-shadow: none;
        background: #fff;
    }
    
    .bg-clip-text.text-transparent {
        color: #000 !important;
        background: none !important;
        -webkit-text-fill-color: #000 !important;
    }
}

/* Loading states for dynamic content */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.5rem;
}

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