    /* ===== Body i osnovni layout ===== */
body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #121212;
    color: #fff; /*white*/
    display: flex;
    height: 100vh;
    overflow: hidden;
}

    /* ===== SVG container ===== */
    #container {
        flex: 1;
        cursor: grab;
        height: 100%;
        background: #111;
    }

        #container:active {
            cursor: grabbing;
        }

    svg {
        width: 100%;
        height: 100%;
        display: block;
    }

    /* ===== Table i kontrole ===== */
    table {
        width: 100%;
        border-collapse: collapse;
        font-size: 13px;
    }

th, td {
    border: 1px solid #555;
    padding: 5px;
    text-align: center;
    border: none; /* nema unutrašnjih */
}

    td {
        overflow-wrap: break-word;
    }

    tr.selected {
        background: #555 !important;
        color: black;
    }
tr.selectedwhite {
    background: #555 !important;
    color: white;
}

hr {
    width: 100%;
}

.swal2-container {
    z-index: 10060; /* ili više */
}


    /* ===== Rodoslovi i GEDCOM ===== */
    #rootSelector {
        position: relative;
        top: 0;
        right: 0;
        margin-right: 10px; /* mesto za panel */
        width: 340px;
        height: 100%;
        background: #2a2a2a;
        padding: 10px;
        box-sizing: border-box;
        overflow: hidden;
        z-index: 1000;
        display: block;
        flex-direction: column;
        border-left: 2px solid #ff9800;
        border-radius: 0 0 0 8px;
    }
@media (orientation: portrait) {
    #rootSelector {
        width: 100%;
        height: 40%;
    }
    #container {
        flex: 1;
        cursor: grab;
        height: 100%;
        background: #111;
    }
}

        #rootSelector button {
            margin: 3px 0;
            padding: 5px 8px;
            font-size: 12px;
            background: #ff9800;
            color: #000; /* black */
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.2s;
        }

            #rootSelector button:hover {
                filter: brightness(1.2);
                transform: translateY(-1px);
            }
    /* 🔥 DESNI PANEL */
    /* ===== DESNI PANEL ===== */
    #actionPanel {
        position: fixed;
        top: 10px;
        right: 5px;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        z-index: 5000;
    }

    /* ☰ dugme */
        #searchContainer #menuBtn {
            width: 30px;
            height: 30px;
            display: flex; /* 🔥 ključno */
            align-items: center; /* vertikalno centriranje */
            justify-content: center; /* horizontalno centriranje */
            flex-direction: column;
            cursor: pointer;
            background: gray;
            color: white;
            border: none;
            border-radius: 2px;
        }


#searchContainer #gedcomroot {
    width: 30px;
    height: 30px;
    display: flex; /* 🔥 ključno */
    align-items: center; /* vertikalno centriranje */
    font-size: 14px;
    justify-content: center; /* horizontalno centriranje */
    cursor: pointer;
    background: #ff9800;
    flex-direction: column;
    color: white;
    border: none;
    border-radius: 2px;
}

#searchContainer #gedcomroot span{
    font-size: 7px;
}

#actionPanel #scroll2TopBtn {
    width: 30px;
    height: 30px;
    bottom: 10px;
    background: gray;
    color: white;
    border: none;
    border-radius: 6px;
    position: fixed; /* važno da z-index radi */
    display: flex; /* 🔥 ključno */
    align-items: center; /* vertikalno centriranje */
    font-size: 14px;
    justify-content: center; /* horizontalno centriranje */
    cursor: pointer;
    flex-direction: column;
    right: 1px;
}
/* dropdown ispod dugmeta */
        #actionPanel #menuDropdown {
            display: none;
            flex-direction: column;
            position: absolute; /* 🔥 ovo rešava problem */
            top: 45px; /* ispod dugmeta */
            right: 0;
            background: #2a2a2a;
            max-height: calc(100vh - 60px); /* 🔥 KLJUČNO */
            overflow-y: auto; /* 🔥 scroll po visini */
            border-radius: 8px;
            padding: 8px;
            min-width: 200px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.5);
            z-index: 9500;
        }

        #actionPanel #menuOsobaTools {
            display: none;
            flex-direction: column;
            position: absolute; /* 🔥 ovo rešava problem */
            top: 45px; /* ispod dugmeta */
            top: 45px; /* ispod dugmeta */
            right: 0;
            background: #eee;
            color: black;
            max-height: calc(100vh - 150px); /* 🔥 KLJUČNO */
            overflow-y: auto; /* bolje nego overflow: auto */
            border-radius: 8px;
            padding: 8px;
            min-width: 300px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.5);
            z-index: 9500;
        }

        .tableWrapper {
            max-height: 300px; /* ili 40vh */
            overflow-y: auto;
        }
