/* media/com_meetingfeedback/css/listview.css */

/* listview.css — ACTIVE */

/* ============================================================
   GLOBAL / VIEW ROOT
   ============================================================ */

html, body {
    height: 100%;
}

body {
    overflow: hidden; /* body НЕ скролиться */
}


/* ============================================================
   MAIN LAYOUT (LEFT / RESIZER / RIGHT)
   ============================================================ */

.mf-lv {
    display: flex;
    width: 100%;
    height: calc(100vh - 56px); /* верхнє меню */
    min-height: 0;              /* 🔴 критично для flex-scroll */
    overflow: hidden;
}


/* ============================================================
   LEFT PANEL — CATEGORIES
   ============================================================ */

.mf-lv__left {
    width: 320px;
    flex-shrink: 0;

    display: flex;
    flex-direction: column;

    border-right: 1px solid #ddd;
    box-sizing: border-box;
    min-height: 0;              /* 🔴 критично */
}

.mf-lv__title {
    flex: 0 0 auto;
    font-weight: 600;
    padding: 8px 10px;
}

.mf-tree {
    flex: 1 1 auto;
    min-height: 0;              /* 🔴 критично */
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 24px;       /* щоб останній пункт не “лип” */
}


/* ============================================================
   TREE VIEW — UX
   ============================================================ */

.mf-tree-item {
    margin: 0;
}

.mf-tree-title {
    display: block;
    padding: 2px 6px;
    border-radius: 6px;

    color: #0d6efd;
    text-decoration: none;
    line-height: 1.25;

    transition: background .15s ease, color .15s ease;
}

.mf-tree-title:hover {
    background: #f1f5ff;
    text-decoration: none;
}

.mf-tree-item.is-active > .mf-tree-title {
    background: #e7f0ff;
    color: #084298;
    font-weight: 600;
    position: relative;
}

.mf-tree-item.is-active > .mf-tree-title::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 3px;
    background: #0d6efd;
}


/* ============================================================
   RESIZER
   ============================================================ */

.mf-lv__resizer {
    width: 6px;
    cursor: col-resize;
    background: #eee;
    position: relative;
}

.mf-lv__resizer:hover {
    background: #d0d7e2;
}

.mf-lv__resizer::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 2px;
    width: 2px;
    background: #b6c0d1;
    opacity: 0.7;
}


/* ============================================================
   RIGHT PANEL — CONTACTS
   ============================================================ */

.mf-lv__right {
    flex: 1;

    display: flex;
    flex-direction: column;

    min-height: 0;              /* 🔴 КЛЮЧОВЕ */
    overflow: hidden;
}


/* ============================================================
   TABLE SCROLL CONTAINER
   ============================================================ */

.mf-lv-table-wrap {
    flex: 1 1 auto;
    min-height: 0;              /* 🔴 КЛЮЧОВЕ */
    overflow-y: auto;
    overflow-x: hidden;
}

/* шапка */
.mf-lv-table-head {
    flex: 0 0 auto;
    border-bottom: 1px solid #dee2e6;
}

/* тіло — ЄДИНИЙ СКРОЛ */
.mf-lv-table-body {
    flex: 1 1 auto;
    min-height: 0;        /* 🔴 КРИТИЧНО */
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================================
   TABLE BASE
   ============================================================ */

.mf-lv__table {
    width: 100%;
    table-layout: fixed;
}

.mf-lv__table th,
.mf-lv__table td {
    padding: 6px 8px;
    vertical-align: middle;
    text-align: left;
}

.mf-lv__table th {
    font-weight: 600;
    background: #f8f9fa;
    white-space: nowrap;
}


/* ============================================================
   STICKY TABLE HEADER
   ============================================================ */

.mf-lv__table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}


/* ============================================================
   COLUMN WIDTHS & ALIGN FIXES
   ============================================================ */

/* checkbox */
.mf-lv__table th:first-child,
.mf-lv__table td:first-child {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    text-align: center;
    padding-left: 0;
    padding-right: 0;
}

/* № */
.mf-lv__table th:nth-child(2),
.mf-lv__table td:nth-child(2) {
    width: 52px;
    text-align: center;
}

/* ПІБ */
.mf-lv__table th:nth-child(3),
.mf-lv__table td:nth-child(3) {
    padding-left: 4px;
}

/* Категорія */
.mf-lv__table th:nth-child(5),
.mf-lv__table td:nth-child(5) {
    padding-left: 4px;
}

/* Посада */
.mf-lv__table th:nth-child(6),
.mf-lv__table td:nth-child(6) {
    padding-left: 4px;
}


/* ============================================================
   PHOTOS
   ============================================================ */

.mf-contact-photo {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}


/* ============================================================
   LEADER MARKERS
   ============================================================ */

.mf-leader-cat {
    color: #555;
    margin-right: 4px;
    font-size: .9em;
}

