/**
 * Стили для контента статей - адаптивные и красивые
 * Поддержка всех HTML элементов с фокусом на мобильную версию
 */

/* Базовая типографика */
.article-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #374151;
    line-height: 1.8;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 16px;
}

/* Заголовки */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin-top: 2.5em;
    margin-bottom: 0.8em;
    font-weight: 800;
    line-height: 1.25;
    color: #111827;
    scroll-margin-top: 80px;
    letter-spacing: -0.02em;
}

.article-content h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    margin-top: 0;
}

/* h2 — главный раздел: синяя полоска слева */
.article-content h2 {
    font-size: clamp(1.35rem, 4vw, 1.875rem);
    padding-left: 1rem;
    border-left: 4px solid #2563eb;
    color: #1e3a5f;
    margin-top: 3em;
}

/* h3 — подраздел: нумерованный стиль */
.article-content h3 {
    font-size: clamp(1.125rem, 3.5vw, 1.5rem);
    color: #1f2937;
    padding-bottom: 0.25em;
    border-bottom: 2px solid #e5e7eb;
}

.article-content h4 { font-size: clamp(1rem, 3vw, 1.25rem); color: #374151; }
.article-content h5 { font-size: clamp(0.95rem, 2.5vw, 1.125rem); }
.article-content h6 { font-size: clamp(0.875rem, 2vw, 1rem); }

/* Параграфы */
.article-content p {
    margin-bottom: 1.4em;
    font-size: clamp(15px, 2.5vw, 17px);
    line-height: 1.8;
    color: #374151;
}

.article-content p:last-child {
    margin-bottom: 0;
}

/* Первый параграф прямо после h2 — немного крупнее и другого цвета */
.article-content h2 + p {
    font-size: clamp(15.5px, 2.5vw, 17.5px);
    color: #4b5563;
}

/* Ссылки */
.article-content a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    word-break: break-word;
}

.article-content a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Изображения - полностью адаптивные */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 1.5em auto;
    display: block;
}

@media (max-width: 640px) {
    .article-content img {
        border-radius: 8px;
        margin: 1em auto;
    }
}

/* Списки */
.article-content ul,
.article-content ol {
    margin: 1.5em 0;
    padding-left: 1.75em;
}

@media (max-width: 640px) {
    .article-content ul,
    .article-content ol {
        padding-left: 1.25em;
    }
}

.article-content li {
    margin: 0.6em 0;
    line-height: 1.8;
    font-size: clamp(15px, 2.5vw, 17px);
    color: #374151;
}

.article-content ul > li {
    list-style-type: disc;
}

.article-content ul > li::marker {
    color: #2563eb;
}

.article-content ol > li {
    list-style-type: decimal;
}

.article-content ol > li::marker {
    color: #2563eb;
    font-weight: 700;
}

/* Вложенные списки */
.article-content ul ul,
.article-content ol ol,
.article-content ul ol,
.article-content ol ul {
    margin: 0.5em 0;
}

/* Цитаты */
.article-content blockquote {
    margin: 2.5em 0;
    padding: 1.25em 1.5em 1.25em 1.75em;
    border-left: 4px solid #2563eb;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(37, 99, 235, 0.02) 100%);
    border-radius: 0 16px 16px 0;
    font-style: normal;
    color: #1e3a5f;
    font-size: clamp(15px, 2.5vw, 17px);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
    position: relative;
}

.article-content blockquote::before {
    content: '"';
    position: absolute;
    top: -0.35em;
    left: 0.75em;
    font-size: 3em;
    color: #2563eb;
    opacity: 0.25;
    font-family: Georgia, serif;
    line-height: 1;
}

@media (max-width: 640px) {
    .article-content blockquote {
        padding: 1em 1.25em;
        border-radius: 0 8px 8px 0;
    }
}

.article-content blockquote p {
    margin: 0.5em 0;
}

.article-content blockquote p:first-child {
    margin-top: 0;
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Код */
.article-content code {
    background: #eff6ff;
    color: #1e40af;
    padding: 0.25em 0.5em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Courier New', Courier, monospace;
    word-break: break-word;
}

.article-content pre {
    background: #1f2937;
    color: #f3f4f6;
    padding: 1.5em;
    border-radius: 12px;
    overflow-x: auto;
    margin: 1.5em 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
    .article-content pre {
        padding: 1em;
        border-radius: 8px;
        font-size: 0.875em;
    }
}

.article-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* Таблицы - адаптивные */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    overflow-x: auto;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

@media (min-width: 640px) {
    .article-content table {
        display: table;
    }
}

.article-content thead {
    background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
}

.article-content th {
    padding: 0.875em 1em;
    text-align: left;
    font-weight: 700;
    color: #111827;
    border-bottom: 2px solid #e5e7eb;
}

@media (max-width: 640px) {
    .article-content th {
        padding: 0.625em 0.75em;
        font-size: 0.875em;
    }
}

.article-content td {
    padding: 0.875em 1em;
    border-bottom: 1px solid #e5e7eb;
}

@media (max-width: 640px) {
    .article-content td {
        padding: 0.625em 0.75em;
        font-size: 0.875em;
    }
}

.article-content tr:last-child td {
    border-bottom: none;
}

.article-content tbody tr:hover {
    background: #f9fafb;
}

/* Горизонтальная линия */
.article-content hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 3em 0;
}

