/**
 * top107.ru — toplist.css
 * Стили для карточек сервисов и контента топ-листов.
 * Подключается только на страницах с шаблоном toplist (см. functions.php).
 *
 * Классы предназначены для использования в Gutenberg / классическом редакторе.
 */

/* ============================================================
   Service card — обёртка карточки сервиса
   ============================================================ */
.service-card {
    position: relative;
    border: 1px solid #E5E5E5;
    border-radius: 12px;
    padding: 24px;
    margin: 28px 0;
    background: #ffffff;
    box-shadow: 0px 1px 2px -1px rgba(0,0,0,0.10), 0px 1px 3px rgba(0,0,0,0.10); /* Shadow/sm */
    transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
    counter-increment: service-counter;
}

.service-card:hover {
    border-color: #E9D7FE;
    box-shadow: 0px 4px 8px -2px rgba(0,0,0,0.10), 0px 2px 4px -2px rgba(0,0,0,0.06); /* Shadow/md */
    transform: translateY(-1px);
}

/* Порядковый номер сервиса (автоматический через counter) */
.service-card::before {
    content: counter(service-counter);
    position: absolute;
    top: -12px;
    left: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    background: #7F56D9;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0px 1px 2px -1px rgba(0,0,0,0.10), 0px 1px 3px rgba(0,0,0,0.10);
}

/* Сброс счётчика на обёртке контента */
.toplist-content {
    counter-reset: service-counter;
}


/* ============================================================
   Service card header — логотип + название + мета
   ============================================================ */
.service-card__header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.service-card__logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid #E5E5E5;
    object-fit: contain;
    background: #FAFAFA;
    padding: 4px;
}

.service-card__logo--placeholder {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid #E5E5E5;
    background: #F9F5FF;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7F56D9;
    font-size: 20px;
    font-weight: 700;
}

.service-card__title-group {
    flex: 1;
    min-width: 0;
}

/* H2 внутри карточки — переопределяем стили статьи */
.service-card__header h2,
.service-card h2.service-card__name {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #101828 !important;
    line-height: 28px !important;
    margin: 0 0 4px !important;
    padding: 0 !important;
    border: none !important;
    letter-spacing: -0.01em;
}

.service-card__tagline {
    font-size: 14px;
    color: #667085;
    line-height: 20px;
    margin: 0;
}


/* ============================================================
   Service card meta badges (цена, пробный период, и т.д.)
   ============================================================ */
.service-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

/* Переиспользуем .badge из main.css, добавляем новые варианты */
.service-card__meta .badge {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 9999px;
    border: 1px solid;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.5;
    white-space: nowrap;
}

