/* =========================
   OSNOVNI STILOVI
   ========================= */

body {
    font-family: sans-serif;
    background-color: #f8f9fa;
    color: #333;
    padding: 20px;
    margin: 0;
}

.container {
    max-width: 800px;
    margin: auto;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* =========================
   DUGMAD
   ========================= */

.btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-utility {
    background-color: #f0f0f0;
    color: #444;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-utility:hover {
    background-color: #e0e0e0;
}

.btn-primary-custom {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 12px;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2);
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.btn-primary-custom:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.scan-btn:disabled,
.scan-btn:disabled:hover {
    background-color: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.82rem;
    border-radius: 999px;
    border: 1px solid #ddd;
    background: #f9fafb;
    cursor: pointer;
}

/* =========================
   GENERIČKI MODAL SISTEM
   (ZA DELIVERY MODALE I SL.)
   ========================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: none;                  /* pali se iz JS: style.display = 'flex' */
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.modal-content {
    background: #ffffff;
    padding: 22px;
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 35px rgba(0,0,0,0.35);
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 26px;
    font-weight: bold;
    color: #555;
    background: none;
    border: none;
    cursor: pointer;
}

.modal-close:hover {
    color: #000;
}

#signatureCanvas {
    width: 100%;
    height: 160px;              /* malo veći */
    background: #ffffff;
    border: 2px dashed #3b82f6;
    border-radius: 10px;
    display: block;
    touch-action: none;
    position: relative;
}

/* =========================
   miniDashboard MODAL
   (MOŽEŠ GA KORISTITI KAD ZATREBA)
   ========================= */

#miniDashboard.modal-overlay {
    z-index: 9500;                  /* iznad ostalih modala */
}

#miniDashboard .modal-content {
    background: #0f172a;
    color: #f9fafb;
    border: 1px solid rgba(255,255,255,0.15);
    max-width: 520px;
}

#miniDashboard .modal-close {
    color: #9ca3af;
    font-size: 20px;
}

#miniDashboard .modal-close:hover {
    color: #f9fafb;
}

/* =========================
   STATUSI PAKETA
   ========================= */

.status-isporucen {
    background-color: #d4edda;
    border-left: 5px solid #28a745;
    opacity: 0.7;
}

.status-retour {
    background-color: #f8d7da;
    border-left: 5px solid #dc3545;
}

.status-ceka_dostavu,
.status-ponoviti,
.status-izvjestaj {
    background-color: #f7f7f7;
    border-left: 5px solid #6c757d;
}

.completed {
    opacity: 0.55;
}

.package-item.status-pending {
    border-color: #facc15;
    background: rgba(250, 204, 21, 0.18);
}

.active-package {
    border-left: 5px solid #007bff;
    background-color: #e2f0ff;
}

/* =========================
   LISTA ZA RADNU RUTU
   ========================= */

.work-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.work-list .package-item {
    border-left: 5px solid gray;
    padding: 15px;
    margin-bottom: 8px;
    background: #f4f4f4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px;
}

.work-list .package-item.next {
    border-left-color: #007bff;
    background: #e0f7ff;
}

.work-list .package-item.delivered {
    border-left-color: green;
    background: #e6ffe6;
    opacity: 0.7;
}

.order-number {
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 15px;
}

.package-info {
    flex-grow: 1;
}

.scan-btn {
    padding: 8px 15px;
}

/* =========================
   OPTIMIZACIJA – OZNAKE
   ========================= */

.optimized-item .package-card,
.optimized-card {
    border-color: #4ade80;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.35);
}

.not-optimized-item .package-card,
.not-optimized-card {
    border-color: #f87171;
    box-shadow: 0 0 10px rgba(248, 113, 113, 0.25);
}

/* =========================
   MAPA
   ========================= */

.map-container {
    height: 400px;
}

#map {
    width: 100%;
    height: 100%;
}

/* =========================
   BADGE STATUSI (npr. u analytics tabeli)
   ========================= */

.badge-status {
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 0.75rem;
    display: inline-block;
}

.badge-ok {
    background: #dcfce7;
    color: #15803d;
}

.badge-retour {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-repeat {
    background: #fffbeb;
    color: #92400e;
}

.badge-progress {
    background: #e0f2fe;
    color: #0369a1;
}

/* =========================
   PRINT STILOVI
   ========================= */

@media print {
    .print-hide,
    .action-buttons {
        display: none !important;
    }
    
    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: white !important;
        padding: 0;
    }
    
    .container {
        max-width: 100%;
        box-shadow: none;
        margin: 0;
        padding: 0;
    }
}
/* ============================
   PREMIUM MINI DASHBOARD UI
   ============================ */

