/* Articles Page Styles */

/* Scroll offset for sticky header (navbar height ~80px) */
:target {
    scroll-margin-top: 100px;
}

/* Alternative: apply to all anchor targets in articles */
.article-content h2[id],
.article-content h3[id],
.article-content h4[id] {
    scroll-margin-top: 100px;
}

/* Inline Text Links (for upload-owners.php) */
.inline-link {
    color: var(--primary-blue);
    text-decoration: none;
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    transition: all 0.2s ease;
    font-weight: 500;
}

.inline-link:hover {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

/* Hero Section */

/* Articles Section */
.articles-section {
    padding: 3rem 0;
    background: white;
}

/* Animal Group Sections */
.animal-group {
    margin-bottom: 4rem;
}

.animal-group:last-child {
    margin-bottom: 2rem;
}

.group-header {
    margin-bottom: 2rem;
    text-align: center;
}

.group-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.group-icon {
    width: 32px;
    height: 32px;
    color: var(--primary-blue);
}

.group-description {
    color: #6b7280;
    font-size: 1rem;
    margin: 0;
}

/* Articles Grid - 3 колонки для компактности */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Actions under groups ("Все статьи ...") */
.group-actions {
    text-align: center;
    margin-top: 1rem;
}

/* Article Card - компактная версия */
.article-card {
    padding: 1.5rem;
    /* Использует стили из .base-card в components.css */
}

.article-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Category Tag */
.category-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

/* Категории статей - новая структура */
.category-liver {
    background: #fef3c7;
    color: #d97706;
}

.category-kidney {
    background: #dbeafe;
    color: #2563eb;
}

.category-cbc {
    background: #fef2f2;
    color: #ef4444;
}

.category-biochem {
    background: #f3e8ff;
    color: #9333ea;
}

.category-guides {
    background: #eff6ff;
    color: var(--primary-blue);
}

.category-urine {
    background: #f0fdf4;
    color: var(--primary-green);
}

.category-health {
    background: #f0f9ff;
    color: #0369a1;
}

.category-emergency {
    background: #fff1f2;
    color: #dc2626;
}

.category-nutrition {
    background: #ecfdf5;
    color: #059669;
}

/* Устаревшие категории (для обратной совместимости) */
.category-blood {
    background: #fef2f2;
    color: #ef4444;
}

.category-analysis {
    background: #eff6ff;
    color: var(--primary-blue);
}

/* Article Title - компактный */
.article-card .article-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Article Description - компактный (2 строки) */
.article-card .article-description {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    flex-grow: 1;
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Article Link */
.article-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-blue);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    margin-top: auto;
}

.article-link:hover {
    color: #1d4ed8;
    gap: 0.75rem;
}

.article-link i {
    width: 1rem;
    height: 1rem;
    transition: transform 0.2s ease;
}

.article-link:hover i {
    transform: translateX(2px);
}