/* Выделение текста */
.article-content strong,
.article-content b {
    font-weight: 700;
    color: #111827;
}

.article-content em,
.article-content i {
    font-style: italic;
}

.article-content u {
    text-decoration: underline;
}

.article-content mark {
    background: #fef3c7;
    padding: 0.125em 0.25em;
    border-radius: 2px;
}

/* Видео и iframe - адаптивные */
.article-content iframe,
.article-content video {
    max-width: 100%;
    width: 100%;
    border-radius: 12px;
    margin: 1.5em 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@media (max-width: 640px) {
    .article-content iframe,
    .article-content video {
        border-radius: 8px;
    }
}

/* Видео в соотношении 16:9 */
.article-content .video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin: 1.5em 0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    background: #000;
}

.article-content .video-wrapper iframe,
.article-content .video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    border: 0;
    border-radius: 12px;
}

@media (max-width: 640px) {
    .article-content .video-wrapper {
        border-radius: 8px;
    }
    .article-content .video-wrapper iframe,
    .article-content .video-wrapper video {
        border-radius: 8px;
    }
}

/* VK Video embed */
.article-content .vk-video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin: 1.5em 0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    background: #000;
}

.article-content .vk-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    margin: 0;
    border-radius: 12px;
}

/* Аудиоплеер */
.article-content audio {
    width: 100%;
    margin: 1.5em 0;
    border-radius: 8px;
}

.article-content .audio-block {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 1.25em 1.5em;
    margin: 1.5em 0;
}

