/* ==========================================================================
   ЕДИНЫЕ СТИЛИ КОНТЕНТА СТАТЬИ (1 в 1 для редактора TinyMCE и сайта /post/)
   ========================================================================== */

.post-content {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 17px;
    line-height: 1.75;
    color: #334155;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Единый шрифт сайта и нормальный межстрочный интервал (перекрывает мусор из Word/Docs) */
.post-content p,
.post-content span,
.post-content li,
.post-content div:not(.embedded-product-card):not(.embedded-product-card *),
.post-content td,
.post-content th,
.post-content blockquote {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.post-content p,
.post-content li {
    line-height: 1.75 !important;
}

/* Очистка нулевых отступов от Microsoft Word (MsoNormal) */
.post-content p.MsoNormal,
.post-content p[class*="Mso"] {
    margin-top: 0 !important;
    margin-bottom: 16px !important;
}

/* Clearfix чтобы обтекаемые картинки не вылезали за пределы статьи */
.post-content::after {
    content: "";
    display: table;
    clear: both;
}

.post-content p {
    margin-top: 0;
    margin-bottom: 20px;
}

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

.post-content h1,
.post-content h2 {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    margin: 38px 0 18px 0;
    letter-spacing: -0.3px;
}

.post-content h3 {
    font-size: 21px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    margin: 30px 0 14px 0;
}

.post-content h4 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.45;
    margin: 24px 0 12px 0;
}

.post-content a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}

.post-content a:hover {
    color: #1d4ed8;
}

.post-content strong,
.post-content b {
    font-weight: 700;
    color: #0f172a;
}

.post-content ul,
.post-content ol {
    margin: 0 0 25px 0;
    padding-left: 28px;
}

.post-content li {
    margin-bottom: 10px;
    line-height: 1.75;
}

.post-content blockquote {
    margin: 30px 0;
    padding: 20px 26px;
    background: #f0f9ff;
    border-left: 5px solid #3593ca;
    border-radius: 0 14px 14px 0;
    font-style: italic;
    color: #1e3a8a;
    font-size: 18px;
    line-height: 1.7;
}

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

.post-content hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 32px 0;
}

/* Таблицы */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.post-content table th,
.post-content table td {
    padding: 14px 18px;
    border: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
}

.post-content table th {
    background: #f8fafc;
    font-weight: 700;
    color: #0f172a;
}

/* Прозрачная обертка <picture> для 100% совпадения верстки редактора и сайта */
.post-content picture {
    display: contents;
}

/* Изображения в тексте статьи (кроме встроенных карточек товаров) */
.post-content img:not(.embedded-product-card img) {
    max-width: 100%;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
    vertical-align: middle;
}

/* Выравнивание изображений: слева с обтеканием, по центру, справа с обтеканием, на всю ширину */
.post-content img.img-align-left,
.post-content img.alignleft,
.post-content figure.image.img-align-left,
.post-content figure.image.alignleft {
    float: left;
    margin: 6px 26px 18px 0 !important;
    max-width: 55%;
}

.post-content img.img-align-right,
.post-content img.alignright,
.post-content figure.image.img-align-right,
.post-content figure.image.alignright {
    float: right;
    margin: 6px 0 18px 26px !important;
    max-width: 55%;
}

.post-content img.img-align-center,
.post-content img.aligncenter {
    display: block;
    margin: 24px auto !important;
    float: none !important;
}

.post-content img.img-full-width {
    display: block;
    width: 100% !important;
    height: auto !important;
    margin: 26px 0 !important;
    float: none !important;
}

/* Поддержка inline float из старых статей или диалога TinyMCE */
.post-content img[style*="float: left"],
.post-content img[style*="float:left"] {
    margin: 6px 26px 18px 0;
}

.post-content img[style*="float: right"],
.post-content img[style*="float:right"] {
    margin: 6px 0 18px 26px;
}

/* Поддержка выравнивания через родительский абзац <p style="text-align: ..."> */
.post-content p[style*="text-align: center"] img:not(.img-align-left):not(.img-align-right),
.post-content p[style*="text-align:center"] img:not(.img-align-left):not(.img-align-right) {
    display: inline-block;
    margin: 12px auto;
}

.post-content p[style*="text-align: left"] img:not(.img-align-right):not(.img-align-center),
.post-content p[style*="text-align:left"] img:not(.img-align-right):not(.img-align-center) {
    display: inline-block;
    margin: 12px 0;
}

.post-content p[style*="text-align: right"] img:not(.img-align-left):not(.img-align-center),
.post-content p[style*="text-align:right"] img:not(.img-align-left):not(.img-align-center) {
    display: inline-block;
    margin: 12px 0;
}

