/* Varijabla za visinu navbar-a */
:root {
    --navbar-height: 80px; /* Možeš menjati visinu po želji */
}

/* Navbar */
.navbar {
    height: var(--navbar-height);
    background-color: #f8f9fa;
    box-shadow: 0 4px 4px rgba(197, 212, 227, 0.1);
    width: 100%;
    display: flex;
    justify-content: center;
    font-family: "M PLUS Rounded 1c";
    position: relative;
    z-index: 1000;
}

/* Kontejner za sadržaj */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    width: 100%;
}

/* Logo */
.navbar-brand {
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar-brand img {
    height: 60%;
    width: auto;
}

/* Ikonice korisnika i korpe */
.navbar-icons {
    display: flex;
    align-items: center;
}

.navbar-icons img {
    height: calc(var(--navbar-height) * 0.4);
    width: auto;
    transition: transform 0.2s;
}

.navbar-icons img:hover {
    transform: scale(1.1);
}

/* USER DROPDOWN U NAVBARU */
.navbar-user-dropdown {
    position: relative;
}

.navbar-user-toggle {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* Meni koji se pojavljuje ispod user ikonice */
.navbar-user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    min-width: 180px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    padding: 4px 0;
    display: none;
    z-index: 1500;
}

.navbar-user-menu a {
    display: block;
    padding: 8px 16px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}

.navbar-user-menu a:hover {
    background: #f8f9fa;
}

/* Kad je otvoren dropdown */
.navbar-user-dropdown.is-open .navbar-user-menu {
    display: block;
}

/* Navigacioni linkovi */
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-nav .nav-link {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease-in-out;
}

.navbar-nav .nav-link:hover {
    color: #007bff;
}

.cart-counter {
    position: absolute;
    top: 0;
    right: 0;
    background-color: red;
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transform: translate(50%, -50%);
}

/* Search bar */
.search-container {
    display: flex;
    align-items: center;
    width: 13vw; /* Možeš menjati po potrebi */
    margin-right: 15px; /* Povećava razmak između search bara i ikona */
    position: relative;
}

/* Search input */
#search-input {
    width: 100%;
    height: calc(var(--navbar-height) * 0.5); /* Visina je 50% navbar-a */
    padding: 8px 12px 8px 45px; /* Povećali smo left padding sa 40px na 45px */
    border-radius: 50px;
    border: 1px solid #ccc;
    outline: none;
    transition: border-color 0.3s ease-in-out;
}

/* Boja bordera na fokusu */
#search-input:focus {
    border-color: #becfe1; /* Prilagodljiva boja bordera prilikom fokusa */
    box-shadow: 0px 0px 5px rgba(205, 223, 236, 0.5); /* Blaga senka na fokusu */
}

/* Search results dropdown */
.search-results {
    background: white;
    border-radius: 10px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
    max-height: 300px;
    overflow-y: auto;
    display: none; /* Početno sakriven */
    z-index: 1000;
}

/* Stilizacija ikone unutar search inputa */
.search-icon {
    position: absolute;
    left: 15px; /* Lagano pomeranje ikone desno */
    top: 50%;
    transform: translateY(-50%);
    width: calc(var(--navbar-height) * 0.3); /* Ikona će biti 30% visine navbar-a */
    height: auto;
    filter: brightness(0) invert(0.6);
    transition: filter 0.3s ease-in-out;
}

.search-results .result-item {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
}

.search-results .result-item:last-child {
    border-bottom: none;
}

.search-results .result-item:hover {
    background: #f8f9fa;
}

/* Prilagodba širine nav-container-a po rezoluciji */
@media (max-width: 1999px) {
    .nav-container {
        width: 90%; /* Od 0px do 1999px - širina 90% */
    }
}

@media (min-width: 2000px) and (max-width: 2559px) {
    .nav-container {
        width: 75%; /* Od 2000px do 2559px - širina 80% */
    }
}

@media (min-width: 2560px) {
    .nav-container {
        width: 60%; /* 2560px i više - širina 60% */
    }
    .search-container {
        width: 11vw; /* 20% širine ekrana */
    }
}

/* MOBILE */
@media (max-width: 1200px) {
    :root {
        --navbar-height: 60px; /* Manja visina navbar-a na mobilnim uređajima */
    }

    .navbar {
        height: var(--navbar-height);
        position: relative;
    }

    /* Centriranje logotipa na mobilnim uređajima */
    .navbar-brand {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        height: var(--navbar-height);
        display: flex;
        align-items: center;
    }

    .navbar-brand img {
        height: 60%;
    }

    /* Stilizacija hamburger dugmeta */
    .navbar-toggler {
        border: none;
        padding: 5px;
        height: calc(var(--navbar-height) * 0.6); /* 60% visine navbar-a */
        width: calc(var(--navbar-height) * 0.6); /* Pravilan odnos visine i širine */
        min-width: 40px; /* Sprečava da dugme bude premalo */
        min-height: 40px;
    }

    .navbar-toggler-icon {
        filter: brightness(0) invert(0.5);
        max-height: 100%;
        max-width: 100%;
        filter: brightness(0.3);
    }

    /* Popravlja padding unutar dugmeta */
    .navbar-toggler:focus {
        outline: none; /* Uklanja plavi border na fokusu */
        box-shadow: none;
    }

    /* Navigacija na mobilnim uređajima */
    .navbar-nav {
        flex-direction: column;
        text-align: center;
    }

    .navbar-nav .nav-item {
        flex-direction: column;
        align-items: center; /* Centriraj linkove */
    }

    .navbar-icons-container {
        display: flex;
        align-items: center;
        justify-content: flex-end; /* Gura ikone do desnog kraja unutar .nav-container */
        flex-grow: 1; /* Osigurava da preuzmu raspoloživi prostor */
    }

    .navbar-collapse {
        position: absolute;
        top: var(--navbar-height); /* Počinje odmah ispod navbar-a */
        left: 0;
        width: 100%;
        background-color: #f8f9fa; /* Postavlja pozadinu menija */
        text-align: center;
        padding: 10px 0;
        box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    }

    /* Search Bar */
    .search-container {
        display: none !important; /* Sakriva search bar na ekranima manjim od 1200px */
    }
}