.mf-leader-cat--current {
    color: #f4b400;
    text-shadow: 0 0 2px rgba(0,0,0,.15);
}


/* ============================================================
   MODALS — BASE
   ============================================================ */

.mf-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.mf-modal.is-open {
    display: block;
}

.mf-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
}

.mf-modal__dialog {
    position: relative;
    background: #fff;
    margin: 5vh auto;
    padding: 12px;
    border-radius: 12px;
}

.mf-modal__dialog .modal-header,
.mf-modal__dialog .btn-close,
.mf-modal__dialog .close {
    display: none !important;
}


/* ============================================================
   PHOTO MODAL
   ============================================================ */

.mf-photo-dialog {
    max-width: 720px;
    text-align: center;
}

#mfPhotoModalImg {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 10px;
}


/* ============================================================
   LIST MODAL (already polished)
   ============================================================ */

.mf-list-dialog {
    width: 720px;
    max-width: 95vw;
    height: 520px;
    max-height: 90vh;

    display: flex;
    flex-direction: column;

    resize: both;
    overflow: hidden;
}

.mf-list-header {
    flex: 0 0 auto;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.mf-list-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}


/* ===== FIX: колонка Фото ===== */
.mf-lv__table th:nth-child(4),
.mf-lv__table td:nth-child(4) {
    width: 56px;
    min-width: 56px;
    max-width: 56px;

    padding-left: 4px;
    padding-right: 4px;
    text-align: center;
}


.mf-contact-photo {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
}

/* ===== CHECKBOX COLUMN ===== */
.mf-col-check {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    text-align: center;
    padding-left: 0;
    padding-right: 0;
}

/* === EXTENDED VIEW (тільки для лідерів) === */
body:not(.mf-can-extended) .mf-col-phone,
body:not(.mf-can-extended) .mf-col-tg,
body:not(.mf-can-extended) .mf-col-birth {
    display: none;
}

/* === CATEGORY LEADER (tree) — teal/green === */
.mf-tree-item.is-leader > .mf-tree-title {
    background: #e6f6f4;        /* дуже світлий бірюзовий */
    color: #0f766e;             /* темний teal */
    font-weight: normal;        /* не жирний, як і домовлялись */
}

.mf-tree-item.is-leader > .mf-tree-title::after {
/*    content: '★'; */
    margin-left: 6px;
    font-size: 0.8em;
    color: #14b8a6;             /* акцентна бірюза */
}

/* === ACTIVE + LEADER: active має пріоритет === */
.mf-tree-item.is-leader.is-active > .mf-tree-title {
    font-weight: 600;
    background: #e7f0ff;
    color: #084298;
}

.mf-tg-icon {
    font-size: 1.1em;
    color: #0d6efd;
    cursor: default;
}

/* TG — вузька */
.mf-lv__table th.mf-col-tg,
.mf-lv__table td.mf-col-tg {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    text-align: center;
}

/* Телефон */
.mf-lv__table th.mf-col-phone,
.mf-lv__table td.mf-col-phone {
    width: 130px;
    white-space: nowrap;
}

/* Списки — хай дихають */
.mf-lv__table th.mf-col-lists,
.mf-lv__table td.mf-col-lists {
    width: auto;
}

/* Дата народження — компактно */
.mf-col-birth {
    width: 90px;
    max-width: 90px;
    white-space: nowrap;
    text-align: center;
}

/* Списки — нехай займають простір */
.mf-col-lists {
    min-width: 320px;
    white-space: normal;
}

/* Всі рядки таблиці — вирівнювання по верху */
.mf-lv__table td {
    vertical-align: top !important;
}

/* Непарні */
.mf-lv__table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Парні */
.mf-lv__table tbody tr:nth-child(even) {
    background-color: #f9fafb; /* дуже світло-сірий */
}



/* ============================================================
   ================= MOBILE VERSION ONLY ======================
   ============================================================ */

@media (max-width: 768px) {

    /* Дозволяємо нормальний скрол сторінки */
    html, body {
        height: auto;
    }

    body {
        overflow: auto;
    }

    /* Переводимо layout у вертикальний */
    .mf-lv {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    /* Ліва панель стає верхнім блоком */
    .mf-lv__left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
        max-height: 260px;
    }

    .mf-tree {
        max-height: 220px;
        overflow-y: auto;
    }

    .mf-lv__resizer {
        display: none;
    }

    /* Права частина */
    .mf-lv__right {
        overflow: visible;
    }

    /* Таблиця — горизонтальний скрол */
    .mf-lv-table-wrap {
        overflow-x: auto;
        overflow-y: visible;
    }

    .mf-lv__table {
        min-width: 900px;
    }


    /* Фото трохи менше */
    .mf-contact-photo {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
    }

    /* Менші падінги */
    .mf-lv__table th,
    .mf-lv__table td {
        padding: 5px 6px;
    }

}
