﻿/* ---------- GRID SECTION TITLES ---------- */
.grid-section-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #183b73;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 5px 0 8px 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .grid-section-title .count {
        font-size: 13px;
        font-weight: 600;
        color: #7c8aa3;
        background: #eef1f6;
        padding: 2px 8px;
        border-radius: 10px;
        text-transform: none;
        letter-spacing: 0;
    }

/* ---------- GRID SHARED (osnova za oba grida) ---------- */
.grid-kamata {   
    border-collapse: separate;
    border-spacing: 0;
    font-family: "Segoe UI", sans-serif;
    font-size: 13.5px;
    background: #ffffff;
    border: 1px solid #dde3ee;
    border-radius: 8px;
    overflow: hidden;
}

    .grid-kamata td {
        padding: 11px 16px;
        color: #1e2a3a;
        border-top: 1px solid #eef1f6;
    }

    .grid-kamata tr:first-child td {
        border-top: none;
    }

    .grid-kamata tr:hover td {
        background: #f3f6fb;
    }

    .grid-kamata .col-iznos {
        font-weight: 700;
        color: #063b82;
        text-align: right;
    }

    .grid-kamata .col-num {
        text-align: right;
    }

    .grid-kamata .btn-delete-row {
        background: none;
        border: none;
        color: #b8c5d8;
        cursor: pointer;
        font-size: 15px;
        transition: color 0.15s ease;
        padding: 4px;
    }

        .grid-kamata .btn-delete-row:hover {
            color: #c0392b;
        }

/* ---------- GRID 1 - DODATE STAVKE (privremeno, pre obračuna) ---------- */
.grid-stavke th {
    background: #f5f8fc;
    color: #183b73;
    text-align: left;
    padding: 9px 16px;
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #dde3ee;
}

.grid-stavke tr:nth-child(even) td {
    background: #fbfcfe;
}

.grid-stavke tr:nth-child(even):hover td {
    background: #f3f6fb;
}

/* ---------- GRID 2 - SVE STAVKE / REZULTATI OBRAČUNA ---------- */
.grid-sve th {
    background: #183b73;
    color: #ffffff;
    text-align: left;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.grid-sve tr:nth-child(even) td {
    background: #f7f9fc;
}

.grid-sve tr:nth-child(even):hover td {
    background: #eef3fa;
}

.grid-sve .row-total td {
    background: #eef3fa;
    font-weight: 700;
    color: #183b73;
    border-top: 2px solid #183b73;
}

/* opciono - empty state kad nema stavki */
.grid-empty {
    padding: 28px 16px;
    text-align: center;
    color: #9aa5ba;
    font-size: 13px;
    background: #fff;
    border: 1px dashed #dde3ee;
    border-radius: 8px;
}

/* =========================================================
   GRID 2 - PLAN OTPLATE
   ========================================================= */

.plan-otplate-wrapper2 {
    height: calc(95vh - 360px);
    min-height: 300px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #dde3ee;
    border-radius: 8px;    
    min-width:580px;
}

.plan-otplate-wrapper3 {
    height: calc(99vh - 360px);
    min-height: 300px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #dde3ee;
    border-radius: 8px;
    min-width: 580px;
}


/* ---------- OSNOVA GRIDA ---------- */

.grid-kamata2 {
    border-collapse: separate;
    border-spacing: 0;    
    font-family: "Segoe UI", sans-serif;
    font-size: 13.5px;
    background: #ffffff;
    border: none;
    border-radius: 0;
}


    /* ---------- ĆELIJE ---------- */

    .grid-kamata2 td {
        padding: 11px 16px;
        color: #1e2a3a;
        border-top: 1px solid #eef1f6;
    }


    /* ---------- IZNOS ---------- */

    .grid-kamata2 .col-iznos2 {
        font-weight: 700;
        color: #063b82;
        text-align: right;
    }


    /* ---------- MUTED KOLONE ---------- */

    .grid-kamata2 .col-muted2 {
        text-align: right;
    }


/* =========================================================
   HEADER - STICKY
   ========================================================= */

.grid-sve2 th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #183b73;
    color: #ffffff;
    text-align: left;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #183b73;
}


/* =========================================================
   REDOVI
   ========================================================= */