.article-content .audio-block .audio-title {
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 0.75em;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.article-content .audio-block .audio-title::before {
    content: '🎧';
}

.article-content .audio-block audio {
    margin: 0;
}

@media (max-width: 640px) {
    .article-content .audio-block {
        padding: 1em;
        border-radius: 8px;
    }
}

/* PDF / Документ embed */
.article-content .pdf-embed {
    width: 100%;
    height: 600px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin: 1.5em 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.article-content .doc-block {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25em 1.5em;
    margin: 1.5em 0;
    display: flex;
    align-items: center;
    gap: 1em;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.article-content .doc-block:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.article-content .doc-block .doc-icon {
    width: 48px;
    height: 48px;
    background: #dbeafe;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    flex-shrink: 0;
}

.article-content .doc-block .doc-info {
    flex: 1;
    min-width: 0;
}

.article-content .doc-block .doc-name {
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-content .doc-block .doc-meta {
    font-size: 0.85em;
    color: #6b7280;
}

@media (max-width: 640px) {
    .article-content .pdf-embed {
        height: 400px;
        border-radius: 8px;
    }
    .article-content .doc-block {
        padding: 1em;
        border-radius: 8px;
    }
}

/* Инфографика — полноширинное изображение */
.article-content .infographic {
    margin: 2em 0;
    text-align: center;
}

.article-content .infographic img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.article-content .infographic .caption {
    margin-top: 0.75em;
    font-size: 0.875em;
    color: #6b7280;
    font-style: italic;
}

/* Медиа-сетка (для нескольких файлов) */
.article-content .media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25em;
    margin: 2em 0;
}

@media (max-width: 640px) {
    .article-content .media-grid {
        grid-template-columns: 1fr;
        gap: 1em;
    }
}

.article-content .media-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

.article-content .media-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.article-content .media-card .media-thumb {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-content .media-card .media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

.article-content .media-card .media-thumb .media-icon {
    font-size: 2.5em;
    color: #9ca3af;
}

.article-content .media-card .media-body {
    padding: 1em;
}

.article-content .media-card .media-body h4 {
    margin: 0 0 0.25em;
    font-size: 1em;
    color: #111827;
}

.article-content .media-card .media-body p {
    margin: 0;
    font-size: 0.85em;
    color: #6b7280;
}

/* Кнопки и вызовы к действию */
.article-content .btn,
.article-content button,
.article-content .button {
    display: inline-block;
    padding: 0.75em 1.5em;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    margin: 0.5em 0;
}

.article-content .btn:hover,
.article-content button:hover,
.article-content .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
}

@media (max-width: 640px) {
    .article-content .btn,
    .article-content button,
    .article-content .button {
        display: block;
        width: 100%;
        text-align: center;
    }
}

/* Карточки и блоки */
.article-content .card,
.article-content .box {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5em;
    margin: 1.5em 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

@media (max-width: 640px) {
    .article-content .card,
    .article-content .box {
        padding: 1em;
        border-radius: 8px;
    }
}

/* Цветные блоки - алерты */
.article-content .alert,
.article-content .notice {
    padding: 1.25em 1.5em;
    border-radius: 8px;
    margin: 1.5em 0;
    border-left: 4px solid;
}

.article-content .alert-info,
.article-content .notice-info {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.article-content .alert-success,
.article-content .notice-success {
    background: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}

.article-content .alert-warning,
.article-content .notice-warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.article-content .alert-danger,
.article-content .notice-danger {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

/* Колонки для десктопа */
@media (min-width: 768px) {
    .article-content .columns-2 {
        column-count: 2;
        column-gap: 2em;
    }

    .article-content .columns-3 {
        column-count: 3;
        column-gap: 2em;
    }
}

/* Гибкие блоки */
.article-content .flex {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
}

.article-content .flex > * {
    flex: 1;
    min-width: 200px;
}

@media (max-width: 640px) {
    .article-content .flex > * {
        min-width: 100%;
    }
}

/* Центрирование контента */
.article-content .text-center {
    text-align: center;
}

.article-content .text-right {
    text-align: right;
}

.article-content .text-left {
    text-align: left;
}

/* Цвета текста */
.article-content .text-primary { color: #3b82f6; }
.article-content .text-success { color: #22c55e; }
.article-content .text-warning { color: #f59e0b; }
.article-content .text-danger { color: #ef4444; }
.article-content .text-muted { color: #6b7280; }

/* Размеры текста */
.article-content .text-small { font-size: 0.875em; }
.article-content .text-large { font-size: 1.25em; }
.article-content .text-xl { font-size: 1.5em; }

/* Отступы */
.article-content .mt-1 { margin-top: 0.5em; }
.article-content .mt-2 { margin-top: 1em; }
.article-content .mt-3 { margin-top: 1.5em; }
.article-content .mt-4 { margin-top: 2em; }

.article-content .mb-1 { margin-bottom: 0.5em; }
.article-content .mb-2 { margin-bottom: 1em; }
.article-content .mb-3 { margin-bottom: 1.5em; }
.article-content .mb-4 { margin-bottom: 2em; }

/* Прайс-листы */
.article-content .price-table {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    padding: 2em;
    border-radius: 12px;
    margin: 2em 0;
}

@media (max-width: 640px) {
    .article-content .price-table {
        padding: 1.5em;
    }
}

.article-content .price {
    font-size: 2em;
    font-weight: 800;
    color: #1e40af;
}

/* Галерея изображений */
.article-content .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1em;
    margin: 2em 0;
}

@media (max-width: 640px) {
    .article-content .gallery {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.75em;
    }
}

.article-content .gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    margin: 0;
}

/* Убрать отступы у первого и последнего элемента */
.article-content > *:first-child {
    margin-top: 0;
}

.article-content > *:last-child {
    margin-bottom: 0;
}

/* Поддержка темной темы через системные настройки */
@media (prefers-color-scheme: dark) {
    .article-content {
        color: #e5e7eb;
    }

    .article-content h1,
    .article-content h2,
    .article-content h3,
    .article-content h4,
    .article-content h5,
    .article-content h6 {
        color: #f9fafb;
    }
}

/* Печать */
@media print {
    .article-content {
        font-size: 12pt;
        line-height: 1.5;
    }

    .article-content img,
    .article-content video,
    .article-content iframe {
        max-width: 100%;
        page-break-inside: avoid;
    }

    .article-content pre {
        page-break-inside: avoid;
    }
}

/* Защита от автосвязывания телефонных номеров и чисел */
.article-content p,
.article-content td,
.article-content li,
.article-content blockquote {
    -webkit-text-size-adjust: 100%;
}

/* Неразрывность для чисел с дефисами, пробелами и диапазонов */
.article-content {
    hyphens: manual;
    -webkit-hyphens: manual;
}

/* Предотвращение разрывов в числах типа "27 000", "14 990 ₽", "27000-54000" */
.article-content p a[href^="tel"],
.article-content td a[href^="tel"],
.article-content li a[href^="tel"] {
    pointer-events: none;
    color: inherit;
    text-decoration: none;
}
