/* Moduł kontaktów
   =====================================================
   LAYOUT GŁÓWNY
   ===================================================== */

.kontakty-wrap {
    display: flex;
    gap: 16px;
    width: 100%;
    min-height: 400px;
}

/* ===== LEWA KOLUMNA (DRZEWO) ===== */

.kontakty-left {
    width: 40%;
    background: #f7fafc;              /* KLUCZOWE – separacja od tła systemu */
    border-radius: 8px;
    padding: 12px;
    box-shadow: inset 0 0 0 1px #dce3ea;
	text-align: left;
}

/* ===== PRAWA KOLUMNA (OPIS) ===== */

.kontakty-right {
    width: 60%;
    padding: 16px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}


/* =====================================================
   DRZEWO KONTAKTÓW
   ===================================================== */

.lista-grup,
.lista-podgrupa {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lista-podgrupa {
    margin-left: 18px;
    padding-left: 6px;
    border-left: 1px dashed #cfd8dc;
}


/* ===== POJEDYNCZY WIERSZ ===== */

.grupa-row {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;

    background: #ffffff;              /* WYRAŹNE WIERSZE */
    border: 1px solid #e3e9ef;        /* ZAMIAST CIENI */

    transition: background 0.15s ease,
                border-color 0.15s ease;
}

.grupa-row:hover {
    background: #f0f8ff;              /* WIDOCZNY HOVER */
    border-color: #0095da;
}


/* ===== IKONA ROZWIJANIA ===== */

.grupa-toggle {
    width: 28px;
    text-align: center;
    margin-right: 6px;
    opacity: 0.8;
}

.grupa-toggle img {
    width: 18px;
    cursor: pointer;
}


/* ===== TEKST ===== */

.grupa-tekst {
    flex: 1;
}

.nazwa-grupy {
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.2px;
    color: #1a1a1a;
}

.grupa-row:hover .nazwa-grupy {
    color: #0095da;
}


/* ===== STAN AKTYWNY (BARDZO WAŻNE) ===== */

.grupa-row.active {
    background: #dff1fb;
    border-color: #0095da;
}


/* =====================================================
   OPIS KONTAKTU
   ===================================================== */

.opis-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.opis-row {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dotted #e0e0e0;
}

.opis-row:last-child {
    border-bottom: none;
}

.opis-label {
    font-weight: 600;
    min-width: 130px;
    color: #333;
}

.opis-value {
    flex: 1;
    color: #000;
}


/* ===== AKCJE ===== */

.opis-akcje {
    margin-top: 16px;
    display: flex;
    gap: 12px;
}

.opis-akcje img {
    width: 26px;
    cursor: pointer;
    opacity: 0.85;
}

.opis-akcje img:hover {
    opacity: 1;
}


/* ===== STAN PUSTY ===== */

.opis-pusty {
    color: #666;
    font-style: italic;
    line-height: 1.4;
}


/* =====================================================
   RESPONSYWNOŚĆ
   ===================================================== */

@media (max-width: 1200px) {
    .kontakty-wrap {
        flex-direction: column;
    }

    .kontakty-left,
    .kontakty-right {
        width: 100%;
    }
}
/* =====================================================
   WYSZUKIWANIE KONTAKTÓW
   ===================================================== */

.kontakty-search {
    position: relative;
    margin-bottom: 12px;
}

.kontakty-search input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #cfd8dc;
    font-size: 14px;
}

.kontakt-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #cfd8dc;
    border-top: none;
    max-height: 260px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.kontakt-search-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.kontakt-search-item:hover {
    background: #f0f8ff;
}

.kontakt-search-empty {
    padding: 10px;
    color: #777;
    font-style: italic;
}
.opis-search-item {
    padding: 12px;
    border: 1px solid #e3e9ef;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fafcff;
}
#modal_kontakty_connect {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

/* tło */
#modal_kontakty_connect .mkc-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}

/* okno */
#modal_kontakty_connect .mkc-box {
    position: relative;
    margin: auto;
    margin-top: 5vh;
    background: #fff;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden;
}

/* header */
#modal_kontakty_connect .mkc-header {
    background: #0095da;
    color: #fff;
    padding: 10px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* close */
#modal_kontakty_connect .mkc-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