.grid-sve2 tr:nth-child(even) td {
    background: #f7f9fc;
}

.grid-sve2 tr:nth-child(even):hover td {
    background: #eef3fa;
}

.grid-sve2 tr:hover td {
    background: #f3f6fb;
}


/* =========================================================
   FOOTER - UKUPNO / STICKY NA DNU
   ========================================================= */

.grid-sve2 .row-total2 td {
    position: sticky;
    bottom: 0;
    z-index: 9;
    background: #eef3fa;
    font-weight: 700;
    color: #183b73;
    border-top: 2px solid #183b73;
}


    /* =========================================================
   AKO FOOTER IMA SKRIVENU DRUGU ĆELIJU
   ========================================================= */

    .grid-sve2 .row-total2 td:first-child {
        text-align: left;
    }




/* =========================================================
   MOBILNI PRIKAZ — GRIDOVI (zajednički)
   ========================================================= */
@media (max-width: 900px) {

    /* ---------- WRAPPERI (plan otplate) ---------- */
    .plan-otplate-wrapper2,
    .plan-otplate-wrapper3 {
        height: auto !important;
        max-height: 420px !important;
        min-height: 0 !important;
        min-width: 0 !important;
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* ---------- ZAJEDNIČKA PRAVILA ZA SVE GRIDOVE ---------- */
    .grid-kamata,
    .grid-stavke,
    .grid-sve,
    .grid-kamata2,
    .grid-sve2 {
        display: table !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
        background: #fff !important;
        border: none !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        font-size: 11px !important;
    }

        .grid-kamata th, .grid-kamata td,
        .grid-stavke th, .grid-stavke td,
        .grid-sve th, .grid-sve td,
        .grid-kamata2 th, .grid-kamata2 td,
        .grid-sve2 th, .grid-sve2 td {
            padding: 7px 3px !important;
            font-size: 11px !important;
            line-height: 1.2 !important;
            white-space: normal !important;
            word-wrap: break-word !important;
            overflow-wrap: anywhere !important;
            text-align: center !important;
            vertical-align: middle !important;
            border-top: none !important;
            border-bottom: 1px solid #eef1f6 !important;
        }

        /* ---------- HEADER (tamno plav) ---------- */
        .grid-kamata th,
        .grid-stavke th,
        .grid-sve th,
        .grid-kamata2 th,
        .grid-sve2 th {
            background: #16265c !important;
            color: #fff !important;
            font-weight: 700 !important;
            font-size: 10px !important;
            text-transform: uppercase !important;
            padding: 9px 3px !important;
            line-height: 1.15 !important;
            position: static !important;
            border-bottom: none !important;
        }

        /* ---------- ZEBRA REDOVI ---------- */
        .grid-kamata tr:nth-child(even) td,
        .grid-stavke tr:nth-child(even) td,
        .grid-sve tr:nth-child(even) td,
        .grid-kamata2 tr:nth-child(even) td,
        .grid-sve2 tr:nth-child(even) td {
            background: #f9fafc !important;
        }

        /* ---------- NUMERIČKE KOLONE (desno) ---------- */
        .grid-kamata td.col-num,
        .grid-kamata td.col-iznos,
        .grid-kamata2 td.col-num,
        .grid-kamata2 td.col-iznos2,
        .grid-kamata2 td.col-muted2 {
            text-align: right !important;
            padding-right: 5px !important;
            font-variant-numeric: tabular-nums !important;
            font-weight: 600 !important;
            color: #16265c !important;
        }

        /* ---------- DELETE IKONICA ---------- */
        .grid-kamata td a img,
        .grid-kamata td input[type="image"],
        .grid-stavke td a img,
        .grid-stavke td input[type="image"] {
            width: 18px !important;
            height: 18px !important;
            vertical-align: middle;
        }

        /* ---------- GRID 1: DODATE STAVKE (4 kolone) ---------- */
        .grid-stavke th:nth-child(1), .grid-stavke td:nth-child(1),
        .grid-stavke th:nth-child(2), .grid-stavke td:nth-child(2) {
            width: 22% !important;
        }

        .grid-stavke th:nth-child(3), .grid-stavke td:nth-child(3) {
            width: 36% !important;
        }

        .grid-stavke th:nth-child(4), .grid-stavke td:nth-child(4) {
            width: 20% !important;
            text-align: center !important;
        }

        /* ---------- GRID 2: SVE STAVKE (7 kolona) ---------- */
        .grid-sve th:nth-child(1), .grid-sve td:nth-child(1),
        .grid-sve th:nth-child(2), .grid-sve td:nth-child(2) {
            width: 15% !important;
        }

        .grid-sve th:nth-child(3), .grid-sve td:nth-child(3) {
            width: 9% !important;
        }

        .grid-sve th:nth-child(4), .grid-sve td:nth-child(4) {
            width: 16% !important;
        }

        .grid-sve th:nth-child(5), .grid-sve td:nth-child(5) {
            width: 10% !important;
        }

        .grid-sve th:nth-child(6), .grid-sve td:nth-child(6) {
            width: 17% !important;
        }

        .grid-sve th:nth-child(7), .grid-sve td:nth-child(7) {
            width: 18% !important;
        }
}
/* =========================================================
   JMBG TABELA — mobilni override (labela levo, vrednost desno)
   ========================================================= */
@media (max-width: 900px) {

    /* Kontejner tabele JMBG — full width, bez fiksnog max-width */
    .table-scroll-wrap {
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

        /* Sama tabela */
        .table-scroll-wrap .grid-kamata {
            display: table !important;
            width: 100% !important;
            min-width: 0 !important;
            max-width: 100% !important;
            table-layout: fixed !important;
            border-collapse: collapse !important;
            border-radius: 8px !important;
            overflow: hidden !important;
        }

            /* Header — krupnija slova */
            .table-scroll-wrap .grid-kamata th {
                background: #16265c !important;
                color: #fff !important;
                font-weight: 700 !important;
                font-size: 11px !important;
                text-transform: uppercase !important;
                letter-spacing: 0.5px !important;
                padding: 11px 12px !important;
                text-align: left !important;
            }

                .table-scroll-wrap .grid-kamata th:last-child {
                    text-align: right !important;
                }

            /* Ćelije — opšta pravila */
            .table-scroll-wrap .grid-kamata td {
                padding: 11px 12px !important;
                font-size: 12.5px !important;
                line-height: 1.35 !important;
                white-space: normal !important;
                word-wrap: break-word !important;
                overflow-wrap: anywhere !important;
                vertical-align: middle !important;
                border-top: none !important;
                border-bottom: 1px solid #eef1f6 !important;
                text-align: left !important;
            }

                /* PRVA kolona (Stavka) — LEVO, sa ikonicom */
                .table-scroll-wrap .grid-kamata td:first-child {
                    width: 62% !important;
                    text-align: left !important;
                    font-weight: 500 !important;
                    color: #1e2a3a !important;
                }

                /* DRUGA kolona (Vrednost) — DESNO, bold plavo */
                .table-scroll-wrap .grid-kamata td:last-child {
                    width: 38% !important;
                    text-align: right !important;
                    font-weight: 700 !important;
                    color: #063b82 !important;
                    font-variant-numeric: tabular-nums !important;
                    white-space: nowrap !important;
                }

            /* Zebra redovi */
            .table-scroll-wrap .grid-kamata tr:nth-child(even) td {
                background: #f9fafc !important;
            }

            /* SVG ikone u prvoj koloni — malo uže, poravnate sa tekstom */
            .table-scroll-wrap .grid-kamata td:first-child svg {
                width: 14px !important;
                height: 14px !important;
                vertical-align: -2px !important;
                margin-right: 6px !important;
                flex-shrink: 0;
                display: inline-block;
            }
}

/* ---------- JMBG mali telefoni (≤480px) ---------- */
@media (max-width: 480px) {

    .table-scroll-wrap .grid-kamata th {
        font-size: 10.5px !important;
        padding: 10px 10px !important;
    }

    .table-scroll-wrap .grid-kamata td {
        padding: 10px 10px !important;
        font-size: 12px !important;
    }

        .table-scroll-wrap .grid-kamata td:first-child {
            width: 58% !important;
        }

        .table-scroll-wrap .grid-kamata td:last-child {
            width: 42% !important;
        }
}