/* Responsive - Tablet */
@media (max-width: 992px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    .group-title {
        font-size: 1.5rem;
    }
    
    .group-icon {
        width: 28px;
        height: 28px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .articles-section {
        padding: 2rem 0;
    }
    
    .animal-group {
        margin-bottom: 3rem;
    }
    
    .group-header {
        margin-bottom: 1.5rem;
    }
    
    .group-title {
        font-size: 1.35rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .group-description {
        font-size: 0.9rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 0 1rem;
    }
    
    .article-card {
        padding: 1.25rem;
    }
    
    .article-card .article-title {
        font-size: 0.95rem;
    }
    
    .article-card .article-description {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .group-title {
        font-size: 1.2rem;
    }
    
    .article-card {
        padding: 1rem;
    }
    
    .category-tag {
        font-size: 0.65rem;
        padding: 0.2rem 0.6rem;
    }
}

/* Article Page Styles */
.article-container {
    background: white;
    min-height: calc(100vh - 200px);
    padding: 2rem 0 4rem 0;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Global fix for horizontal overflow on mobile */
.article-content,
.article-content * {
    max-width: 100%;
    box-sizing: border-box;
}

.article-content img,
.article-content iframe,
.article-content video,
.article-content embed,
.article-content object {
    max-width: 100%;
    height: auto;
}

/* Long words/URLs break */
.article-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Prevent CTA sections from causing overflow */
.cta-section,
.cta-contextual-solution,
.related-articles {
    max-width: 100%;
    box-sizing: border-box;
}

.breadcrumbs {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.breadcrumbs a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumbs a:hover {
    color: #1d4ed8;
}

.breadcrumbs span {
    color: #9ca3af;
}

.article-header {
    margin-bottom: 3rem;
    text-align: left;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Убираем нижний отступ у category-tag внутри article-meta */
.article-meta .category-tag {
    margin-bottom: 0;
}

.article-meta .article-date,
.article-meta .article-updated {
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.5;
}

.article-meta time {
    font-size: inherit;
    color: inherit;
}

.article-meta .meta-separator {
    color: #d1d5db;
    font-size: 0.8125rem;
    line-height: 1;
}

.article-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.article-image {
    max-width: 600px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem auto;
    display: block;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.article-lead {
    font-size: 1.2rem;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 0;
}

.article-content {
    max-width: none;
    line-height: 1.7;
    color: #374151;
}

.article-content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1f2937;
    margin: 3rem 0 1.5rem 0;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.article-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 2.5rem 0 1rem 0;
}

.article-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 2rem 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

.article-content li {
    margin-bottom: 0.5rem;
}

.info-box, .warning-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.info-box {
    background: #eff6ff;
    border-color: #dbeafe;
}

.warning-box {
    background: #fef2f2;
    border-color: #fecaca;
}

.info-box h4, .warning-box h4 {
    color: #1f2937;
    margin-top: 0;
    margin-bottom: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Example Boxes - клинические примеры */
.example-box {
    background: #f9fafb;
    border-left: 4px solid #9ca3af;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.example-box p {
    margin: 0.75rem 0;
}

.example-box p:first-child {
    margin-top: 0;
}

.example-box p:last-child {
    margin-bottom: 0;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 2rem 0;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Таблица на десктопе занимает всю ширину контейнера */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table th {
    background: #f9fafb;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.article-navigation {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

/* FAQ Section Styles for Articles */
.faq-section {
    margin: 2rem 0;
}

.faq-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.faq-item {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.faq-item:last-child {
    margin-bottom: 0;
}

.faq-item h3 {
    color: #1F2937;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    font-weight: 600;
}

.faq-item h3 i {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
    color: #667eea;
    flex-shrink: 0;
}

.faq-item p {
    color: #4B5563;
    line-height: 1.6;
    margin: 0;
}

/* Warning FAQ Item (red variant for critical questions) */
.faq-item.faq-warning {
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
}

.faq-item.faq-warning h3 {
    color: #DC2626;
}

.faq-item.faq-warning h3 i {
    color: #DC2626;
}

.faq-item.faq-warning p {
    color: #991B1B;
    font-weight: 500;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .faq-section {
        margin: 1.5rem 0;
    }
    
    .faq-section h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .faq-item {
        padding: 1.25rem;
        margin-bottom: 0.875rem;
    }
    
    .faq-item h3 {
        font-size: 1rem;
        flex-wrap: wrap;
    }
    
    .faq-item h3 i {
        width: 18px;
        height: 18px;
    }
    
    .faq-item p {
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    /* Prevent horizontal scroll on mobile */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    .article-container {
        padding: 1rem 0 3rem 0;
        overflow-x: hidden;
        max-width: 100%;
    }
    
    .article-content {
        overflow-x: hidden;
    }
    
    /* Fix for warning-box and info-box on mobile */
    .warning-box,
    .info-box,
    .example-box,
    .cta-section,
    .cta-contextual-solution,
    .related-articles,
    .faq-section,
    .faq-item {
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
        box-sizing: border-box;
    }

    /* If something inside boxes is genuinely wide, allow inner horizontal scroll instead of clipping */
    .warning-box,
    .info-box,
    .example-box {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tables should stay scrollable when needed */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix buttons on mobile */
    .btn,
    .btn-primary,
    .btn-secondary {
        max-width: 100%;
        white-space: normal;
        word-wrap: break-word;
    }
    
    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .article-meta .article-date,
    .article-meta .article-updated {
        font-size: 0.75rem;
        display: block;
    }
    
    .article-meta .meta-separator {
        display: none;
    }
    
    .article-header h1 {
        font-size: 2rem;
    }
    
    /* Адаптация таблиц для мобильных - с горизонтальной прокруткой */
    .table-container {
        margin: 1rem -1rem;
        padding: 0 1rem;
        border-radius: 0;
    }
    
    .data-table thead {
        display: none;
    }
    
    .data-table,
    .data-table tbody {
        display: block;
    }
    
    .data-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        background: white;
        padding: 1rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }
    
    .data-table td {
        display: block;
        padding: 0.5rem 0;
        border: none;
        text-align: left;
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Первая ячейка - название показателя (жирное, синее) */
    .data-table td:first-child {
        font-weight: 700;
        font-size: 1rem;
        color: var(--primary-blue);
        padding-bottom: 0.75rem;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid #f3f4f6;
    }
    
    /* Вторая ячейка - нормы (с меткой) */
    .data-table td:nth-child(2):before {
        content: "Норма: ";
        font-weight: 600;
        color: #6b7280;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Третья ячейка - интерпретация (с меткой) */
    .data-table td:nth-child(3):before {
        content: "Отклонения: ";
        font-weight: 600;
        color: #6b7280;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Для таблиц-глоссариев (переводы, справочники) используем другие метки */
    .glossary-table td:nth-child(2):before {
        content: "Перевод: ";
    }
    
    .glossary-table td:nth-child(3):before {
        content: "Описание: ";
    }
    
    .data-table td:nth-child(3) {
        color: #374151;
        padding-top: 0.75rem;
    }
    
    .data-table td:last-child {
        padding-bottom: 0;
    }
    
    .article-lead {
        font-size: 1.1rem;
    }
    
    .article-content h2 {
        font-size: 1.5rem;
    }
    
    .breadcrumbs {
        margin-bottom: 1.5rem;
    }
    
    .article-image {
        max-width: 100%;
        margin: 1rem 0;
    }
}

/* Related Articles Section */
.related-articles {
    margin: 3rem 0;
    padding: 2rem;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.related-articles h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.related-articles h2 i {
    width: 24px;
    height: 24px;
    color: var(--primary-blue);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.related-card {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.related-card:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.related-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.related-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.related-card p {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
}

@media (max-width: 768px) {
    .related-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .related-articles {
        padding: 1.5rem;
        margin: 2rem 0;
    }
    
    .related-articles h2 {
        font-size: 1.25rem;
    }
}

/* CTA Section in Articles */
.cta-section {
    border: none;
    border-radius: 12px;
    padding: 1.25rem 1.5rem 2rem;
    margin: 2rem 0;
    text-align: center;
}

.cta-section h2 {
    font-size: 1.5rem;
    color: #ffffff;
    margin: 0 0 0.75rem 0;
    font-weight: 700;
}

.cta-section p {
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
}

.cta-rating {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.5rem;
}

.cta-button-wrapper {
    margin-top: 1rem;
}

.cta-section .btn-cta {
    display: inline-flex;
    margin: 0 auto;
    font-size: 1.1rem;
    padding: 1rem 2.5rem;
    background: #ffffff;
    color: #667eea;
    font-weight: 700;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.cta-section .btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: #f8f9fa;
}

/* Блок features (преимущества) */
.cta-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.cta-feature {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* Верхний CTA - красный срочный (создание срочности) */
.cta-section.cta-top {
    margin-top: 0;
    margin-bottom: 2.5rem;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.35);
}

.cta-section.cta-top .btn-cta {
    color: #dc2626;
    animation: pulse-subtle 2s ease-in-out infinite;
}

.cta-section.cta-top .btn-cta:hover {
    color: #991b1b;
}

/* Промежуточный CTA - синий информативный (помощь в понимании) */
.cta-section.cta-middle {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
}

.cta-section.cta-middle .btn-cta {
    color: #2563eb;
}

.cta-section.cta-middle .btn-cta:hover {
    color: #1e40af;
}

/* Нижний CTA - оранжевый активный (финальный призыв) */
.cta-section.cta-bottom {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    box-shadow: 0 10px 30px rgba(234, 88, 12, 0.35);
}

.cta-section.cta-bottom .btn-cta {
    color: #ea580c;
    animation: pulse-subtle 2s ease-in-out infinite;
}

.cta-section.cta-bottom .btn-cta:hover {
    color: #c2410c;
}

/* Анимация пульсации для срочных CTA */
@keyframes pulse-subtle {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
}

/* Мобильная адаптация CTA */
@media (max-width: 768px) {
    .cta-section {
        padding: 1rem 1rem 1.5rem;
        margin: 1.5rem 0;
        border-radius: 10px;
    }

    .cta-section h2 {
        font-size: 1.25rem;
        margin: 0 0 0.5rem 0;
    }

    .cta-section p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .cta-rating {
        font-size: 0.95rem;
        margin-top: 1.25rem;
    }
    
    .cta-features {
        margin: 1rem 0;
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .cta-feature {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .cta-section a.btn-primary.btn-cta {
        font-size: 1rem;
        padding: 0.875rem 2rem;
        width: 100%;
        max-width: none;
        white-space: normal;
        text-align: center;
        line-height: 1.4;
        word-wrap: break-word;
    }

    .cta-section.cta-top {
        margin-bottom: 2rem;
    }
    
    /* Адаптация strong-cta-box для мобильных */
    .info-box {
        padding: 1.25rem !important;
        margin: 1.5rem 0 !important;
    }
    
    .info-box h4 {
        font-size: 1.1rem !important;
    }
    
    .info-box p {
        font-size: 0.9rem;
    }
    
    .info-box ul {
        font-size: 0.9rem;
        margin-left: 1rem !important;
    }
    
    .info-box .btn {
        font-size: 0.95rem;
        padding: 0.875rem 1.5rem;
        width: 100%;
        max-width: none;
    }
}
