/* ================================================================
   TEŞKİLAT ŞEMASI

   GM -> GMY -> BAŞKANLIK -> ŞUBE

   Masaüstü : satırda maksimum 4
   Tablet    : satırda maksimum 2
   Mobil     : 1

   1 / 2 / 3 kayıt gelirse otomatik ortalanır.
   Ana bağlantılar SVG ile JS tarafından çizilir.
   ================================================================ */

.teskilat-section {
    padding: 56px 0 90px;
    background: #fff;
}


/* ================================================================
   TOOLBAR
   ================================================================ */

.teskilat-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--gsb-border, #e5e7eb);
}

/*
 * Artık şubelerde aç/kapa olmadığı için kullanılmıyor.
 * Razor'da buton kalsa bile görünmez.
 */
.teskilat-toggle-all {
    display: none !important;
}


/* ================================================================
   CHART
   ================================================================ */

#teskilatChart,
.teskilat-chart {
    position: relative;
    width: 100%;
    overflow: visible;
}

.teskilat-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: #6b7280;
    font-size: .9rem;
}

.tsk-tree {
    --tsk-line: #d3d8df;
    --tsk-red: var(--gsb-red, #e3001b);
    --tsk-dark: var(--gsb-dark, #20252b);
    position: relative;
    width: 100%;
}


    /* ================================================================
   HTML RESET
   ================================================================ */

    .tsk-tree ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .tsk-tree li {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .tsk-tree h2,
    .tsk-tree h3,
    .tsk-tree h4,
    .tsk-tree p {
        margin-top: 0;
    }

    .tsk-tree a {
        color: inherit;
        text-decoration: none;
    }

        .tsk-tree a:hover {
            color: var(--tsk-red);
        }


/* ================================================================
   ORTAK KART
   ================================================================ */

.tsk-node {
    position: relative;
    z-index: 2;
    width: 100%;
    background: #fff;
    border: 1px solid #e1e5ea;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(17, 24, 39, .045);
}

.tsk-node-text {
    min-width: 0;
    width: 100%;
}

.tsk-node-image {
    display: block;
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
    max-width: 72px;
    max-height: 72px;
    margin: 0 auto 10px;
    object-fit: cover;
    object-position: center;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    background: #fff;
}

.tsk-node-gm .tsk-node-image {
    border-color: rgba(255, 255, 255, .85);
}
.tsk-node-sm .tsk-node-image {
    width: 58px;
    height: 58px;
    min-width: 58px;
    min-height: 58px;
    max-width: 58px;
    max-height: 58px;
    margin-bottom: 8px;
}
.tsk-unit-line {
    display: block;
    width: 100%;
}


/* Eski ikon/avatar varsa gösterme */

.tsk-avatar,
.tsk-icon {
    display: none !important;
}


/* ================================================================
   GENEL MÜDÜR
   ================================================================ */

.tsk-root {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: center;
    width: 100%;
}

.tsk-node-gm {
    width: 340px;
    max-width: 100%;
    padding: 16px 20px;
    text-align: center;
    background: var(--tsk-dark);
    border-color: var(--tsk-dark);
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(17, 24, 39, .14);
}

    .tsk-node-gm .tsk-badge {
        display: block;
        margin-bottom: 5px;
        color: rgba(255, 255, 255, .68);
        font-size: .69rem;
        font-weight: 700;
        letter-spacing: .7px;
        text-transform: uppercase;
    }

    .tsk-node-gm .tsk-name {
        margin: 0;
        color: #fff;
        font-size: 1.05rem;
        font-weight: 800;
        line-height: 1.35;
    }

        .tsk-node-gm .tsk-name a {
            color: #fff;
        }

            .tsk-node-gm .tsk-name a:hover {
                color: #fff;
                text-decoration: underline;
            }

.tsk-org {
    margin: 5px 0 0 !important;
    color: rgba(255, 255, 255, .6);
    font-size: .76rem;
    line-height: 1.35;
}


/* ================================================================
   GENEL MÜDÜR YARDIMCISI
   ================================================================ */

.tsk-node-gmy {
    display: flex;
    align-items: center;
    min-height: 78px;
    padding: 14px 16px;
    text-align: center;
    background: #fff;
    border-top: 3px solid var(--tsk-red);
}

    .tsk-node-gmy .tsk-badge {
        display: block;
        margin-bottom: 5px;
        color: var(--tsk-red);
        font-size: .65rem;
        font-weight: 700;
        letter-spacing: .5px;
        text-transform: uppercase;
    }

    .tsk-node-gmy .tsk-name {
        margin: 0;
        color: var(--tsk-dark);
        font-size: .92rem;
        font-weight: 800;
        line-height: 1.35;
    }


/* ================================================================
   BAŞKANLIK
   ================================================================ */

.tsk-node-db {
    overflow: hidden;
    background: #fff;
}

    .tsk-node-db:hover {
        border-color: rgba(227, 0, 27, .32);
    }

.tsk-node-main {
    display: block;
    padding: 14px 15px;
}

.tsk-node-db .tsk-unit {
    margin: 0;
    color: var(--tsk-dark);
    font-size: .86rem;
    font-weight: 750;
    line-height: 1.4;
    overflow-wrap: anywhere;
}


/* ================================================================
   PERSONEL / UNVAN

   Unvan artık JS tarafından sabit üretilmiyor.
   HTML içindeki .org-person-title okunuyor.
   ================================================================ */

.tsk-person {
    margin: 8px 0 0 !important;
    color: #4b5563;
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.35;
}

.tsk-person-title {
    display: block;
    margin-bottom: 2px;
    color: #9ca3af;
    font-size: .61rem;
    font-weight: 700;
    letter-spacing: .45px;
    text-transform: uppercase;
}

.tsk-person-name {
    display: block;
    color: #4b5563;
    font-size: .76rem;
    font-weight: 650;
}


/* ================================================================
   ŞUBELER
   ================================================================ */

.tsk-sm-list {
    position: relative;
    margin-top: 10px !important;
    padding-left: 24px !important;
}

.tsk-sm {
    position: relative;
    padding-top: 8px !important;
}


    /*
 * Başkanlıktan aşağı inen şube ağacı
 */

    .tsk-sm::before {
        content: "";
        position: absolute;
        left: -14px;
        top: 0;
        bottom: 0;
        width: 1px;
        background: var(--tsk-line);
    }

    .tsk-sm:last-child::before {
        height: 27px;
    }

    .tsk-sm::after {
        content: "";
        position: absolute;
        left: -14px;
        top: 26px;
        width: 14px;
        height: 1px;
        background: var(--tsk-line);
    }


/* Şube kartı */

.tsk-node-sm {
    display: block;
    min-height: 52px;
    padding: 10px 12px;
    background: #f7f8fa;
    border-color: #e3e6ea;
    border-radius: 8px;
    box-shadow: none;
}

    .tsk-node-sm .tsk-unit {
        margin: 0;
        color: #3f4752;
        font-size: .76rem;
        font-weight: 650;
        line-height: 1.4;
    }

    .tsk-node-sm .tsk-person {
        margin-top: 5px !important;
        font-size: .71rem;
    }


/* ================================================================
   SVG ANA BAĞLANTILARI
   ================================================================ */

.tsk-connectors-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}

    .tsk-connectors-svg path {
        fill: none;
        stroke: var(--tsk-line);
        stroke-width: 1.5;
        stroke-linecap: round;
        stroke-linejoin: round;
        vector-effect: non-scaling-stroke;
    }


/* ================================================================
   GM -> GMY

   EN FAZLA 4.

   Flex kullanıyoruz:
   1 kayıt -> ortada
   2 kayıt -> ortada
   3 kayıt -> ortada
   4 kayıt -> tam satır
   5+      -> alt satıra geçer
   ================================================================ */

.tsk-gmy-list {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 56px 20px;
    width: 100%;
    margin-top: 78px !important;
    padding: 0 !important;
}

    .tsk-gmy-list > .tsk-gmy {
        position: relative;
        flex: 0 0 calc((100% - 60px) / 4);
        width: calc((100% - 60px) / 4);
        max-width: calc((100% - 60px) / 4);
        min-width: 0;
    }


/* ================================================================
   GMY -> BAŞKANLIK

   Birden fazla GMY varsa başkanlıklar kendi GMY alanında kalır.
   ================================================================ */

.tsk-gmy > .tsk-db-list {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    margin-top: 42px !important;
    padding: 0 !important;
}

    .tsk-gmy > .tsk-db-list > .tsk-db {
        position: relative;
        width: 100%;
        min-width: 0;
    }


/*
 * Tek GMY olduğunda altındaki başkanlıklar da
 * maksimum 4'lü dinamik satır olabilir.
 */

.tsk-gmy:only-child > .tsk-db-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 48px 14px;
    width: calc(400% + 60px);
    margin-left: calc(-150% - 30px) !important;
}

    .tsk-gmy:only-child >
    .tsk-db-list >
    .tsk-db {
        flex: 0 0 calc((100% - 42px) / 4);
        width: calc((100% - 42px) / 4);
        max-width: calc((100% - 42px) / 4);
    }


/* ================================================================
   GM -> BAŞKANLIK
   GMY YOKSA

   Yine maksimum 4 ve dinamik ortalama.
   ================================================================ */

.tsk-tree-direct {
    position: relative;
    width: 100%;
}

.tsk-direct-db-list {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 62px 20px;
    width: 100%;
    margin: 78px 0 0 !important;
    padding: 0 !important;
}

    .tsk-direct-db-list >
    .tsk-db {
        position: relative;
        flex: 0 0 calc((100% - 60px) / 4);
        width: calc((100% - 60px) / 4);
        max-width: calc((100% - 60px) / 4);
        min-width: 0;
    }


        /* ================================================================
   ESKİ CSS CONNECTOR'LARINI KAPAT
   ================================================================ */

        .tsk-tree > .tsk-root::before,
        .tsk-tree > .tsk-root::after,
        .tsk-gmy-list::before,
        .tsk-gmy-list::after,
        .tsk-gmy::before,
        .tsk-gmy::after,
        .tsk-db-list::before,
        .tsk-db-list::after,
        .tsk-db-list > .tsk-db::before,
        .tsk-db-list > .tsk-db::after,
        .tsk-direct-db-list::before,
        .tsk-direct-db-list::after,
        .tsk-direct-db-list >
        .tsk-db::before,
        .tsk-direct-db-list >
        .tsk-db::after {
            display: none !important;
            content: none !important;
        }


/* ================================================================
   TABLET
   EN FAZLA 2
   ================================================================ */

@media (max-width: 1199.98px) {

    .tsk-gmy-list,
    .tsk-direct-db-list {
        gap: 54px 18px;
    }

        .tsk-gmy-list >
        .tsk-gmy,
        .tsk-direct-db-list >
        .tsk-db {
            flex-basis: calc((100% - 18px) / 2);
            width: calc((100% - 18px) / 2);
            max-width: calc((100% - 18px) / 2);
        }


    /*
     * Tablet boyutunda GMY altındaki
     * başkanlıkları kendi kolonunda tut.
     */

    .tsk-gmy:only-child >
    .tsk-db-list {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin-left: 0 !important;
        margin-top: 24px !important;
        gap: 14px;
    }

        .tsk-gmy:only-child >
        .tsk-db-list >
        .tsk-db {
            flex: none;
            width: 100%;
            max-width: 100%;
        }
}


/* ================================================================
   MOBİL
   ================================================================ */

@media (max-width: 991.98px) {

    .teskilat-section {
        padding: 36px 0 64px;
    }

    .teskilat-toolbar {
        margin-bottom: 24px;
    }


    /*
     * Mobilde ana SVG yok.
     */

    .tsk-connectors-svg {
        display: none;
    }


    /* GM */

    .tsk-node-gm {
        width: 100%;
    }


    /* GMY */

    .tsk-gmy-list {
        display: block;
        margin-top: 24px !important;
    }

        .tsk-gmy-list >
        .tsk-gmy {
            width: 100%;
            max-width: 100%;
            margin-bottom: 18px !important;
        }


    /* Başkanlık */

    .tsk-direct-db-list {
        display: block;
        margin-top: 24px !important;
    }

        .tsk-direct-db-list >
        .tsk-db {
            width: 100%;
            max-width: 100%;
            margin-bottom: 18px !important;
        }


    .tsk-gmy >
    .tsk-db-list,
    .tsk-gmy:only-child >
    .tsk-db-list {
        display: block;
        width: 100%;
        margin: 16px 0 0 !important;
    }

        .tsk-gmy >
        .tsk-db-list >
        .tsk-db,
        .tsk-gmy:only-child >
        .tsk-db-list >
        .tsk-db {
            width: 100%;
            max-width: 100%;
            margin-bottom: 14px !important;
        }


    /* Şube ağacı */

    .tsk-sm-list {
        padding-left: 20px !important;
    }
}


/* ================================================================
   TELEFON
   ================================================================ */

@media (max-width: 575.98px) {

    .tsk-node-gm {
        padding: 14px 16px;
    }

        .tsk-node-gm .tsk-name {
            font-size: .98rem;
        }

    .tsk-node-gmy {
        min-height: auto;
        padding: 13px 14px;
    }

    .tsk-node-main {
        padding: 12px 13px;
    }

    .tsk-node-db .tsk-unit {
        font-size: .82rem;
    }

    .tsk-sm-list {
        padding-left: 17px !important;
    }
}

/* ================================================================
   TEŞKİLAT KARTLARI - METİNLERİ ORTALA
   ================================================================ */

.tsk-node,
.tsk-node-text,
.tsk-unit,
.tsk-person,
.tsk-person-title,
.tsk-person-name {
    text-align: center;
}