#miniDashboard {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-end; /* bottom sheet */
    justify-content: center;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    z-index: 999999 !important;
}

#miniDashboard .modal-content {
    width: 96%;
    max-width: 540px;
    margin-bottom: 14px;
    background: rgba(15, 23, 42, 0.55); /* dark glass */
    backdrop-filter: blur(18px);
    border-radius: 22px;
    padding: 20px 20px 28px;
    color: #e2e8f0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);

    animation: premiumSlideUp 0.35s ease-out;
}

@keyframes premiumSlideUp {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

#miniDashboard .modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 26px;
    font-weight: bold;
    color: #94a3b8;
    cursor: pointer;
    z-index: 100001;
}
#miniDashboard .modal-close:hover {
    color: white;
}

/* GRID – Kartice */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 10px;
}

.dashboard-card {
    background: rgba(255,255,255,0.08);
    padding: 14px 12px;
    border-radius: 14px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.12);
    transition: 0.2s;
}

.dashboard-card:hover {
    background: rgba(255,255,255,0.15);
    transform: scale(1.03);
}

.dashboard-card .value {
    font-size: 1.4rem;
    font-weight: 700;
}

.dashboard-card .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.75;
}

/* Bar sparkline */
.sparkline {
    display: flex;
    gap: 4px;
    margin-top: 12px;
    height: 22px;
    align-items: flex-end;
}
.sparkline div {
    flex: 1;
    background: linear-gradient(to top, #3b82f6, #60a5fa);
    border-radius: 6px 6px 0 0;
    opacity: 0.9;
}
/* Modal lepo centriran */
.modal-content.nice-form {
    background: #ffffff;
    padding: 25px 30px;
    border-radius: 18px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    animation: fadeIn 0.2s ease-in-out;
    position: relative;
}

/* Naslov */
.form-title {
    margin-bottom: 15px;
    text-align: center;
    font-size: 22px;
    color: #007bff;
    font-weight: 700;
}

/* Close dugme */
.close-btn {
    position: absolute;
    right: 12px;
    top: 8px;
    font-size: 20px;
    cursor: pointer;
}

/* Grupe polja */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #bbb;
    font-size: 15px;
    background: #fafafa;
}

.form-group input:focus {
    border-color: #007bff;
    background: #fff;
    outline: none;
    box-shadow: 0 0 4px rgba(0,123,255,0.4);
}

/* Dva polja u istom redu */
.form-row {
    display: flex;
    gap: 10px;
}

.form-row .half {
    flex: 1;
}

/* Dugme */
.btn-submit {
    background: #007bff;
    color: white;
    border: none;
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-size: 17px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: 600;
}

.btn-submit:hover {
    background: #005fcc;
}

/* Poruka */
.manual-msg {
    text-align: center;
    margin-top: 10px;
    font-weight: 600;
}

/* Animacija */
@keyframes fadeIn {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.btn-finish {
    background: #28a745;
    color: white;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 600;
    margin-top: 15px;
    cursor: pointer;
}

.btn-finish:hover {
    background: #1f8a39;
}
/* =========================
   FIX: DELIVERY STATUS MODAL (MOBILE SAFE)
   ========================= */

#statusModal .modal-content {
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* ⬅️ KLJUČNO */
}

#statusModal .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
}
.tag-info {
    background: #e0f2fe;
    color: #0369a1;
}

/* Dodajte ovaj blok u vaš <style> dio */
#signatureCanvas {
    /* Vizualne dimenzije u CSS pikselima */
    width: 100%;
    height: 160px; /* Dodajte konkretnu CSS visinu! */
    
    /* Dodatni stilovi da izgleda lijepo */
    margin-top: 6px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: #fff; /* Mora imati bijelu pozadinu da se potpis vidi! */
    touch-action: none;
    display: block;
}
#signatureCanvas {
    background-color: #ffffff !important; 
    color-scheme: only light !important; /* Ovo je ključno za iPhone/Android Dark mode */
}
/* Ostavite i originalni CSS, ali ciljajte ID #signatureCanvas */
/*
canvas.signature { // Ovaj stil možete izbrisati ili preimenovati #signatureCanvas
    ...
}
*/