/*
 * УЛУЧШЕНИЯ САЙДБАРА ДЛЯ СТРАНИЦ СТАТЕЙ
 * Стили для формы подписки и блока похожих статей с изображениями
 */

/* ==========================================
   ФОРМА ПОДПИСКИ В САЙДБАРЕ
   ========================================== */

.sidebar-widget.newsletter-widget {
    background: linear-gradient(135deg, #f8faff, #eef7ff);
    border: 2px solid #e1e8ed;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.sidebar-widget.newsletter-widget::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(74, 144, 226, 0.1), transparent);
    border-radius: 50%;
    pointer-events: none;
}

.newsletter-widget .widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #2c3e50);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.newsletter-description {
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.subscription-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.subscription-form .form-group {
    margin: 0;
}

.subscription-form .email-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.subscription-form .email-input:focus {
    outline: none;
    border-color: var(--primary-color, #4a90e2);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    transform: translateY(-1px);
}

.subscription-form .subscribe-btn {
    background: linear-gradient(135deg, var(--primary-color, #4a90e2), #357abd);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.subscription-form .subscribe-btn:hover {
    background: linear-gradient(135deg, #357abd, #2868a3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.subscription-form .subscribe-btn:active {
    transform: translateY(0);
}

/* ==========================================
   ПОХОЖИЕ СТАТЬИ С ИЗОБРАЖЕНИЯМИ
   ========================================== */

.related-posts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.related-post-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 12px;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.related-post-item:hover {
    background: #f1f5f9;
    transform: translateX(2px);
    border-left-color: var(--primary-color, #4a90e2);
}

/* Изображение статьи */
.related-post-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
}

.related-post-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.related-post-image .related-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-post-image:hover .related-thumbnail {
    transform: scale(1.1);
}

/* Placeholder для статей без изображения */
.related-post-image .placeholder-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e1e8ed, #f1f5f9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #6b7280);
    font-size: 1.2rem;
}

/* Контент статьи */
.related-post-content {
    flex-grow: 1;
    min-width: 0;
}

.related-post-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
}

.related-post-content h4 a {
    color: var(--text-primary, #2c3e50);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.related-post-content h4 a:hover {
    color: var(--primary-color, #4a90e2);
}

.related-post-content .related-date {
    font-size: 0.8rem;
    color: var(--text-secondary, #6b7280);
}

/* ==========================================
   АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   ========================================== */

@media (max-width: 768px) {
    .sidebar-widget.newsletter-widget {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .newsletter-widget .widget-title {
        font-size: 1rem;
    }
    
    .newsletter-description {
        font-size: 0.85rem;
    }
    
    .subscription-form .email-input,
    .subscription-form .subscribe-btn {
        font-size: 0.85rem;
    }
    
    .related-post-image {
        width: 50px;
        height: 50px;
    }
    
    .related-post-content h4 {
        font-size: 0.85rem;
    }
    
    .related-post-content .related-date {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .sidebar-widget.newsletter-widget {
        padding: 1rem;
    }
    
    .related-post-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .related-post-image {
        width: 45px;
        height: 45px;
    }
}

/* ==========================================
   АНИМАЦИИ И ЭФФЕКТЫ
   ========================================== */

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(74, 144, 226, 0);
    }
}

.subscription-form .subscribe-btn:focus {
    animation: pulseGlow 2s infinite;
}

/* Эффект загрузки для кнопки подписки */
.subscription-form.submitting .subscribe-btn {
    opacity: 0.7;
    pointer-events: none;
}

.subscription-form.submitting .subscribe-btn::after {
    content: "";
    width: 16px;
    height: 16px;
    margin-left: 0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================
   ИНТЕГРАЦИЯ С СУЩЕСТВУЮЩИМИ СТИЛЯМИ
   ========================================== */

/* Убедимся, что виджет подписки использует правильные переменные */
.sidebar-widget.newsletter-widget {
    --primary-color: #4a90e2;
    --secondary-color: #f39c12;
    --text-primary: #2c3e50;
    --text-secondary: #6b7280;
}

/* Стили для совместимости с темной темой */
@media (prefers-color-scheme: dark) {
    .sidebar-widget.newsletter-widget {
        background: linear-gradient(135deg, #2d3748, #4a5568);
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .newsletter-description {
        color: #a0aec0;
    }
    
    .subscription-form .email-input {
        background: #1a202c;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .related-post-item {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .related-post-item:hover {
        background: #4a5568;
    }
    
    .related-post-content h4 a {
        color: #e2e8f0;
    }
    
    .related-post-content h4 a:hover {
        color: var(--primary-color, #4a90e2);
    }
}