/* 🔥 RESET */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    font-family: Arial, sans-serif;
    background: linear-gradient(180deg, #eef2f7, #dde5ef);
}

body {
    overscroll-behavior: none;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ================= LOGIN ================= */
.login-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    width: 90%;
    max-width: 320px;
    background: white;
    padding: 25px;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.login-logo {
    width: 70px;
    margin: 0 auto 10px;
}

.login-box input {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
}

.login-box button {
    padding: 14px;
    background: #2b6cb0;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
}

/* ================= HEADER ================= */
.main-header{
    position:sticky;
    top:0;
    z-index:100;
    background:#fff;
    padding:10px 15px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    box-shadow:0 2px 10px rgba(0,0,0,0.05);
}

/* NASLOV CENTAR */
.header-title{
    position:absolute;
    left:50%;
    transform:translateX(-50%);
    font-weight:700;
    font-size:16px;
}

/* BACK LEVO */
.back-btn{
    background:#f1f1f1;
    border:none;
    width:36px;
    height:36px;
    border-radius:10px;
    display:flex;
    align-items:center;
    justify-content:center;
}

/* DESNO ACTIONS */
#headerActions{
    display:flex;
    align-items:center;
    gap:10px;
}

/* IKONICE */
.icon-btn{
    width:36px;
    height:36px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#f5f5f5;
    border:none;
    border-radius:12px;
    cursor:pointer;
    transition:0.2s;
}

.icon-btn:hover{
    background:#e0e0e0;
}


/* ================= DASHBOARD ================= */
.dashboard {
    max-width: 420px;
    margin: 0 auto;
    padding: 12px;
    padding-bottom: 80px;
}

.chart-box {
    position: relative;
    height: 170px;
}

.chart-center {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    left:50%;
    top:50%;
    transform:translate(-50%,-50%);
}

.legend {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-bottom: 12px;
    font-size: 13px;
}

.green { background: #0a8f2f; color:white; }
.red { background: #F44336; }
.orange { background: #FF9800; }

/* ================= CARDS ================= */
.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.card {
    background: white;
    padding: 16px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.card i {
    font-size: 18px;
    margin-bottom: 5px;
    color: #2d5c88;
}

.card.red {
    background: #ffecec;
}

.title {
    font-size: 13px;
    color: #666;
}

.value {
    font-size: 22px;
    font-weight: 700;
}

/* ================= BUTTONS ================= */
.actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.actions button {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
}

.blue {
    background: #2b6cb0;
    color: white;
}

.orange {
    background: #ed8936;
    color: white;
}

.big-btn {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
}

/* ================= LISTE ================= */
.magacin-item,
.kupac-item,
.racun-row,
.delete-btn{
    background:#ff4d4f;
    color:#fff;
    border:none;
    padding:10px 16px;
    border-radius:12px;
    font-size:13px;
    font-weight:600;
    cursor:pointer;
    min-width:80px;
    height:40px;
}
.trosak-item {
    background: white;
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kupac-item {
    cursor: pointer;
}

.racun-right {
    font-weight: bold;
    color: #2e7d32;
}

/* ================= MODAL ================= */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.7);
}

.modal-content{
    background: white;
    padding: 20px;
    border-radius: 16px;
    width: 90%;
    max-width: 350px;

    display: flex;
    flex-direction: column;
    gap: 10px;

    max-height: 85vh;
    overflow-y: auto;

    /* 🔥 KLJUČNO */
    padding-bottom: 80px;
}

.modal-content input {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ccc;
}

/* ================= TOAST ================= */
#toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d5c88;
    color: white;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    opacity: 0;
    transition: 0.3s;
    z-index: 9999;
}

#toast.show {
    opacity: 1;
    bottom: 50px;
}
.chart-box{
    position: relative;
    height: 180px;
    max-width: 180;
    margin: 0 auto;
}

.chart-box canvas{
    width:100% !important;
    height:100% !important;
}
.modal{
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    padding:15px;
}

.modal-content{
    max-height: 90vh;
    overflow-y: auto;
}
.icon-btn{
    width:36px;
    height:36px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#f1f1f1;
    border:none;
    border-radius:10px;
    padding:0;
}

.icon-btn svg{
    width:20px;
    height:20px;
}

#headerActions{
    display:flex;
    align-items:center;
    gap:10px;
}

.icon-btn:hover{
    background:#e0e0e0;
}
.main-header{
    position:sticky;
    top:0;
    z-index:100;
    background:#fff;
    padding:10px 15px;
    display:flex;
    align-items:center;
    justify-content:space-between;
}

.header-title{
    position:absolute;
    left:50%;
    transform:translateX(-50%);
    font-weight:600;
}

#headerActions{
    display:flex;
    gap:10px;
}

.icon-btn{
    width:38px;
    height:38px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#f5f7fb;
    border:none;
    border-radius:12px;
    cursor:pointer;
}

.icon-btn svg{
    width:16px;
    height:16px;
}

/* 🔥 FIX ZA ZELENO DUGME */
.big-btn{
    margin-top:14px;
}
/* 🔥 UBija pozadinu roditelja */
.actions + .big-btn{
    background: #328f55;
    color:#fff;
    border:none;
    margin-top:12px;

    /* 🔥 KLJUČ */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
/* 🔥 sakrij scroll bar (ali zadrži scroll) */
.modal-content{
    scrollbar-width: none; /* Firefox */
}

.modal-content::-webkit-scrollbar{
    display: none; /* Chrome, Safari */
}
/* 🔥 APP LAYOUT FIX */
#magacinScreen,
#kupciScreen,
#troskoviScreen,
#racuniScreen,
#izvestajScreen{
    height: calc(100vh - 140px); /* header + bottom */
    overflow-y: auto;
    padding: 10px 10px 120px 10px;
    box-sizing: border-box;
}
body{
    overflow: hidden;
}
/* 🔥 CHART */
#chart{
    width:180px !important;
    height:180px !important;
    margin:5px auto;
    display:block;
}
.chart-box{
    position:relative;
    width:180px;
    height:180px;
    margin:auto;
}

.chart-center{
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%, -50%);

    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;

    font-size:19px;      /* 🔥 smanjeno */
    font-weight:700;
    color:#2d3748;
    line-height:1.2;
}
.chart-box{
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.1));
}
.value{
    white-space: nowrap;      /* ❗ nema preloma */
    overflow: hidden;
    text-overflow: ellipsis;  /* ... ako je predugačko */
}
.value{
    font-size: clamp(18px, 4vw, 23px);
}
#appLoader{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:#f5f7fa;
    z-index:9999;
    display:flex;
    align-items:center;
    justify-content:center;
}

.loader-box{
    text-align:center;
}

.loader-spinner{
    width:40px;
    height:40px;
    border:4px solid #ddd;
    border-top:4px solid #2d5c88;
    border-radius:50%;
    animation:spin 1s linear infinite;
    margin:0 auto 10px;
}

.loader-text{
    font-size:14px;
    color:#555;
}

@keyframes spin{
    to{transform:rotate(360deg);}
}
#rezultatiArtikli {
    max-height: 200px;
    overflow-y: scroll;

    /* Firefox */
    scrollbar-width: none;

    /* IE / Edge */
    -ms-overflow-style: none;
}

/* Chrome, Safari */
#rezultatiArtikli::-webkit-scrollbar {
    width: 0px;
    height: 0px;
}