/* File: content-styles.css */
/* Description: Reusable styles for content elements like articles, tables, lists, info-blocks, etc. */

/* --- Headings, Paragraphs, Lists (scoped to content containers) --- */
.article-content h2,
.content-section h2 {
    margin-top: 30px;
    font-size: 24px;
    color: #333;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    text-align: left;
    /* ✅ Для anchor links */
    position: relative;
    padding-right: 35px;
    scroll-margin-top: calc(var(--header-height) + 20px);
}

.article-content h3,
.content-section h3 {
    font-size: 22px;
    color: #333;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 5px;
    /* ✅ Для anchor links */
    position: relative;
    padding-right: 35px;
    scroll-margin-top: calc(var(--header-height) + 20px);
}

.article-content h4,
.content-section h4 {
    font-size: 18px;
    color: #444;
    margin-top: 25px;
    margin-bottom: 10px;
}

.article-content p,
.content-section p {
    color: #444;
    margin-bottom: 15px;
}

.article-content ul, .content-section ul,
.article-content ol, .content-section ol {
    padding-left: 20px;
    margin-bottom: 20px;
    color: #555;
    line-height: 1.8;
}

.article-content ul li, .article-content ol li,
.content-section ul li, .content-section ol li {
    margin-bottom: 8px;
}

/* --- Lead Paragraph (from article.css) --- */
.lead-paragraph {
    font-size: 1.1em;
    font-style: italic;
    color: #333;
    margin-bottom: 30px;
    border-left: 4px solid #ff8300;
    padding-left: 15px;
}


/* ========================================
   ✅ ANCHOR LINKS для заголовков H2/H3
   ======================================== */

/* Плавная прокрутка к якорю */
html {
    scroll-behavior: smooth;
}

/* Убираем padding справа, так как иконка теперь inline */
.article-content h2,
.content-section h2 {
    position: relative;
    /* padding-right: 35px; ← УБРАЛИ */
}

.article-content h3,
.content-section h3 {
    position: relative;
    /* padding-right: 35px; ← УБРАЛИ */
}

/* Сама иконка-якорь (теперь inline после текста) */
.heading-anchor {
    display: inline-flex; /* ✅ inline вместо absolute */
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #ccc;
    font-size: 14px;
    text-decoration: none;
    opacity: 0; /* Скрыта по умолчанию */
    transition: opacity 0.2s ease, color 0.2s ease;
    cursor: pointer;
    margin-left: 8px; /* ✅ Отступ слева от текста */
    vertical-align: middle; /* ✅ Выравнивание по центру строки */
}

/* Появляется при наведении на заголовок */
.article-content h2:hover .heading-anchor,
.article-content h3:hover .heading-anchor,
.content-section h2:hover .heading-anchor,
.content-section h3:hover .heading-anchor {
    opacity: 1;
}

/* При наведении на саму иконку */
.heading-anchor:hover {
    color: #17bcf4; /* Ваш синий цвет */
}

/* ✅ Анимация при переходе по якорю */
.article-content h2:target,
.article-content h3:target,
.content-section h2:target,
.content-section h3:target {
    animation: highlight 2s ease;
}

@keyframes highlight {
    0% { 
        background-color: rgba(23, 188, 244, 0.2);
        padding-left: 15px;
        border-radius: 4px;
    }
    100% { 
        background-color: transparent;
        padding-left: 0;
    }
}


/* --- Accordion Styles (from style.css) --- */
.faq-accordion {
    max-width: 900px;
    margin: 0 auto;
}
.faq-item {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 0px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.faq-question-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 20px 25px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.faq-question-btn:hover {
    background-color: #f7f7f7;
}
.faq-toggle-icon {
    font-size: 24px;
    color: #ff8300;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 15px;
}
.faq-question-btn.active .faq-toggle-icon {
    transform: rotate(45deg);
}
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    color: #555;
    line-height: 1.6;
    background-color: #fdfdfd;
    border-top: 1px solid #f0f0f0;
}
.faq-answer p {
    margin: 0;
    padding: 20px 25px;
}


/* --- Table Styles (from article.css & page.css) --- */
.table-responsive {
    overflow-x: auto;
    margin: 25px 0;
    /* ✅ Улучшаем скролл на мобильных */
    -webkit-overflow-scrolling: touch;
    width: 100%;
}
.article-content table,
.content-section table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}
.article-content th, .content-section th,
.article-content td, .content-section td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}
.article-content th,
.content-section th {
    background-color: #f9f9f9;
    font-weight: 700;
}

/* ✅ МОБИЛЬНАЯ АДАПТАЦИЯ ТАБЛИЦ */
@media (max-width: 768px) {
    .table-responsive {
        margin: 15px -15px; /* Растягиваем до краёв */
        padding: 0 15px;
    }
    
    .article-content table,
    .content-section table {
        font-size: 14px;
        min-width: 400px; /* Уменьшаем минимальную ширину */
    }
    
    .article-content th, .content-section th,
    .article-content td, .content-section td {
        padding: 8px;
    }
}


/* --- Image Styles (from article.css & page.css) --- */
.image-simple {
    display: table;
    margin: 25px auto;
    max-width: 100%;
}
.image-simple img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
    box-shadow: none;
}
.image-simple figcaption {
    font-size: 14px;
    color: #777;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
}