.badge--price   { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.badge--free    { color: #0369a1; background: #f0f9ff; border-color: #bae6fd; }
.badge--trial   { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.badge--feature { color: #6941C6; background: #F9F5FF; border-color: #E9D7FE; }
.badge--rating  { color: #b45309; background: #fffbeb; border-color: #fde68a; }


/* ============================================================
   Service card rating block
   ============================================================ */
.service-card__rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.service-card__rating-score {
    font-size: 15px;
    font-weight: 700;
    color: #101828;
}

.service-card__rating-count {
    font-size: 13px;
    color: #98A2B3;
}


/* ============================================================
   Service card description
   ============================================================ */
.service-card__body {
    font-size: 15px;
    line-height: 1.65;
    color: #475467;
    margin-bottom: 16px;
}

.service-card__body p {
    margin: 0 0 12px;
}

.service-card__body p:last-child {
    margin-bottom: 0;
}


/* ============================================================
   Pros / Cons — двухколоночная сетка
   ============================================================ */
.service-card__pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #F2F4F7;
}

@media (max-width: 600px) {
    .service-card__pros-cons { grid-template-columns: 1fr; }
}

.service-card__pros,
.service-card__cons {
    min-width: 0;
}

.service-card__pros h4,
.service-card__cons h4 {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .06em !important;
    margin: 0 0 10px !important;
    padding: 0 !important;
    border: none !important;
    line-height: 1.4 !important;
}

.service-card__pros h4 { color: #12B76A !important; }
.service-card__cons h4 { color: #F04438 !important; }

.service-card__pros ul,
.service-card__cons ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.service-card__pros li,
.service-card__cons li {
    font-size: 14px;
    color: #344054;
    line-height: 20px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* SVG чекмарк (зелёный) */
.service-card__pros li::before {
    content: '';
    display: block;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    background-color: #12B76A;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M4.5 12.75l6 6 9-13.5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M4.5 12.75l6 6 9-13.5'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* SVG крестик (красный) */
.service-card__cons li::before {
    content: '';
    display: block;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    background-color: #F04438;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 18L18 6M6 6l12 12'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 18L18 6M6 6l12 12'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}


/* ============================================================
   Service card CTA button
   ============================================================ */
.service-card__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    line-height: 22px;
    color: #ffffff;
    background: #7F56D9;
    border: 1px solid rgba(255,255,255,0.12);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, box-shadow .15s ease, transform .1s ease;
    box-shadow:
        0px 1px 2px rgba(16, 24, 40, 0.05),
        inset 0px -2px 0px rgba(0, 0, 0, 0.12),
        inset 0px 0px 0px 1px rgba(255, 255, 255, 0.12);
    white-space: nowrap;
}

.service-card__cta:hover {
    background: #6941C6;
    box-shadow:
        0px 4px 8px -2px rgba(0,0,0,0.10), 0px 2px 4px -2px rgba(0,0,0,0.06),
        inset 0px -2px 0px rgba(0,0,0,0.14),
        inset 0px 0px 0px 1px rgba(255,255,255,0.10);
    transform: translateY(-1px);
}

.service-card__cta:active {
    background: #53389E;
    transform: translateY(0);
    box-shadow:
        0px 1px 2px rgba(16,24,40,0.05),
        inset 0px 1px 2px rgba(0,0,0,0.1);
}

/* Вторичная кнопка */
.service-card__cta--secondary {
    background: #ffffff;
    color: #344054;
    border: 1px solid #D0D5DD;
    box-shadow: 0px 1px 2px rgba(16,24,40,0.05);
}

.service-card__cta--secondary:hover {
    background: #FAFAFA;
    border-color: #98A2B3;
    color: #101828;
    box-shadow: 0px 1px 2px -1px rgba(0,0,0,0.10), 0px 1px 3px rgba(0,0,0,0.10);
    transform: translateY(-1px);
}

.service-card__cta-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #F2F4F7;
}


/* ============================================================
   Toplist: общий контент (обёртка the_content())
   ============================================================ */

/* Переопределяем H2 для сервисов в toplist-content */
.toplist-content .service-card h2 {
    font-size: 20px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em;
    color: #101828 !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
    border: none !important;
}

/* Sticky TOC aside (если используется) */
.toplist-toc {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
    scrollbar-width: thin;
}

.toplist-toc a {
    display: block;
    padding: 4px 12px;
    color: #475467;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color .15s, border-color .15s;
}

.toplist-toc a:hover,
.toplist-toc a.active {
    color: #7F56D9;
    border-left-color: #7F56D9;
}


/* ============================================================
   Summary block ("Коротко о сервисе") — highlight box
   ============================================================ */
.service-card__summary {
    background: #F9F5FF;
    border: 1px solid #E9D7FE;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #344054;
    line-height: 1.6;
}

.service-card__summary strong {
    color: #101828;
}

.service-card__summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px 16px;
}

.service-card__summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.service-card__summary-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #98A2B3;
}

.service-card__summary-value {
    font-size: 14px;
    font-weight: 500;
    color: #101828;
}


/* ============================================================
   Article layout: content + sticky TOC sidebar
   ============================================================ */
.t107-article-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 48px;
    align-items: start;
}

.t107-toc-sidebar {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #E5E5E5 transparent;
}

@media (max-width: 1024px) {
    .t107-article-layout {
        grid-template-columns: 1fr;
    }
    .t107-toc-sidebar {
        display: none;
    }
}


/* ============================================================
   Article content: tables
   ============================================================ */
/* Scrollable-обёртка — добавляется через PHP-фильтр */
.t107-table-wrap {
    margin: 28px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: fit-content;   /* ровно по ширине таблицы, не шире */
    max-width: 100%;      /* но не шире контейнера */
    border-radius: 12px;
    border: 1px solid #E5E5E5;
    box-shadow: 0px 1px 3px rgba(0,0,0,0.06), 0px 1px 2px -1px rgba(0,0,0,0.06);
}

/* Обратная совместимость для wp-block-table */
.article-content .wp-block-table,
.article-content figure.wp-block-table {
    margin: 28px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.article-content table {
    width: auto !important;
    table-layout: auto !important;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.5;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

/* Заголовки: перенос по словам — колонка сжимается под контент, не под текст шапки */
.article-content table thead th {
    background: #F9F5FF;
    color: #6941C6;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 16px;
    text-align: center;
    border: none !important;
    border-bottom: 1px solid #E9D7FE !important;
    word-break: keep-all;
    overflow-wrap: break-word;
}

/* Первый заголовок — левое выравнивание */
.article-content table thead th:first-child {
    text-align: left;
}

.article-content table tbody tr {
    border-bottom: 1px solid #F2F4F7;
    transition: background .1s;
}

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

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

/* Все ячейки данных: центр + middle */
.article-content table td {
    padding: 14px 16px;
    color: #344054;
    vertical-align: middle;
    text-align: center;
    font-size: 15px;
    height: 52px;
    border: none !important;
    border-bottom: 1px solid #F2F4F7 !important;
}

/* Первая колонка: левое, жирный */
.article-content table th:first-child,
.article-content table td:first-child {
    font-weight: 600;
    font-size: 14px;
    color: #171717;
    text-align: left;
}

/* УБРАНО: желтый цвет на last-child — ломал таблицы без рейтинга.
   Звёзды ★ стилизуются через контент или отдельный класс.
   Если нужен золотой цвет — добавь класс .stars к ячейке. */
.article-content table td.stars {
    font-size: 17px;
    letter-spacing: 2px;
    color: #F79009;
}



/* ============================================================
   Article content: H2, H3 оформление
   ============================================================ */
.article-content h2 {
    font-size: 22px;
    font-weight: 700;
    color: #171717;
    letter-spacing: -0.02em;
    margin: 40px 0 16px;
    line-height: 1.25;
}

.article-content h3 {
    font-size: 17px;
    font-weight: 600;
    color: #171717;
    margin: 28px 0 10px;
    line-height: 1.4;
}

.article-content p {
    margin: 0 0 16px;
    color: #344054;
    line-height: 1.75;
}

.article-content ul {
    list-style: disc;
    margin: 0 0 16px 24px;
    color: #344054;
    line-height: 1.7;
}

.article-content ol {
    list-style: decimal;
    margin: 0 0 16px 24px;
    color: #344054;
    line-height: 1.7;
}

.article-content li {
    margin-bottom: 6px;
    padding-left: 4px;
}

.article-content li::marker {
    color: #7F56D9;
}

.article-content a {
    color: #7F56D9;
    text-decoration: underline;
    text-decoration-color: #E9D7FE;
    text-underline-offset: 2px;
    transition: text-decoration-color .15s;
}

.article-content a:hover {
    text-decoration-color: #7F56D9;
}

.article-content blockquote {
    border-left: 4px solid #7F56D9;
    background: #F9F5FF;
    padding: 16px 20px;
    margin: 24px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #525252;
}


/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .service-card {
        padding: 20px 16px;
        margin: 20px 0;
    }

    .service-card__header {
        gap: 12px;
    }

    .service-card__cta-group {
        flex-direction: column;
        align-items: stretch;
    }

    .service-card__cta {
        justify-content: center;
        width: 100%;
    }
}
