/* ================================================================
   ELEMON DNEVNIK RADA — Globalni stilovi
   ================================================================ */

/* --- 1. CSS VARIJABLE (boje, fontovi) --- */
:root {
    --primarna:  #0056b3;   /* plava  – brend */
    --dodatni:   #e63946;   /* crvena – dodaci / upozorenja */
    --primjedba: #ff9800;   /* narančasta – primjedbe */
    --uspjeh:    #28a745;   /* zelena – spremi / ok */
    --tamna:     #1a202c;   /* skoro crna – tekst, navigacija */
    --siva:      #718096;   /* siva   – sekundarni tekst */
    --bg:        #f0f2f5;   /* svijetla pozadina */
    --bijela:    #ffffff;
}

/* --- 2. RESET --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    color: var(--tamna);
    -webkit-tap-highlight-color: transparent;
}

/* --- 3. FIXED / STICKY HEADER --- */
.header-fixed {
    position: fixed;
    top: 0; left: 0; width: 100%;
    background: var(--bijela);
    padding: 10px 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-sizing: border-box;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 500px;
    margin: 8px auto;
    width: 95%;
}

.header-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--primarna);
    margin: 0;
}

/* --- 4. NAVIGACIJSKI GUMBI (nazad / home) --- */
.btn-home,
.btn-back,
.btn-nazad {
    text-decoration: none;
    background: var(--tamna);
    color: var(--bijela);
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.btn-home:active,
.btn-back:active,
.btn-nazad:active { opacity: 0.75; }

/* --- 5. KARTICA / KONTEJNER (bijeli okvir) --- */
.card,
.container,
.add-box {
    background: var(--bijela);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    max-width: 500px;
    margin: 0 auto 15px auto;
    width: 100%;
    box-sizing: border-box;
}

.section-title {
    font-size: 17px;
    color: #333;
    font-weight: bold;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* --- 6. FORM ELEMENTI --- */
label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
    font-size: 11px;
    color: #777;
    text-transform: uppercase;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    margin-top: 3px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 15px;
    font-family: 'Segoe UI', sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bijela);
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primarna);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

/* --- 7. CHIP (selekcija, filteri) --- */
.chip {
    padding: 8px 6px;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    background: var(--bijela);
    font-size: 11px;
    font-weight: 600;
    user-select: none;
    touch-action: manipulation;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chip.selected,
.chip.active-blue {
    background: var(--primarna);
    color: var(--bijela);
    border-color: var(--primarna);
}
.chip.active-red {
    background: var(--dodatni);
    color: var(--bijela);
    border-color: var(--dodatni);
}
.chip.active-orange {
    background: var(--primjedba);
    color: var(--bijela);
    border-color: var(--primjedba);
}
.chip.active-gray {
    background: #4a5568;
    color: var(--bijela);
    border-color: #4a5568;
}

/* --- 8. AKCIJSKI GUMBI --- */
.btn-spremi,
.btn-add,
.btn-dodaj {
    width: 100%;
    background: var(--primarna);
    color: var(--bijela);
    border: none;
    padding: 13px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.1s, opacity 0.2s;
}
.btn-spremi:active,
.btn-add:active,
.btn-dodaj:active {
    transform: scale(0.97);
    opacity: 0.9;
}

/* Zeleni gumb (spremi) */
.btn-uspjeh {
    background: var(--uspjeh);
    color: var(--bijela);
    border: none;
    padding: 14px;
    border-radius: 10px;
    width: 100%;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.1s;
}
.btn-uspjeh:active { transform: scale(0.97); }

/* --- 9. FIKSNI FOOTER --- */
.footer-fixed {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    background: var(--bijela);
    padding: 10px 15px;
    box-shadow: 0 -3px 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
    z-index: 1000;
}

/* --- 10. LOADER OVERLAY --- */
#loader {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.88);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-weight: bold;
    color: var(--primarna);
}

.spinner,
.loader-spinner {
    border: 4px solid #e9e9e9;
    border-top: 4px solid var(--primarna);
    border-radius: 50%;
    width: 36px; height: 36px;
    animation: spin 0.8s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- 11. TOAST OBAVIJEST --- */
#toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--tamna);
    color: var(--bijela);
    padding: 10px 22px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: bold;
    z-index: 9999;
    transition: transform 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}
