:root {
    --bg: #1f2226;
    --polje: #2a2f35;
    --linija: #343a40;
    --tekst: #ffffff;
    --tekst2: #c9ced3;
    --sivo: #9aa0a6;
    --kat: #ff6a2b;
    --kat2: #e5484d;
}
:root[data-theme="light"] {
    --bg: #ffffff;
    --polje: #f0f2f4;
    --linija: #e3e5e8;
    --tekst: #1a1d20;
    --tekst2: #4a5056;
    --sivo: #6b7278;
    --kat: #e8590c;
    --kat2: #d6336c;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--tekst);
    font-family: "Roboto", -apple-system, "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
:root[data-theme="light"] .logo img {
    filter: invert(1);
}

.meni-toggle {
    display: none;
}

/* Gornja traka */
.top {
    background: var(--bg);
    border-bottom: 1px solid var(--linija);
    padding: 10px 8px;
    display: grid;
    grid-template-columns: 64px 1fr 64px;
    align-items: center;
}
.logo {
    justify-self: center;
    display: inline-block;
    line-height: 0;
}

/* Kategorije u zaglavlju: samo na računaru */
.nav-desk {
    display: none;
}

/* Hamburger */
.hamburger {
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 0 10px;
    box-sizing: border-box;
    cursor: pointer;
}
.hamburger span {
    display: block;
    height: 2px;
    background: var(--tekst);
    border-radius: 2px;
}

/* Vrijeme */
.vrijeme {
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-right: 6px;
    line-height: 1.1;
}
.vrijeme .ikona {
    font-size: 24px;
}
.vrijeme .temp {
    font-size: 13px;
    font-weight: 700;
    color: var(--tekst2);
}

/* Bočni meni */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    z-index: 90;
}
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--bg);
    border-right: 1px solid var(--linija);
    transform: translateX(-100%);
    transition: transform 0.25s;
    z-index: 100;
    overflow-y: auto;
}
.meni-toggle:checked ~ .overlay {
    opacity: 1;
    pointer-events: auto;
}
.meni-toggle:checked ~ .drawer {
    transform: translateX(0);
}

/* Dugme X za zatvaranje menija */
.drawer-vrh {
    display: flex;
    justify-content: flex-end;
    padding: 10px 10px 0;
}
.drawer-zatvori {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    color: var(--tekst);
    background: var(--polje);
    border: 1px solid var(--linija);
    border-radius: 50%;
    cursor: pointer;
}

.drawer-naslov {
    color: var(--kat);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 20px 8px;
}
.drawer a {
    display: block;
    color: var(--tekst);
    text-decoration: none;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 16px 20px;
    border-bottom: 1px solid var(--linija);
}

/* Pretraga u meniju */
.pretraga {
    display: flex;
    margin: 10px 16px 6px;
    background: var(--polje);
    border: 1px solid var(--linija);
    border-radius: 8px;
    overflow: hidden;
}
.pretraga input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--tekst);
    font-family: inherit;
    font-size: 16px;
    padding: 12px;
}
.pretraga input::placeholder {
    color: var(--sivo);
}
.pretraga button {
    background: transparent;
    border: 0;
    font-size: 18px;
    padding: 0 14px;
    cursor: pointer;
}

/* Prekidač teme */
.tema-dugme {
    display: block;
    width: calc(100% - 32px);
    margin: 20px 16px 30px;
    background: var(--polje);
    border: 1px solid var(--linija);
    border-radius: 8px;
    color: var(--tekst);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    padding: 14px 16px;
    cursor: pointer;
}
.tema-dugme .t-svijetla {
    display: none;
}
:root[data-theme="light"] .tema-dugme .t-tamna {
    display: none;
}
:root[data-theme="light"] .tema-dugme .t-svijetla {
    display: inline;
}

/* Traka kategorija (telefon) */
.kategorije {
    background: var(--bg);
    border-bottom: 1px solid var(--linija);
    display: flex;
    justify-content: space-around;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}
.kategorije::-webkit-scrollbar {
    display: none;
}
.kategorije a {
    color: var(--tekst2);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 14px 10px;
}
.kategorije a:first-child {
    color: var(--tekst);
}

/* Podnožje */
.footer {
    text-align: center;
    color: var(--sivo);
    font-size: 13px;
    padding: 24px 12px;
    border-top: 1px solid var(--linija);
    margin-top: 20px;
}

/* =====================  RAČUNAR (od 1000 px širine)  ===================== */
@media (min-width: 1000px) {
    /* Zaglavlje: logo skroz lijevo, kategorije jedna pored druge, vrijeme i meni desno */
    .top {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px max(20px, calc((100% - 1240px) / 2));
    }
    .logo {
        order: 1;
        justify-self: auto;
        margin-right: 18px;
    }
    .nav-desk {
        order: 2;
        display: flex;
        align-items: center;
        flex: 1;
        gap: 2px;
    }
    .nav-desk a {
        display: inline-flex;
        align-items: center;
        color: var(--tekst);
        text-decoration: none;
        font-size: 17px;
        font-weight: 700;
        padding: 10px 12px;
        border-radius: 6px;
        white-space: nowrap;
    }
    .nav-desk a:hover {
        background: var(--polje);
    }

    /* Sve kategorije bijele (u svijetloj temi tamne), sa uspravnom crtom ispred naziva */
    .nav-desk a[href*="slug="] {
        color: var(--tekst);
    }
    .nav-desk .tacka {
        display: inline-block;
        width: 3px;
        height: 18px;
        border-radius: 2px;
        margin-right: 9px;
        background: currentColor !important;
    }

    .vrijeme {
        order: 3;
        padding-right: 10px;
    }
    .hamburger {
        order: 4;
    }

    /* Meni na računaru izlazi sa desne strane (hamburger je desno) */
    .drawer {
        left: auto;
        right: 0;
        border-right: 0;
        border-left: 1px solid var(--linija);
        transform: translateX(100%);
        width: 340px;
    }
    .meni-toggle:checked ~ .drawer {
        transform: translateX(0);
    }

    /* Traka sa kategorijama ispod zaglavlja nije potrebna: sve je u zaglavlju */
    .kategorije {
        display: none;
    }
}

/* =====================  TELEFON (do 999 px): kompaktnije zaglavlje  ===================== */
@media (max-width: 999px) {
    .top {
        padding: 6px 8px;
        grid-template-columns: 56px 1fr 56px;
    }
    /* Logo ima fiksnu visinu u header.php, zato !important */
    .logo img {
        height: 28px !important;
    }
    .hamburger {
        width: 40px;
        height: 40px;
        gap: 5px;
    }
    .vrijeme .ikona {
        font-size: 19px;
    }
    .vrijeme .temp {
        font-size: 12px;
    }
    .kategorije a {
        font-size: 12px;
        padding: 9px 10px;
    }
}

/* Mali vremenski widget samo na telefonu */
.top a.vrijeme { text-decoration: none; color: var(--tekst); }
@media (min-width: 1000px) { .top .vrijeme { display: none; } }