/* Figure + подписи к картинкам */
.post-content figure.image {
    display: table;
    margin: 26px auto;
    max-width: 100%;
}

.post-content figure.image img {
    display: block;
    margin: 0 auto;
}

.post-content figure.image figcaption {
    display: table-caption;
    caption-side: bottom;
    font-size: 14px;
    line-height: 1.5;
    color: #64748b;
    text-align: center;
    font-style: italic;
    margin-top: 10px;
    padding: 0 6px;
}

/* Видео / iframe в статье */
.post-content iframe,
.post-content video {
    max-width: 100%;
    border-radius: 14px;
    margin: 20px 0;
}

/* Встроенная карточка товара внутри статьи (1 в 1 в редакторе TinyMCE и на /post/) */
.post-content .embedded-product-card {
    margin: 24px 0 !important;
    width: 100%;
    max-width: 100%;
    display: block;
    box-sizing: border-box;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 16px 18px;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    text-align: left;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.post-content .embedded-product-card .epc-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
}

.post-content .embedded-product-card .epc-thumb {
    width: 112px;
    height: 112px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-decoration: none !important;
}

.post-content .embedded-product-card .epc-thumb img,
.post-content .embedded-product-card img {
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.post-content .embedded-product-card .epc-info {
    flex: 1;
    min-width: 0;
}

.post-content .embedded-product-card .epc-title {
    display: block;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    color: #0f172a !important;
    text-decoration: none !important;
    margin: 0 0 8px 0 !important;
}

.post-content .embedded-product-card .epc-title:hover {
    color: #2563eb !important;
}

.post-content .embedded-product-card .epc-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 12px 0;
}

.post-content .embedded-product-card .epc-price {
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
}

.post-content .embedded-product-card .epc-oldprice {
    font-size: 14px;
    color: #94a3b8;
    text-decoration: line-through;
}

.post-content .embedded-product-card .epc-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.post-content .embedded-product-card .epc-btn-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #35507f;
    color: #ffffff !important;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    border: none;
    transition: background 0.18s ease;
}

.post-content .embedded-product-card .epc-btn-cart:hover {
    background: #273e66;
}

.post-content .embedded-product-card .epc-btn-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: #1d4ed8 !important;
    border: 1px solid #bfdbfe;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.18s ease;
}

.post-content .embedded-product-card .epc-btn-more:hover {
    background: #dbeafe;
}

/* Встроенная адаптивная карусель товаров внутри статьи (1 в 1 в редакторе и на сайте) */
.post-content .embedded-product-carousel {
    margin: 26px 0 !important;
    padding: 18px;
    background: #f8fafc;
    border: 1px solid #dbeafe;
    border-radius: 16px;
    box-sizing: border-box;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.post-content .embedded-product-carousel .epc-carousel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.post-content .embedded-product-carousel .epc-carousel-label {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
}

.post-content .embedded-product-carousel .epc-carousel-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-content .embedded-product-carousel .epc-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1e293b;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.post-content .embedded-product-carousel .epc-nav-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.post-content .embedded-product-carousel .epc-carousel-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
}

.post-content .embedded-product-carousel .epc-carousel-track::-webkit-scrollbar {
    height: 6px;
}
.post-content .embedded-product-carousel .epc-carousel-track::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

.post-content .embedded-product-carousel .epc-slide {
    flex: 0 0 calc((100% - 28px) / 3);
    min-width: 220px;
    scroll-snap-align: start;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
}

.post-content .embedded-product-carousel[data-count="2"] .epc-slide {
    flex: 0 0 calc((100% - 14px) / 2);
}

.post-content .embedded-product-carousel .epc-slide-thumb {
    position: relative;
    width: 100%;
    height: 160px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 12px;
    text-decoration: none !important;
}

.post-content .embedded-product-carousel .epc-slide-thumb::before {
    content: "";
    position: absolute;
    inset: -16px;
    background-image: var(--epc-bg, none);
    background-size: cover;
    background-position: center;
    filter: blur(14px) saturate(1.15);
    transform: scale(1.12);
    opacity: 0.48;
    z-index: 0;
    pointer-events: none;
}

.post-content .embedded-product-carousel .epc-slide-thumb img {
    position: relative;
    z-index: 1;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.post-content .embedded-product-carousel .epc-slide-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    color: #0f172a !important;
    text-decoration: none !important;
    margin: 0 0 10px 0 !important;
    min-height: 38px;
}

.post-content .embedded-product-carousel .epc-slide-title:hover {
    color: #2563eb !important;
}