/* dugmad u dropdown-u */
        #actionPanel #menuDropdown button {
            padding: 8px 10px;
            text-align: left;
            border: none;
            background: white;
            cursor: pointer;
            font-size: 13px;
        }

        #menuDropdown button:hover {
            background: #eee;
        }

#gedcomWrap {
    flex: 1;
    overflow-y: auto;
    background: #333;
    padding: 8px;
    margin-top: 8px;
    border-radius: 6px;
}

    /* ===== Modern scroll bar ===== */
    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    ::-webkit-scrollbar-track {
        background: #1e1e1e;
        border-radius: 5px;
    }

    ::-webkit-scrollbar-thumb {
        background: #ff9800;
        border-radius: 5px;
    }

        ::-webkit-scrollbar-thumb:hover {
            background: #f57c00;
        }


#grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    padding: 15px;
}

/* ===== BASE CARD ===== */
.card {
    padding: 10px;
    border-radius: 12px;
    transition: 0.25s;
}

    .card img {
        width: 55px;
        height: 55px;
        border-radius: 50%;
        float: left;
        margin-right: 10px;
    }

    .card:hover {
        /*transform: scale(1.02);*/
    }

/* ===== TEMPLATES ===== */
.t-classic {
    background: #fff; /*white*/
    color: #111;
    border: 1px solid #ddd;
}

.t-dark {
    background: #111827;
    color: #e5e7eb;
    border: 1px solid #374151;
}

.t-neon {
    background: #000; /* black */
    color: #00ffd5;
    border: 1px solid #00ffd5;
    box-shadow: 0 0 10px #00ffd5;
}

.t-family {
    background: #fff7f0;
    color: #4a3f35;
    border: 1px solid #f2c6a0;
}

.t-paper {
    background: #f5f1e6;
    color: #3b2f2f;
    border: 1px solid #c4b79b;
    font-family: serif;
}

.t-lux {
    background: #1a1a1a;
    color: #f5d98b;
    border: 1px solid #d4af37;
}

.t-card {
    background: #fff; /*white*/
    color: #111;
    border-left: 5px solid #3b82f6;
}

.t-min {
    background: #fafafa;
    color: #111;
    border-bottom: 1px solid #ddd;
}

.family-card {
    width: 90%;
    margin: 8px auto;
    text-align: left;
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 5px;
}

    .card-top img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }

.name {
    font-size: 9px;
}

.card-body {
    font-size: 9px;
    color: #cbd5e1;
    line-height: 1.4;
}

.line {
    font-size: 8px;
    color: #aaa;
    margin-bottom: 4px;
}

.line1 {
    font-size: 10px;
    color: black;
    margin-bottom: 4px;
}

.line11 {
    font-size: 8px;
    color: black;
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    color: black;
    border: 1px solid #ccc;
    max-height: 220px;
    overflow-y: auto;
    z-index: 9999;
}

    .suggestions div {
        padding: 6px;
        cursor: pointer;
    }

        .suggestions div:hover {
            background: #eee;
        }


.templateOptions {
    display: flex;
    gap: 10px;
}

.templateItem {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    width: 20%;
}

.templateIcon {
    font-size: 16px;
    line-height: 1;
}