/* --- Attention Blocks (from article.css) --- */
.article-content .info-block,
.content-section .info-block {
    padding: 25px;
    margin: 0 0 24px 0;
    border-radius: 8px;
    border-left: 5px solid;
    position: relative;
    overflow: hidden;
}
.article-content .info-block h4,
.content-section .info-block h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
}
.article-content .info-block p, .content-section .info-block p,
.article-content .info-block ul, .content-section .info-block ul,
.article-content .info-block ol, .content-section .info-block ol {
    margin-bottom: 0;
    line-height: 1.7;
}
.article-content .info-block.with-icon,
.content-section .info-block.with-icon {
    padding-left: 65px;
}
.article-content .info-block.with-icon::before,
.content-section .info-block.with-icon::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    left: 25px;
    top: 27px;
    font-size: 18px;
}

/* Color variations */
.info-block--tip { background-color: #e8f5e9; border-left-color: #4caf50; color: #1b5e20; }
.info-block--tip h4 { color: #2e7d32; }
.info-block--tip::before { content: '\f0eb'; color: #4caf50; }

.info-block--warning { background-color: #fff8e1; border-left-color: #ffb300; color: #4e342e; }
.info-block--warning h4 { color: #bf360c; }
.info-block--warning::before { content: '\f071'; color: #ffb300; }

.info-block--promo { background: linear-gradient(135deg, #17bcf4 0%, #ff8300 100%); color: #fff; border-left: none; padding-left: 25px; }
.info-block--promo h4 { color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.2); }
.info-block--promo a { color: #fff; font-weight: 700; }
.info-block--promo::before { content: none; }

.info-block--info { background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); border-left-color: #2196f3; color: #1a237e; }
.info-block--info h4 { color: #0d47a1; }
.info-block--info::before { content: '\f05a'; color: #2196f3; }

.info-block--special { background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%); border-left-color: #ec407a; color: #880e4f; }
.info-block--special h4 { color: #c2185b; }
.info-block--special::before { content: '\f005'; color: #ec407a; }

.info-block--quote { background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%); color: #fff; border-left: none; padding-left: 25px; }
.info-block--quote h4 { color: #fff; }
.info-block--quote::before { content: '\f10d'; font-size: 22px; left: 25px; top: 22px; color: rgba(255, 255, 255, 0.8); }
.info-block--quote.with-icon { padding-left: 65px; }
.info-block--quote p { font-style: italic; }

.info-block--deep-dive { background-color: #424242; border-left-color: #17bcf4; color: #eeeeee; }
.info-block--deep-dive h4 { color: #fff; }
.info-block--deep-dive p { color: #eeeeee; }
.info-block--deep-dive::before { content: '\f0b2'; color: #17bcf4; }


/* --- NEW: Table of Contents Styling --- */
.table-of-contents {
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px; 
}
.table-of-contents .toc-title {
    display: block; 
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 700; 
    color: #17bcf4; 
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}
.table-of-contents ul {
    list-style: none; 
    padding: 0 !important; /* Override generic list styles */
    margin: 0;
}
.table-of-contents ul li {
    line-height: 1.6;
    margin-bottom: 5px !important; /* Override generic list styles */
    font-size: 15px;
}
.table-of-contents ul li a {
    color: #444;
    text-decoration: none;
    transition: color 0.2s;
}
.table-of-contents ul li a:hover {
    color: #ff8300;
    text-decoration: underline;
}
.table-of-contents ul li.toc-h3 a {
    padding-left: 20px; 
    display: block; 
    font-size: 14px;
    color: #666;
}

/* --- NEW: Feedback Block Styling --- */
.feedback-block {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}
.feedback-block p {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 15px;
    font-weight: 500;
}
.feedback-options {
    display: flex;
    justify-content: center;
    gap: 20px;
}
.feedback-btn {
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 700;
    transition: background-color 0.2s, transform 0.2s;
    border: 1px solid #ccc;
}
.feedback-btn.like {
    background-color: #28a745; 
    color: #fff;
    border-color: #28a745;
}
.feedback-btn.dislike {
    background-color: #dc3545; 
    color: #fff;
    border-color: #dc3545;
}
.feedback-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}


/* ======================================= */
/* MEDIA QUERIES - MOBILE */
/* ======================================= */

@media (max-width: 768px) {
    /* ✅ На мобильных иконка всегда полупрозрачная */
    .heading-anchor {
        opacity: 0.4; /* Полупрозрачная всегда видна */
        font-size: 12px;
        width: 18px;
        height: 18px;
        margin-left: 6px; /* Чуть меньше отступ на мобильных */
    }
    
    /* При тапе/наведении - ярче */
    .article-content h2:hover .heading-anchor,
    .article-content h3:hover .heading-anchor,
    .content-section h2:hover .heading-anchor,
    .content-section h3:hover .heading-anchor {
        opacity: 1;
    }
    
    /* Уменьшаем размер заголовков */
    .article-content h2,
    .content-section h2 {
        font-size: 22px;
    }
    
    .article-content h3,
    .content-section h3 {
        font-size: 20px;
    }
    
    /* Анимация на мобильных чуть короче */
    @keyframes highlight {
        0% { 
            background-color: rgba(23, 188, 244, 0.15);
            padding-left: 10px;
            border-radius: 4px;
        }
        100% { 
            background-color: transparent;
            padding-left: 0;
        }
    }
}

@media (max-width: 480px) {
    /* На совсем маленьких экранах - ещё компактнее */
    .heading-anchor {
        width: 16px;
        height: 16px;
        font-size: 11px;
        margin-left: 5px;
    }
}