﻿
/* ============================================================
   Company Card — pixel-perfect from Figma (node 2131:254535)
   SEO catalogs L360. Reuses .ui-btn (css/ui-button.css).
   ============================================================ */

.company-card {
    position: relative; /* anchor for the stretched card link */
    background: rgba(251, 251, 255, 0.5); /* cntnr/bg/transperent/default */
    border: 1px solid #e5e2ff; /* cntnr/border/default */
    border-radius: 16px; /* cntnr/corner/large */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .15s ease, box-shadow .15s ease;
}

    /* Вся картка клікабельна через справжній <a> (.cc-stretched-link, перший
       нащадок article, position:absolute+inset:0). Кнопки/посилання лежать
       у positioned-контейнерах (.cc-head/.cc-body/.card-more), тож малюються
       поверх — клікабельні незалежно від stretched-link. */
    .company-card[data-href] {
        cursor: pointer;
    }

.cc-stretched-link {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* ---------------- HEADER (opaque white) ---------------- */
.cc-head {
    background: #fff; /* cntnr/bg/primary/default */
    background: var(--cntnr-bg-Primary-default, #FFF);
    display: flex;
    gap: 12px; /* space/300 */
    min-height: 92px;
    padding: 16px 0 16px 32px;
}

.cc-head-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.company-card .card-button {
    min-width: 48px;
    min-height: 48px;
}

.card-button__label--monitoring::before {
    content: "Моніторинг";
}

.card-button__label--investigate::before {
    content: "Дослідити зв’язки";
}

.cc-id {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px; /* space/150 */
}

.cc-avatar {
    position: relative;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f4d20a; /* node/background company */
    display: grid;
    place-items: center;
    color: #fff;
}

    .cc-avatar > svg {
        width: 24px;
        height: 24px;
    }
/* circular Ukraine-flag badge */
.cc-flag {
    position: absolute;
    top: -3px;
    left: 30px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff; /* cntnr/border/white */
    background: linear-gradient(#005bbb 50%, #ffd500 50%);
    box-sizing: border-box;
}

.cc-titles {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.cc-name {
    font: 500 24px/28px var(--liga-font-family); /* H600/Medium */
    letter-spacing: -0.02px;
    color: #25252a; /* text/default */
    /* Назву переносимо, а не обрізаємо три крапки: довгі повні назви
       («ПРИВАТНЕ АКЦІОНЕРНЕ ТОВАРИСТВО …») не влазили вже на 1280px. */
    white-space: normal;
    overflow-wrap: anywhere;
}

.cc-sub {
    display: flex;
    gap: 12px;
    align-items: center;
    font: 400 16px/20px var(--liga-font-family); /* H400/Regular */
    letter-spacing: 0.33px;
    color: #9898a3; /* text/subtlest */
    white-space: normal;
}

    .cc-sub > * {
        min-width: 0;
        overflow-wrap: anywhere;
    }

/* ---------------- ACTIONS ---------------- */
.cc-actions {
    position: relative; /* sits above .cc-stretched-link — buttons stay clickable */
    flex: none;
    display: flex;
    align-items: center;
    gap: 4px; /* space/050 */
    padding: 0 12px 0 0; /* pr/py space/150 */
}

    .cc-actions .ui-btn {
        --ui-btn-pad: 16px;
    }
/* card buttons use space/200 padding */

/* ---------------- CONTENT (translucent strip) ---------------- */
.cc-body {
    background: rgb(245, 245, 250); /* shows the card's translucent bg */
    border-top: 1px solid #e5e2ff;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 16px 20px; /* row space/200, col space/250 */
    padding: 24px 20px; /* py space/300, px space/250 */
}

.cc-field {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 4px; /* space/050 */
    justify-content: center;
    min-width: 0;
}

    .cc-field:not(:last-child) {
        border-right: 1px solid #efeff5;
        padding-right: 20px;
    }

    /* Основний вид діяльності */
    .cc-field--grow .cc-value-link {
        white-space: normal;
    }

.cc-field__label {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cc-chip {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fafafc; /* cntnr/bg/secondary */
    display: grid;
    place-items: center;
    color: #4b4b55; /* icon/subtle */
}

    .cc-chip svg {
        width: 16px;
        height: 16px;
    }

.cc-chip--status {
    width: 20px;
    height: 20px;
    background: #e7e7ec;
}
    /* color/neutral/400 */
    .cc-chip--status svg {
        width: 14px;
        height: 14px;
    }

.cc-label {
    font: 700 14px/16px var(--liga-font-family); /* H300/Bold */
    letter-spacing: 0.15px;
    color: #4b4b55; /* text/subtle */
    white-space: nowrap;
}

.cc-value {
    font: 400 14px/16px var(--liga-font-family); /* H300/Regular */
    letter-spacing: 0.29px;
    color: #4b4b55;
    white-space: nowrap;
}

.cc-value-link {
    position: relative; /* sits above .cc-stretched-link — stays independently clickable */
    font: 400 14px/16px var(--liga-font-family);
    letter-spacing: 0.29px;
    color: #7267e6; /* link/default (no underline) */
    white-space: nowrap;
}

    .cc-value-link:hover {
        color: #9486ff;
    }

/* person node + linked name */
.cc-person {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cc-founder {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cc-pnode {
    position: relative;
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #015ce5; /* node/background person */
    display: grid;
    place-items: center;
    color: #fff;
}

    .cc-pnode > svg {
        width: 14px;
        height: 14px;
    }

.cc-pnode-flag {
    position: absolute;
    top: -3px;
    left: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #fff;
    background: linear-gradient(#005bbb 50%, #ffd500 50%);
    box-sizing: border-box;
}

.cc-link {
    position: relative; /* sits above .cc-stretched-link — stays independently clickable */
    font: 400 14px/16px var(--liga-font-family);
    letter-spacing: 0.29px;
    color: #7267e6; /* link/default */
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

    .cc-link:hover {
        color: #9486ff;
    }

/* Ім'я керівника / засновника — не ширше 320px, решта «…». Засновником буває
   довгий опис («Акціонери згідно реєстру власників…»), і він розсував картку. */
.cc-person .cc-link {
    display: inline-block;
    max-width: 320px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

/* status pill + last-update */
.cc-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cc-status-pill {
    background: #f9dce3; /* неактивний статус (припинено тощо) */
    border-radius: 10000px;
    padding: 4px 8px;
    font: 600 12px/15px var(--liga-font-family);
    letter-spacing: 0.25px;
    color: #d00f3c;
    white-space: nowrap;
}

.cc-update {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.cc-update__label {
    font: 400 12px/15px var(--liga-font-family);
    letter-spacing: 0.25px;
    color: #9898a3;
}

.cc-update__date {
    font: 400 12px/15px var(--liga-font-family);
    letter-spacing: 0.25px;
    color: #4b4b55;
}

/* +N badge */
.cc-badge {
    flex: none;
    background: #e5e2ff; /* Color/Primary/200 */
    border-radius: 24px;
    padding: 0 4px;
    min-width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    font: 600 12px/15px var(--liga-font-family); /* H200/SemiBold */
    letter-spacing: 0.25px;
    color: #25252a;
}

/* locked / premium (diagonal blur over light violet) */
.cc-locked {
    position: relative;
    width: 120px;
    height: 22px;
    border-radius: 4px; /* cntnr/corner/small */
    background: repeating-linear-gradient(-40deg, rgba(114, 103, 230, .5) 0 6px, rgba(114, 103, 230, 0) 6px 19px), #e5e2ff; /* cntnr/bg/primary/active */
    display: grid;
    place-items: center;
    cursor: pointer;
}

.cc-locked__lock {
    width: 14px;
    height: 14px;
    color: #5048a1; /* icon/accent */
    opacity: 0;
    transition: opacity .15s ease;
}

.cc-locked:hover, .cc-locked:focus-visible {
    outline: none;
}

    .cc-locked:hover .cc-locked__lock,
    .cc-locked:focus-visible .cc-locked__lock {
        opacity: 1;
    }

.cc-locked__tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #fff;
    border: 1px solid #e5e2ff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(37, 37, 42, .14);
    padding: 8px 12px;
    font: 400 13px/1.3 var(--liga-font-family);
    color: #4b4b55;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, transform .15s ease;
    z-index: 5;
}

.cc-locked:hover .cc-locked__tip,
.cc-locked:focus-visible .cc-locked__tip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.cc-locked__brand {
    color: #7267e6;
    font-weight: 700;
}

/* ---------------- "Детальніше" expander (mobile only) ---------------- */
.card-more {
    position: relative;
    display: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    /* Довгі назви тут ідуть у 2–3 рядки — трохи менший кегль (≤575 ще менший, нижче). */
    .cc-name {
        font-size: 20px;
        line-height: 24px;
    }

    .card-button__label--monitoring {
        display: none;
    }

    .card-button:has(.card-button__label--monitoring) {
        --uiKit-btn-pad: 0px;
        width: 48px;
        padding: 0;
    }

    .card-button__label--investigate::before {
        content: "Зв’язки";
    }

    .cc-head {
        padding: 16px 0 16px 16px;
    }
}

@media (max-width: 575px) {

    .cc-id {
        padding: 0;
    }

    .cc-avatar {
        width: 40px;
        height: 40px;
    }

    .cc-name {
        font-size: 18px;
        line-height: 22px;
        white-space: normal;
    }

    .cc-sub {
        flex-direction: column;
        gap: 2px;
        align-items: flex-start;
    }

    .cc-actions {
        padding: 0;
        width: 100%;
        gap: 8px;
        flex-wrap: wrap;
    }
        .cc-actions .ui-btn {
            --ui-btn-h: 40px;
            --ui-btn-pad: 16px;
            flex: none;
        }

        .cc-actions .cc-monitor .ui-btn__label {
            display: none;
        }

        .cc-actions .cc-monitor {
            width: var(--ui-btn-h);
            padding: 0;
        }

        .cc-actions .cc-links {
            margin-left: auto;
        }

            .cc-actions .cc-links .ui-btn__label {
                display: none;
            }

            .cc-actions .cc-links::after {
                content: "Зв’язки";
            }

    /* content collapses under the toggle. Розгорнуте — сітка у дві колонки
       (підпис над значенням): короткі поля стають парами, довгі значення
       переносяться всередині колонки. Раніше тут був flex-column з
       .cc-field { flex: 1 1 100% } — у колонці 100% бралося від висоти,
       і кожне поле розтягувалось на сотні пікселів. */
    .cc-body {
        display: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 16px 12px;
        padding: 16px;
    }

    .company-card.is-expanded .cc-body {
        display: grid;
    }

    .cc-divider {
        display: none;
    }

    /* Без десктопних роздільників-бордерів між полями: у сітці вони стояли
       вертикальними лініями біля правого краю кожної колонки. */
    .cc-body > .cc-field {
        min-width: 0;
        border-right: 0; /* перебиває .cc-field:not(:last-child) */
        padding-right: 0;
    }

    /* Довгі значення — на обидві колонки: статус з датою оновлення, люди
       (директор, засновник: аватар + ПІБ) і вид діяльності (посилання на
       /catalog/kved/…). Короткі (код, дата, регіон, закриті) лишаються парами. */
    .cc-body > .cc-field:has(.cc-status-row, .cc-person, a[href*="/catalog/kved"]) {
        grid-column: 1 / -1;
    }

    .cc-field__value {
        min-width: 0;
        overflow-wrap: break-word;
    }

    .cc-body .cc-label {
        white-space: normal;
    }

    /* Закриті значення (штрихування) не ширші за колонку. */
    .cc-body .cc-locked {
        max-width: 100%;
    }

    .cc-value, .cc-value-link, .cc-link, .cc-name {
        white-space: normal;
    }

    .cc-status-row {
        flex-wrap: wrap;
    }

    .cc-status-pill {
        white-space: normal;
    }
    /* keep the locked tooltip inside the viewport on narrow screens */
    .cc-locked {
        justify-self: start;
    }

    .cc-locked__tip {
        left: 0;
        transform: translateX(0) translateY(4px);
        white-space: normal;
        max-width: 240px;
    }

    .cc-locked:hover .cc-locked__tip,
    .cc-locked:focus-visible .cc-locked__tip {
        transform: translateX(0) translateY(0);
    }

    .card-more {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 16px;
        border: none;
        border-top: 1px solid #e5e2ff;
        background: #fff;
        font: 700 13px/1 var(--liga-font-family);
        text-transform: uppercase;
        letter-spacing: .02em;
        color: #25252a;
        cursor: pointer;
    }

        .card-more svg {
            transition: transform .2s ease;
        }

    .company-card.is-expanded .card-more svg {
        transform: rotate(180deg);
    }
}

/* Активний статус у ЄДР (StatusCode = "active"): позитивна заливка «пігулки»
   й чипа замість нейтральної. Іконка-галочка приходить із розмітки картки. */
.cc-status-pill--active,
.cc-chip--status-active {
    background: var(--status-Trasperent-positive, #D4F2E6);
}

.cc-status-pill--active {
    color: #216e4e;
}

/* Додаткові показники в підвалі картки (Figma 3675:324718): рядок «пігулок»
   з іконкою, підписом і закритим значенням. Токени: cntnr/bg/secondary/default
   #fafafc, cntnr/border/default #e5e2ff, cntnr/corner/big 12, space/100 8,
   space/150 12; іконка — icon/active #7267e6 на cntnr/bg/primary/active. */
.cc-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background-color: rgb(245, 245, 250);
    padding: 8px 20px;
    border-top: 1px solid var(--cntnr-border-default);
}

.cc-extra__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid #e5e2ff;
    border-radius: 12px;
    background: #fafafc;
    position: relative; /* лежить над .cc-stretched-link — замок клікабельний */
}

.cc-chip--extra {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e5e2ff;
    color: #7267e6;
}

/* Підсумок перевірки в .cc-body (_DueDiligenceSummary.cshtml): рядок рожевих
   сегментів «1 / 18 індикаторів … | 187 джерел … | 1667 перевірок …».
   Завжди окремим рядком на всю ширину картки — і у flex на десктопі,
   і в сітці на вузьких екранах. */
.cc-dd {
    flex: 1 1 100%;
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    color: var(--text-default);
    font-size: 14px;
    line-height: 20px;
}

/* Поле перед підсумком тепер не :last-child — прибираємо йому роздільник. */
.cc-field:has(+ .cc-dd) {
    border-right: 0;
    padding-right: 0;
}

.cc-dd__item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--color-other-colors-red-100);
}

/* Тонкий вертикальний роздільник між сегментами (не на всю висоту). */
.cc-dd__item + .cc-dd__item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 20px;
    transform: translateY(-50%);
    background: var(--color-other-colors-red-300);
}

.cc-dd__item:first-child {
    border-radius: 8px 0 0 8px;
}

.cc-dd__item:last-child {
    border-radius: 0 8px 8px 0;
}

.cc-dd__item b {
    font-weight: 700;
}

.cc-dd__icon {
    color: var(--color-other-colors-red-700);
}

/* Підсумок ще рахується (_DueDiligenceSummaryLoading.cshtml, Figma 5331:121160):
   сіра «пігулка», замість чисел — лоадери, роздільники блакитні. */
.cc-dd--loading {
    font-size: 16px;
    letter-spacing: 0.33px;
}

.cc-dd--loading .cc-dd__item {
    gap: 4px;
    padding: 8px;
    background: var(--cntnr-bg-other-page-background);
}

.cc-dd--loading .cc-dd__item:first-child {
    padding-left: 12px;
    border-radius: 10000px 0 0 10000px;
}

.cc-dd--loading .cc-dd__item:last-child {
    padding-right: 12px;
    border-radius: 0 10000px 10000px 0;
}

.cc-dd--loading .cc-dd__item + .cc-dd__item::before {
    background: var(--cntnr-bg-other-blue-blue-hover, #d1e4ff);
}

.cc-dd__spinner {
    flex: none;
    animation: cc-dd-spin 1s linear infinite;
}

@keyframes cc-dd-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 720px) {
    /* Сегменти в стовпчик — «пігулка» стає картою з заокругленими кутами. */
    .cc-dd--loading .cc-dd__item,
    .cc-dd--loading .cc-dd__item:first-child,
    .cc-dd--loading .cc-dd__item:last-child {
        padding: 8px 12px;
    }

    .cc-dd--loading .cc-dd__item:first-child {
        border-radius: 8px 8px 0 0;
    }

    .cc-dd--loading .cc-dd__item:last-child {
        border-radius: 0 0 8px 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cc-dd__spinner {
        animation-duration: 3s;
    }
}

@media (max-width: 720px) {
    /* Сегменти один під одним: у рядок три фрази не вміщаються. */
    .cc-dd {
        flex-direction: column;
    }

    .cc-dd__item:first-child {
        border-radius: 8px 8px 0 0;
    }

    .cc-dd__item:last-child {
        border-radius: 0 0 8px 8px;
    }

    /* Сегменти в стовпчик — роздільник горизонтальний. */
    .cc-dd__item + .cc-dd__item::before {
        left: 12px;
        right: 12px;
        top: 0;
        width: auto;
        height: 1px;
        transform: none;
    }
}

/* Значення в цьому рядку вужче за поля картки (Figma: 180×20). */
.cc-locked--extra {
    width: 180px;
    height: 20px;
}

@media (max-width: 720px) {
    .cc-extra__item {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* Підпис переноситься, а не випихає «пігулку» за край картки. */
    .cc-extra__item > .cc-label {
        flex: 0 1 auto;
        min-width: 0;
        white-space: normal;
    }

    .cc-locked--extra {
        width: auto;
        flex: 1 1 auto;
        min-width: 80px;
    }
}