/* content */
#modal_kontakty_connect .mkc-content {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}
#modal_kontakty_connect .mkc-ok {
    padding: 15px;
    background: #e6f7ec;
    color: #1d7a46;
    border: 1px solid #1d7a46;
    border-radius: 4px;
    font-weight: bold;
}

#modal_kontakty_connect .mkc-error {
    padding: 15px;
    background: #fdeaea;
    color: #a80000;
    border: 1px solid #a80000;
    border-radius: 4px;
    font-weight: bold;
}

.grupa-row.is-active > .grupa-tekst > .nazwa-grupy {
    background: #e8f1ff;
    color: #174f91;
    font-weight: 600;
}

.kontakt-duplicate-warning .save-result.warning {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid #e5b94f;
    border-radius: 6px;
    background: #fff8df;
    color: #5d470d;
}

.kontakt-usage {
    margin-top: 18px;
    border: 1px solid #d9e3ea;
    border-radius: 7px;
    background: #f8fbfd;
    overflow: hidden;
}

.kontakt-usage-title {
    padding: 9px 12px;
    background: #e8f4fa;
    color: #004c80;
    font-weight: bold;
}

.kontakt-usage-empty {
    padding: 12px;
    color: #68737b;
}

.kontakt-usage-group {
    padding: 10px 12px;
    border-top: 1px solid #dfe8ed;
}

.kontakt-usage-module {
    margin-bottom: 6px;
    color: #263b48;
    font-weight: bold;
}

.kontakt-usage-module span {
    display: inline-block;
    min-width: 18px;
    margin-left: 5px;
    padding: 1px 5px;
    border-radius: 10px;
    background: #0095da;
    color: #fff;
    text-align: center;
    font-size: 11px;
}

.kontakt-usage-row {
    display: grid;
    grid-template-columns: minmax(125px, 170px) 1fr;
    gap: 10px;
    padding: 5px 0;
    border-top: 1px dashed #dfe5e8;
}

.kontakt-usage-role {
    color: #66737b;
    font-size: 12px;
}

.kontakt-usage-object a {
    color: #006fa6;
    text-decoration: none;
}

.kontakt-usage-object a:hover {
    text-decoration: underline;
}

@media (max-width: 700px) {
    .kontakt-usage-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

/* Automatyczne rozpoznawanie wklejonych danych kontaktu */
.kontakt-smart-import {
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid #b9d8e8;
    border-radius: 7px;
    background: #f3faff;
    text-align: left;
}

.kontakt-smart-import textarea {
    box-sizing: border-box;
    width: 100%;
    margin: 7px 0;
    padding: 9px;
    resize: vertical;
    border: 1px solid #aebdc7;
    border-radius: 5px;
    background: white;
    color: #333;
    font: inherit;
}

.kontakt-smart-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.kontakt-smart-button {
    padding: 7px 12px;
    border: 0;
    border-radius: 5px;
    background: #007db8;
    color: #fff;
    cursor: pointer;
}

.kontakt-smart-button:hover { background: #006494; }
#kontakt-smart-status { color: #176b3a; font-weight: bold; }

.kontakt-smart-elements {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.kontakt-smart-column {
    min-height: 70px;
    padding: 9px;
    border: 1px solid #b9d9c5;
    border-radius: 6px;
    background: #f4fbf6;
}

.kontakt-smart-unrecognized {
    border-color: #e3c98e;
    background: #fffaf0;
}

.kontakt-smart-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
}

.kontakt-smart-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid #8db6ca;
    border-radius: 14px;
    background: #fff;
    cursor: grab;
    overflow-wrap: anywhere;
}

.kontakt-smart-chip small {
    color: #547080;
    font-weight: bold;
}

.kontakt-smart-chip.is-selected {
    outline: 3px solid rgba(0, 125, 184, .25);
    border-color: #007db8;
}

#kontakt-edit-form input.kontakt-drop-target {
    outline: 2px dashed #007db8;
    background: #eef9ff;
}

.kontakt-smart-help {
    grid-column: 1 / -1;
    margin: 0;
    color: #55646d;
    font-size: 12px;
}

@media (max-width: 700px) {
    .kontakt-smart-elements { grid-template-columns: 1fr; }
}