#toast.prikazan { transform: translateX(-50%) translateY(0); }

/* --- 12. PIN / MODAL OVERLAY --- */
.modal-overlay,
#pin-overlay,
#delete-pin-overlay,
#k-pin-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.82);
    z-index: 2500;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.pin-box {
    background: var(--bijela);
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    width: 85%;
    max-width: 320px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.pin-input {
    width: 100%;
    padding: 15px;
    font-size: 28px;
    text-align: center;
    letter-spacing: 10px;
    border: 2px solid #ddd;
    border-radius: 10px;
    margin-top: 10px;
    outline: none;
    font-weight: bold;
}
.pin-input:focus { border-color: var(--primarna); }

.pin-label {
    font-size: 11px;
    color: var(--dodatni);
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.pin-btn-cancel {
    background: #eee;
    border: none;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-weight: bold;
    width: 100%;
    color: #444;
    cursor: pointer;
}

/* --- 13. BOTTOM SHEET (kartica overlay) --- */
#kartica-overlay,
#k-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(3px);
}

#kartica-box,
#k-box {
    background: var(--bijela);
    width: 100%;
    max-width: 500px;
    border-radius: 24px 24px 0 0;
    padding: 10px 20px 40px 20px;
    max-height: 93vh;
    overflow-y: auto;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.25);
    animation: slideUp 0.28s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.k-handle {
    width: 40px; height: 4px;
    background: #ddd;
    border-radius: 4px;
    margin: 8px auto 16px auto;
}

.k-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.k-naslov,
.k-naslov-txt {
    font-weight: 900;
    font-size: 13px;
    color: var(--primarna);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.k-close-btn,
.k-btn-close {
    background: #f0f0f0;
    border: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* --- 14. STATUS BADGE-OVI --- */
.status-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 5px;
    font-weight: 900;
    text-transform: uppercase;
}

/* Radnici / vozila */
.badge-ok,
.status-aktivni    { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.badge-warn        { background: #fff3cd; color: #856404; border: 1px solid #fcd34d; }
.badge-expired,
.status-neaktivni  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Dnevnik rada */
.status-nepregledano { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e0; }
.status-uradu        { background: #fef3c7; color: #d97706; border: 1px solid #fcd34d; }
.status-rijeseno     { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* --- 15. ZOOM OVERLAY (galerija) --- */
#zoom-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}
#zoom-img {
    max-width: 95%; max-height: 95%;
    transform-origin: 50% 50%;
    transition: transform 0.15s ease-out;
    cursor: grab;
    user-select: none;
}
.close-zoom-btn {
    position: absolute;
    top: 20px; right: 20px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 3100;
    text-shadow: 0 0 10px black;
    padding: 10px;
    line-height: 1;
}
.rotate-zoom-btn {
    position: absolute;
    bottom: 24px; right: 24px;
    color: white;
    font-size: 28px;
    cursor: pointer;
    z-index: 3100;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 52px; height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 8px black;
    touch-action: manipulation;
    border: 1px solid rgba(255,255,255,0.25);
}

/* --- 16. INFO GRID (raspored u karticama) --- */
.info-grid {
    display: grid;
    grid-template-columns: 80px 1fr 80px;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    font-size: 13px;
}
.status-neradni { color: #cc0000; font-weight: bold; text-align: right; }
.status-radni   { color: #008000; font-weight: bold; text-align: right; }

/* --- 17. EXPIRY TAGOVI (vozila, dokumenti) --- */
.expiry-tag,
.tag-ok,
.tag-warn,
.tag-expired {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: bold;
}
.tag-ok      { background: #d4edda; color: #155724; }
.tag-warn    { background: #fff3cd; color: #856404; }
.tag-expired { background: #f8d7da; color: #721c24; }

/* --- 18. ĆELIJA PRIJE ZAPOSLENJA (sihterica / planer) --- */
.td-prije-zaposlenja {
    background-color: #cbd5e1 !important;
    border: 1px solid #cbd5e1 !important;
    pointer-events: none;
    color: transparent;
}