.templateItem span {
    font-size: 12px;
    text-align: center;
}

    
    @media (max-width: 768px) and (orientation: portrait) {
    body {
        flex-direction: column;
    }

    #rootSelector {
        width: 100%;
        height: 45%;
    }

    #container {
        height: 60%;
    }

    #actionPanel #scroll2TopBtn {
        width: 25px;
        height: 40px;
        bottom: 1px;
        right: 5px;
    }

    #searchContainer #menuBtn {
        position: fixed;
        top: 10px;
        right: 10px;
    }

    .card-body {
        font-size: 11px;
    }
}

#actionPanel,
#container,
#rootSelector {
    opacity: 0;
    transition: opacity 0.6s ease;
}

#menuDropdown .export-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

#menuDropdown .export-action-row button {
    flex: 0 0 calc(50% - 2px);
    width: calc(50% - 2px);
    max-width: calc(50% - 2px);
    min-width: 0;
    box-sizing: border-box;
    padding: 6px 4px;
    font-size: 10px;
}

#licenseMenuFooter {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 3px 0 5px;
    padding: 3px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    color: #ccc;
    font-size: 8px;
    line-height: 1.15;
}

    #licenseMenuFooter .license-menu-message {
        flex: 1 1 auto;
        min-width: 0;
        white-space: pre-line;
    }

    #licenseMenuFooter .license-menu-etsy {
        flex: 0 0 auto;
        display: inline-block;
        margin-top: 0;
        padding: 4px 7px;
        border-radius: 4px;
        background: #f16521;
        color: #fff;
        font-size: 8px;
        font-weight: 600;
        text-decoration: none;
    }

.licenseMenuFooter {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 3px 0 5px;
    padding: 3px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    color: #ccc;
    font-size: 8px;
    line-height: 1.15;
}

    .licenseMenuFooter .license-menu-message {
        flex: 1 1 auto;
        min-width: 0;
        white-space: pre-line;
    }

    .licenseMenuFooter .license-menu-etsy {
        flex: 0 0 auto;
        display: inline-block;
        margin-top: 0;
        padding: 4px 7px;
        border-radius: 4px;
        background: #f16521;
        color: #fff;
        font-size: 8px;
        font-weight: 600;
        text-decoration: none;
    }

@media (max-width: 768px) {
    #licenseMenuFooter {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 8px 6px;
        font-size: 10px;
        line-height: 1.35;
    }

    #licenseMenuFooter .license-menu-message {
        display: block;
        white-space: pre-line;
        overflow: visible;
    }

    #licenseMenuFooter .license-menu-etsy {
        align-self: flex-start;
        font-size: 10px;
        padding: 6px 9px;
    }
}


@media (max-width: 768px) and (orientation: landscape) {
    #rootSelector, #container {
        top: 40px;
    }
    #actionPanel #scroll2TopBtn {
        width: 25px;
        height: 35px;
        bottom: 5px;
        right: 10px;
    }
    #searchContainer #menuBtn {
        top: 5px;
        right: 5px;
    }
    .card-body {
        font-size: 11px;
    }
}


/* ===== MOBILE FIX: vise mesta za template-ove ===== */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    #licenseMenuFooter {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 8px 6px;
        font-size: 10px;
        line-height: 1.35;
    }

    #licenseMenuFooter .license-menu-message {
        display: block;
        white-space: pre-line;
        overflow: visible;
    }

    #licenseMenuFooter .license-menu-etsy {
        align-self: flex-start;
        font-size: 10px;
        padding: 6px 9px;
    }

    #container {
        height: 32vh !important;
        flex: 0 0 38vh !important;
    }

    #rootSelector {
        width: 100% !important;
        height: 68vh !important;
        flex: 0 0 62vh !important;
        margin-right: 0 !important;
        padding: 6px !important;
    }

    #gedcomWrap {
        height: calc(100% - 45px) !important;
        margin-top: 4px !important;
        padding: 5px !important;
    }

    #templateMenu {
        top: 42px !important;
        bottom: 0 !important;
        height: auto !important;
        padding: 5px !important;
    }

    #templateMenu .back-picker {
        gap: 5px !important;
    }
}