.post-content .embedded-product-carousel .epc-slide-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: auto 0 12px 0;
}

.post-content .embedded-product-carousel .epc-slide-price {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
}

.post-content .embedded-product-carousel .epc-slide-oldprice {
    font-size: 13px;
    color: #94a3b8;
    text-decoration: line-through;
}

.post-content .embedded-product-carousel .epc-slide-actions {
    display: flex;
    gap: 8px;
}

.post-content .embedded-product-carousel .epc-slide-btn-cart {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #35507f;
    color: #ffffff !important;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    text-align: center;
}

.post-content .embedded-product-carousel .epc-slide-btn-cart:hover {
    background: #273e66;
}

.post-content .embedded-product-carousel .epc-slide-btn-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: #1d4ed8 !important;
    border: 1px solid #bfdbfe;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none !important;
}

.post-content .embedded-product-carousel .epc-slide-btn-more:hover {
    background: #dbeafe;
}

@media (max-width: 768px) {
    .post-content .embedded-product-carousel .epc-slide,
    .post-content .embedded-product-carousel[data-count="2"] .epc-slide {
        flex: 0 0 calc((100% - 14px) / 2);
        min-width: 210px;
    }
}

@media (max-width: 520px) {
    .post-content .embedded-product-carousel {
        padding: 14px 12px;
    }
    .post-content .embedded-product-carousel .epc-slide,
    .post-content .embedded-product-carousel[data-count="2"] .epc-slide {
        flex: 0 0 82%;
        min-width: 220px;
    }
}

/* Блок контента "Только для PRO" (в редакторе и для PRO-пользователей) */
.post-content .pro-only-block {
    position: relative;
    margin: 22px 0;
    padding: 36px 20px 18px 20px;
    background: linear-gradient(135deg, #fffbeb 0%, #fefce8 100%);
    border: 2px dashed #f59e0b;
    border-radius: 14px;
    box-sizing: border-box;
}

.post-content .pro-only-block::before {
    content: "👑 PRO — Только для PRO-аккаунтов";
    position: absolute;
    top: -1px;
    left: 14px;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.4px;
    padding: 3px 11px;
    border-radius: 12px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}

.post-content .pro-only-block.pro-unlocked {
    background: #f8fafc;
    border: 1px solid #dbeafe;
    border-left: 4px solid #f59e0b;
    padding: 28px 20px 18px 20px;
}

.post-content .pro-only-block.pro-unlocked::before {
    content: "👑 PRO-материал открыт";
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

/* Заглушка для пользователей без PRO-аккаунта */
.post-content .pro-locked-card {
    margin: 24px 0;
    padding: 26px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.06);
    box-sizing: border-box;
}

.post-content .pro-locked-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.post-content .pro-locked-card__title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px 0;
    line-height: 1.35;
}

.post-content .pro-locked-card__desc {
    font-size: 14.5px;
    color: #475569;
    margin: 0 auto 18px auto;
    max-width: 520px;
    line-height: 1.55;
}

.post-content .pro-locked-card__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 14.5px;
    font-weight: 700;
    padding: 11px 26px;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.post-content .pro-locked-card__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.36);
}

@media (max-width: 600px) {
    .post-content .embedded-product-card .epc-wrap {
        flex-direction: column;
        align-items: stretch;
    }
    .post-content .embedded-product-card .epc-thumb {
        width: 100%;
        height: 180px;
    }
    .post-content .embedded-product-card .epc-actions {
        flex-direction: column;
    }
    .post-content .embedded-product-card .epc-btn-cart,
    .post-content .embedded-product-card .epc-btn-more {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Адаптив на мобильных устройствах */
@media (max-width: 768px) {
    .post-content {
        font-size: 16px;
        line-height: 1.7;
    }
    .post-content h1,
    .post-content h2 {
        font-size: 22px;
        margin: 28px 0 14px 0;
    }
    .post-content h3 {
        font-size: 19px;
        margin: 24px 0 12px 0;
    }
    .post-content img.img-align-left,
    .post-content img.alignleft,
    .post-content img.img-align-right,
    .post-content img.alignright,
    .post-content figure.image.img-align-left,
    .post-content figure.image.alignleft,
    .post-content figure.image.img-align-right,
    .post-content figure.image.alignright,
    .post-content img[style*="float: left"],
    .post-content img[style*="float:left"],
    .post-content img[style*="float: right"],
    .post-content img[style*="float:right"] {
        float: none !important;
        display: block;
        max-width: 100% !important;
        margin: 18px auto !important;
    }
}
