/*
 * ============================================================================
 * MOBILNI DIZAJN SISTEM (MDS)
 * Za logističke/skladišne/dostavne Blazor WASM aplikacije
 * ============================================================================
 *
 * Samo custom CSS koji Bootstrap 5 ne može pokriti.
 * Sve ostalo koristimo iz Bootstrap 5.3 utility klasa.
 *
 * Konvencija: --mds-* za CSS varijable
 * Organizacija: App Shell → Komponente → Stanja → Dark Mode
 * ============================================================================
 */

/* ============================================================================
 * 1. CSS CUSTOM PROPERTIES - TEMA
 * Bazni tokeni koji se nasljeđuju kroz cijeli sistem.
 * Bootstrap varijable koristimo gdje god je moguće.
 * ============================================================================ */

:root {
    /* --- Primarne boje (usklađeno sa admin dizajn sistemom) --- */
    --mds-primary: #0f172a;
    --mds-primary-rgb: 15, 23, 42;
    --mds-accent: #4f46e5;
    --mds-accent-rgb: 79, 70, 229;
    --mds-accent-hover: #4338ca;
    --mds-accent-light: rgba(79, 70, 229, 0.08);

    /* --- Statusne boje (dublje, profesionalnije — iste kao admin) --- */
    --mds-success: #059669;
    --mds-success-rgb: 5, 150, 105;
    --mds-success-light: rgba(5, 150, 105, 0.08);
    --mds-warning: #d97706;
    --mds-warning-rgb: 217, 119, 6;
    --mds-warning-light: rgba(217, 119, 6, 0.08);
    --mds-danger: #dc2626;
    --mds-danger-rgb: 220, 38, 38;
    --mds-danger-light: rgba(220, 38, 38, 0.08);
    --mds-info: #2563eb;
    --mds-info-rgb: 37, 99, 235;
    --mds-info-light: rgba(37, 99, 235, 0.08);

    /* --- Površine i pozadine --- */
    --mds-surface: #ffffff;
    --mds-surface-elevated: #ffffff;
    --mds-surface-muted: #f8fafc;
    --mds-surface-hover: #f1f5f9;
    --mds-bg: #f1f3f8;
    --mds-bg-rgb: 241, 243, 248;

    /* --- Tekst --- */
    --mds-text-primary: #0f172a;
    --mds-text-secondary: #64748b;
    --mds-text-muted: #94a3b8;
    --mds-text-inverse: #ffffff;

    /* --- Ivice (vidljivije, čiste linije) --- */
    --mds-border: #e5e7eb;
    --mds-border-strong: #d1d5db;

    /* --- Sjene (čistije, suptilne ali prisutne) --- */
    --mds-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --mds-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --mds-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    --mds-shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.05);

    /* --- Dimenzije --- */
    --mds-touch-min: 48px;
    --mds-topbar-height: 56px;
    --mds-bottomnav-height: 64px;
    --mds-fab-size: 56px;
    --mds-radius: 14px;
    --mds-radius-sm: 10px;
    --mds-radius-lg: 18px;
    --mds-radius-xl: 24px;

    /* --- Animacije --- */
    --mds-transition: 0.2s ease;
    --mds-transition-slow: 0.3s ease;

    /* --- Font porodice (Google Sans) --- */
    --mds-font-sans: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mds-font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
}


/* ============================================================================
 * 2. BAZNI STILOVI
 * Globalni reset i tipografija
 * ============================================================================ */

body.mds-app {
    font-family: var(--mds-font-sans);
    background-color: var(--mds-bg);
    color: var(--mds-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Sprečavamo pull-to-refresh na nivou browsera */
    overscroll-behavior-y: contain;

    /* Bootstrap variable bridge — BS utility klase koriste MDS boje */
    --bs-body-color: var(--mds-text-primary);
    --bs-body-color-rgb: var(--mds-primary-rgb);
    --bs-body-bg: var(--mds-bg);
    --bs-secondary-color: var(--mds-text-secondary);
    --bs-tertiary-color: var(--mds-text-muted);
    --bs-border-color: var(--mds-border);
    --bs-card-bg: var(--mds-surface);
    --bs-card-border-color: var(--mds-border);
    --bs-card-cap-bg: var(--mds-surface-muted);

    /* Bootstrap btn-primary koristi MDS accent boju */
    --bs-primary: var(--mds-accent);
    --bs-primary-rgb: var(--mds-accent-rgb);
    --bs-link-color: var(--mds-accent);
    --bs-link-hover-color: var(--mds-accent-hover);
}

/* Monospace za kodove, barkodove, ID-eve */
.mds-mono {
    font-family: var(--mds-font-mono);
    letter-spacing: -0.01em;
}

/* Veća slova za labele */
.mds-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--mds-text-muted);
}


/* ============================================================================
 * 3. APP SHELL - Fiksni top bar i bottom navigacija
 * ============================================================================ */

/* --- Gornji bar (sticky) --- */
.mds-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--mds-topbar-height);
    background-color: var(--mds-surface);
    border-bottom: 1px solid var(--mds-border);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.375rem;
}

.mds-topbar-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    color: var(--mds-text-primary);
    letter-spacing: -0.01em;
}

.mds-topbar-action {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--mds-text-secondary);
    font-size: 1.125rem;
    flex-shrink: 0;
    cursor: pointer;
    transition: background var(--mds-transition), color var(--mds-transition);
}

.mds-topbar-action:hover,
.mds-topbar-action:active {
    background-color: var(--mds-surface-hover);
    color: var(--mds-text-primary);
}

/* --- Donji navigacioni bar (fiksiran) --- */
.mds-bottomnav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    height: var(--mds-bottomnav-height);
    background-color: var(--mds-surface);
    border-top: 1px solid var(--mds-border);
    display: flex;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mds-bottomnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    text-decoration: none;
    color: var(--mds-text-muted);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    position: relative;
    transition: color var(--mds-transition);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.mds-bottomnav-item i,
.mds-bottomnav-item .mds-nav-icon {
    font-size: 1.25rem;
    line-height: 1;
    position: relative;
}

.mds-bottomnav-item.active {
    color: var(--mds-accent);
    font-weight: 600;
}

.mds-bottomnav-item.active::before {
    display: none;
}

/* --- Sadržaj stranice sa padding za shell --- */
.mds-page-content {
    padding-bottom: calc(var(--mds-bottomnav-height) + env(safe-area-inset-bottom, 0) + 1rem);
    min-height: 100vh;
    min-height: 100dvh;
}


/* ============================================================================
 * 4. COUNTER BADGE - Brojač na navigacionim stavkama
 * ============================================================================ */

.mds-counter {
    position: absolute;
    top: -4px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: var(--mds-danger);
    border-radius: 9px;
    border: 2px solid var(--mds-surface);
    font-family: var(--mds-font-sans);
}

.mds-counter:empty {
    display: none;
}

.mds-counter-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--mds-danger);
    border-radius: 50%;
    border: 2px solid var(--mds-surface);
}


/* ============================================================================
 * 5. FLOATING ACTION BUTTON (FAB)
 * ============================================================================ */

.mds-fab {
    position: fixed;
    bottom: calc(var(--mds-bottomnav-height) + env(safe-area-inset-bottom, 0) + 1rem);
    right: 1rem;
    z-index: 1020;
    width: var(--mds-fab-size);
    height: var(--mds-fab-size);
    border-radius: 50%;
    background: var(--mds-accent);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(var(--mds-accent-rgb), 0.35);
    cursor: pointer;
    transition: transform var(--mds-transition), box-shadow var(--mds-transition);
    -webkit-tap-highlight-color: transparent;
}

.mds-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(var(--mds-accent-rgb), 0.45);
}

.mds-fab:active {
    transform: scale(0.95);
}

.mds-fab-extended {
    border-radius: 28px;
    width: auto;
    padding: 0 1.25rem;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.mds-fab-mini {
    width: 40px;
    height: 40px;
    font-size: 1.125rem;
}


/* ============================================================================
 * 6. STATUS INDIKATORI
 * ============================================================================ */

/* --- Status tačkica (online/offline/zauzet) --- */
.mds-status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mds-status-dot-sm {
    width: 8px;
    height: 8px;
}

.mds-status-dot-lg {
    width: 14px;
    height: 14px;
}

.mds-status-dot-online {
    background: var(--mds-success);
    box-shadow: 0 0 0 3px var(--mds-success-light);
}

.mds-status-dot-offline {
    background: var(--mds-text-muted);
}

.mds-status-dot-busy {
    background: var(--mds-warning);
    box-shadow: 0 0 0 3px var(--mds-warning-light);
}

.mds-status-dot-urgent {
    background: var(--mds-danger);
    box-shadow: 0 0 0 3px var(--mds-danger-light);
    animation: mds-pulse 2s infinite;
}

@keyframes mds-pulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--mds-danger-light); }
    50% { box-shadow: 0 0 0 6px rgba(var(--mds-danger-rgb), 0.15); }
}

/* --- Status bedževi (stilizovani preko Bootstrap badge klasa) --- */
.mds-status-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.3125rem 0.625rem;
    border-radius: 6px;
    text-transform: uppercase;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.mds-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mds-status-novo {
    background: var(--mds-info-light);
    color: #1e40af;
}
.mds-status-novo::before { background: var(--mds-info); }

.mds-status-priprema {
    background: var(--mds-warning-light);
    color: #92400e;
}
.mds-status-priprema::before { background: var(--mds-warning); }

.mds-status-isporuceno {
    background: var(--mds-success-light);
    color: #065f46;
}
.mds-status-isporuceno::before { background: var(--mds-success); }

.mds-status-otkazano {
    background: var(--mds-danger-light);
    color: #991b1b;
}
.mds-status-otkazano::before { background: var(--mds-danger); }

.mds-status-cekanje {
    background: #f3f4f6;
    color: #4b5563;
}
.mds-status-cekanje::before { background: #9ca3af; }

.mds-status-transport {
    background: var(--mds-accent-light);
    color: #3730a3;
}
.mds-status-transport::before { background: var(--mds-accent); }

.mds-status-preuzeto {
    background: rgba(14, 116, 144, 0.08);
    color: #0e7490;
}
.mds-status-preuzeto::before { background: #0891b2; }


/* ============================================================================
 * 7. STEP PROGRESS (Horizontalni stepper)
 * ============================================================================ */

.mds-steps {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    margin: 0;
    list-style: none;
    counter-reset: step;
}

.mds-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    counter-increment: step;
}

/* Linija između koraka */
.mds-step:not(:first-child)::before {
    content: '';
    position: absolute;
    top: 14px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: var(--mds-border);
    z-index: 0;
}

.mds-step.completed:not(:first-child)::before,
.mds-step.active:not(:first-child)::before {
    background: var(--mds-accent);
}

.mds-step-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--mds-surface-muted);
    color: var(--mds-text-muted);
    border: 2px solid var(--mds-border);
    position: relative;
    z-index: 1;
    transition: all var(--mds-transition);
}

.mds-step.active .mds-step-indicator {
    background: var(--mds-accent);
    color: #fff;
    border-color: var(--mds-accent);
    box-shadow: 0 0 0 4px rgba(var(--mds-accent-rgb), 0.2);
}

.mds-step.completed .mds-step-indicator {
    background: var(--mds-accent);
    color: #fff;
    border-color: var(--mds-accent);
}

.mds-step-label {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--mds-text-muted);
    margin-top: 0.375rem;
    text-align: center;
    white-space: nowrap;
}

.mds-step.active .mds-step-label {
    color: var(--mds-accent);
}

.mds-step.completed .mds-step-label {
    color: var(--mds-text-primary);
}


/* ============================================================================
 * 8. VERTIKALNI TIMELINE (Za praćenje dostave)
 * ============================================================================ */

.mds-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.mds-timeline-item {
    display: flex;
    gap: 0.875rem;
    padding-bottom: 1.5rem;
    position: relative;
}

.mds-timeline-item:last-child {
    padding-bottom: 0;
}

/* Vertikalna linija */
.mds-timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: 0;
    width: 2px;
    background: var(--mds-border);
}

.mds-timeline-item.completed:not(:last-child)::after {
    background: var(--mds-success);
}

.mds-timeline-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
    background: var(--mds-surface-muted);
    color: var(--mds-text-muted);
    border: 2px solid var(--mds-border);
    position: relative;
    z-index: 1;
}

.mds-timeline-item.completed .mds-timeline-marker {
    background: var(--mds-success);
    color: #fff;
    border-color: var(--mds-success);
}

.mds-timeline-item.active .mds-timeline-marker {
    background: var(--mds-accent);
    color: #fff;
    border-color: var(--mds-accent);
    box-shadow: 0 0 0 4px rgba(var(--mds-accent-rgb), 0.2);
}

.mds-timeline-content {
    flex: 1;
    padding-top: 0.25rem;
}

.mds-timeline-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mds-text-primary);
    margin-bottom: 0.125rem;
}

.mds-timeline-time {
    font-size: 0.75rem;
    color: var(--mds-text-muted);
}

.mds-timeline-desc {
    font-size: 0.8125rem;
    color: var(--mds-text-secondary);
    margin-top: 0.25rem;
}


/* ============================================================================
 * 9. KARTICE - Specijalizovane varijante
 * Bootstrap .card koristimo kao bazu, ovo su samo ekstenzije.
 * ============================================================================ */

/* Osnovna MDS kartica */
.mds-card {
    background: var(--mds-surface);
    border: 1px solid var(--mds-border);
    border-radius: var(--mds-radius);
    padding: 1rem 1.125rem;
    box-shadow: var(--mds-shadow-sm);
    transition: box-shadow var(--mds-transition);
}

.mds-card:active {
    box-shadow: var(--mds-shadow-sm);
}

/* Lijeva statusna ivica na kartici */
.mds-card-status-border {
    border-left: 4px solid;
    border-left-color: var(--mds-border);
}

.mds-card-status-border.status-novo { border-left-color: var(--mds-info); }
.mds-card-status-border.status-priprema { border-left-color: var(--mds-warning); }
.mds-card-status-border.status-isporuceno { border-left-color: var(--mds-success); }
.mds-card-status-border.status-otkazano { border-left-color: var(--mds-danger); }
.mds-card-status-border.status-transport { border-left-color: #7c3aed; }
.mds-card-status-border.status-cekanje { border-left-color: #9ca3af; }

/* Quick action kartica (velika ikona, tapni za aktivaciju) */
.mds-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1.25rem 0.75rem;
    background: var(--mds-surface);
    border: 1px solid var(--mds-border);
    border-radius: var(--mds-radius);
    box-shadow: var(--mds-shadow-sm);
    text-decoration: none;
    color: var(--mds-text-primary);
    transition: all var(--mds-transition);
    cursor: pointer;
    min-height: 100px;
    -webkit-tap-highlight-color: transparent;
}

.mds-quick-action:hover {
    border-color: var(--mds-accent);
    color: var(--mds-text-primary);
}

.mds-quick-action:active {
    transform: scale(0.97);
    background: var(--mds-surface-hover);
}

.mds-quick-action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--mds-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.mds-quick-action-label {
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
}

/* Stat kartica */
.mds-stat-card {
    background: var(--mds-surface);
    border: 1px solid var(--mds-border);
    border-radius: var(--mds-radius);
    padding: 1rem;
    height: 100%;
    box-shadow: var(--mds-shadow-sm);
}

.mds-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--mds-text-primary);
}

.mds-stat-label {
    font-size: 0.75rem;
    color: var(--mds-text-secondary);
    font-weight: 500;
    margin-top: 0.125rem;
}

.mds-stat-trend {
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.mds-stat-trend-up { color: var(--mds-success); }
.mds-stat-trend-down { color: var(--mds-danger); }


/* ============================================================================
 * 10. SWIPE ACTION HINTS
 * Vizuelni indikatori za kartice koje se mogu swajpovati
 * ============================================================================ */

.mds-swipeable {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.mds-swipe-action {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    z-index: 0;
}

.mds-swipe-action-left {
    left: 0;
    background: var(--mds-success);
}

.mds-swipe-action-right {
    right: 0;
    background: var(--mds-danger);
}

.mds-swipe-content {
    position: relative;
    z-index: 1;
    background: var(--mds-surface);
    transition: transform var(--mds-transition);
}

.mds-swipe-hint {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.625rem;
    color: var(--mds-text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0.6;
    pointer-events: none;
}


/* ============================================================================
 * 11. SCANNER OVERLAY
 * Placeholder za barcode/QR skener
 * ============================================================================ */

.mds-scanner-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--mds-transition-slow), visibility var(--mds-transition-slow);
}

.mds-scanner-overlay.show {
    opacity: 1;
    visibility: visible;
}

.mds-scanner-viewfinder {
    width: 260px;
    height: 260px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--mds-radius-lg);
    position: relative;
}

/* Uglovi viewfinder-a */
.mds-scanner-viewfinder::before,
.mds-scanner-viewfinder::after {
    content: '';
    position: absolute;
    width: 32px;
    height: 32px;
    border-color: var(--mds-accent);
    border-style: solid;
}
.mds-scanner-viewfinder::before {
    top: -2px;
    left: -2px;
    border-width: 3px 0 0 3px;
    border-radius: var(--mds-radius-sm) 0 0 0;
}
.mds-scanner-viewfinder::after {
    top: -2px;
    right: -2px;
    border-width: 3px 3px 0 0;
    border-radius: 0 var(--mds-radius-sm) 0 0;
}

/* Donji uglovi */
.mds-scanner-corners::before,
.mds-scanner-corners::after {
    content: '';
    position: absolute;
    width: 32px;
    height: 32px;
    border-color: var(--mds-accent);
    border-style: solid;
}
.mds-scanner-corners::before {
    bottom: -2px;
    left: -2px;
    border-width: 0 0 3px 3px;
    border-radius: 0 0 0 var(--mds-radius-sm);
}
.mds-scanner-corners::after {
    bottom: -2px;
    right: -2px;
    border-width: 0 3px 3px 0;
    border-radius: 0 0 var(--mds-radius-sm) 0;
}

/* Skenirajuća linija */
.mds-scanner-line {
    position: absolute;
    left: 8px;
    right: 8px;
    height: 2px;
    background: var(--mds-accent);
    box-shadow: 0 0 8px rgba(var(--mds-accent-rgb), 0.5);
    animation: mds-scan 2.5s ease-in-out infinite;
}

@keyframes mds-scan {
    0%, 100% { top: 8px; }
    50% { top: calc(100% - 10px); }
}

.mds-scanner-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    text-align: center;
}

.mds-scanner-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: var(--mds-touch-min);
    height: var(--mds-touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}


/* ============================================================================
 * 12. PULL-TO-REFRESH INDIKATOR
 * ============================================================================ */

.mds-ptr {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 0;
    overflow: hidden;
    transition: height var(--mds-transition);
    background: var(--mds-surface-muted);
}

.mds-ptr.pulling {
    height: 56px;
}

.mds-ptr-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--mds-border);
    border-top-color: var(--mds-accent);
    border-radius: 50%;
    animation: mds-spin 0.8s linear infinite;
}

@keyframes mds-spin {
    to { transform: rotate(360deg); }
}

.mds-ptr-text {
    font-size: 0.8125rem;
    color: var(--mds-text-secondary);
    margin-left: 0.5rem;
}


/* ============================================================================
 * 13. BOTTOM SHEET (Dopuna Bootstrap offcanvas-bottom)
 * ============================================================================ */

.mds-bottom-sheet .offcanvas-body {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0));
}

/* Ručka za povlačenje na vrhu */
.mds-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--mds-border-strong);
    border-radius: 2px;
    margin: 0.5rem auto 0;
}

/* Bottom sheet stil - veći radius na vrhu */
.mds-bottom-sheet .offcanvas {
    border-radius: var(--mds-radius-xl) var(--mds-radius-xl) 0 0;
}

/* Lista akcija u bottom sheet-u */
.mds-sheet-action {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 0;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--mds-text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
    border-radius: var(--mds-radius-sm);
    transition: background var(--mds-transition);
}

.mds-sheet-action:hover,
.mds-sheet-action:active {
    background: var(--mds-surface-hover);
}

.mds-sheet-action-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mds-radius-sm);
    font-size: 1.125rem;
    flex-shrink: 0;
}

.mds-sheet-action.danger {
    color: var(--mds-danger);
}


/* ============================================================================
 * 14. TOUCH-OPTIMIZED OVERRIDES
 * Minimalna veličina touch targeta = 48px
 * ============================================================================ */

/* Svi dugmad moraju imati minimalan touch target */
/*.mds-app .btn {
    min-height: var(--mds-touch-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-left: 1rem;
    padding-right: 1rem;
    font-weight: 600;
    border-radius: var(--mds-radius-sm);
}

.mds-app .btn-lg {
    min-height: 52px;
    font-size: 1rem;
    border-radius: var(--mds-radius);
}*/

/* Lista stavki sa dovoljno touch prostora */
.mds-app .list-group-item {
    min-height: var(--mds-touch-min);
    display: flex;
    align-items: center;
    border-color: var(--mds-border);
}

/* Form kontrole */
.mds-app .form-control,
.mds-app .form-select {
    min-height: var(--mds-touch-min);
    border-radius: var(--mds-radius-sm);
    border-color: var(--mds-border);
    font-size: 1rem;
}

.mds-app .form-control:focus,
.mds-app .form-select:focus {
    border-color: var(--mds-accent);
    box-shadow: 0 0 0 3px rgba(var(--mds-accent-rgb), 0.15);
}

/* Checkbox/Radio veći za touch */
.mds-app .form-check-input {
    width: 1.375rem;
    height: 1.375rem;
    margin-top: 0;
}

.mds-app .form-check-label {
    padding-left: 0.375rem;
    min-height: var(--mds-touch-min);
    display: flex;
    align-items: center;
}

/* Switch veći za touch */
.mds-app .form-switch .form-check-input {
    width: 2.75rem;
    height: 1.5rem;
}


/* ============================================================================
 * 15. QUANTITY STEPPER
 * +/- dugmad sa brojem između
 * ============================================================================ */

.mds-qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--mds-border);
    border-radius: var(--mds-radius-sm);
    overflow: hidden;
    background: var(--mds-surface);
}

.mds-qty-stepper button {
    width: var(--mds-touch-min);
    height: var(--mds-touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--mds-accent);
    cursor: pointer;
    transition: background var(--mds-transition);
}

.mds-qty-stepper button:hover {
    background: var(--mds-surface-hover);
}

.mds-qty-stepper button:active {
    background: var(--mds-surface-muted);
}

.mds-qty-stepper button:disabled {
    color: var(--mds-text-muted);
    cursor: default;
}

.mds-qty-stepper-value {
    min-width: 48px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--mds-font-mono);
    border-left: 1px solid var(--mds-border);
    border-right: 1px solid var(--mds-border);
    padding: 0 0.5rem;
}


/* ============================================================================
 * 16. SIGNATURE AREA
 * Placeholder za potpis
 * ============================================================================ */

.mds-signature-area {
    border: 2px dashed var(--mds-border-strong);
    border-radius: var(--mds-radius);
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--mds-surface-muted);
    color: var(--mds-text-muted);
    cursor: crosshair;
    touch-action: none;
    position: relative;
}

.mds-signature-area.signed {
    border-style: solid;
    border-color: var(--mds-success);
    background: var(--mds-success-light);
}


/* ============================================================================
 * 17. EMPTY STATE
 * Prazno stanje kada nema podataka
 * ============================================================================ */

.mds-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.mds-empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: var(--mds-surface-muted);
    color: var(--mds-text-muted);
    margin-bottom: 1rem;
}

.mds-empty-state-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--mds-text-primary);
    margin-bottom: 0.375rem;
}

.mds-empty-state-desc {
    font-size: 0.875rem;
    color: var(--mds-text-secondary);
    max-width: 260px;
    margin-bottom: 1.25rem;
}


/* ============================================================================
 * 18. SKELETON LOADING
 * Animirani placeholder za učitavanje
 * ============================================================================ */

.mds-skeleton {
    background: linear-gradient(
        90deg,
        var(--mds-surface-muted) 25%,
        var(--mds-surface-hover) 37%,
        var(--mds-surface-muted) 63%
    );
    background-size: 200% 100%;
    animation: mds-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--mds-radius-sm);
}

@keyframes mds-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.mds-skeleton-text {
    height: 14px;
    margin-bottom: 0.5rem;
}

.mds-skeleton-text:last-child {
    width: 60%;
}

.mds-skeleton-title {
    height: 20px;
    width: 70%;
    margin-bottom: 0.75rem;
}

.mds-skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mds-skeleton-card {
    height: 120px;
    border-radius: var(--mds-radius);
}

.mds-skeleton-btn {
    height: var(--mds-touch-min);
    width: 120px;
    border-radius: var(--mds-radius-sm);
}


/* ============================================================================
 * 19. DIVIDER SA LABELOM
 * ============================================================================ */

.mds-divider-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--mds-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mds-divider-label::before,
.mds-divider-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--mds-border);
}


/* ============================================================================
 * 20. AVATAR SA STATUS TAČKOM
 * ============================================================================ */

.mds-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--mds-accent);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.mds-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mds-avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.mds-avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }

.mds-avatar-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--mds-surface);
}


/* ============================================================================
 * 21. PHOTO GALLERY GRID
 * Za dokaze o isporuci (fotografije)
 * ============================================================================ */

.mds-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.375rem;
}

.mds-photo-grid-item {
    aspect-ratio: 1;
    border-radius: var(--mds-radius-sm);
    overflow: hidden;
    background: var(--mds-surface-muted);
    position: relative;
    cursor: pointer;
}

.mds-photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mds-photo-grid-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    border: 2px dashed var(--mds-border-strong);
    color: var(--mds-text-muted);
    font-size: 0.625rem;
    font-weight: 600;
}

.mds-photo-grid-add i {
    font-size: 1.25rem;
}


/* ============================================================================
 * 22. BARCODE / QR DISPLAY AREA
 * ============================================================================ */

.mds-barcode-display {
    background: #fff;
    border: 1px solid var(--mds-border);
    border-radius: var(--mds-radius-sm);
    padding: 1rem;
    text-align: center;
}

.mds-barcode-value {
    font-family: var(--mds-font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--mds-text-primary);
    margin-top: 0.5rem;
}


/* ============================================================================
 * 23. COUNTDOWN TIMER
 * ============================================================================ */

.mds-countdown {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: var(--mds-font-mono);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--mds-text-primary);
}

.mds-countdown-segment {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mds-countdown-value {
    background: var(--mds-surface-muted);
    border-radius: var(--mds-radius-sm);
    padding: 0.375rem 0.5rem;
    min-width: 44px;
    text-align: center;
}

.mds-countdown-label {
    font-family: var(--mds-font-sans);
    font-size: 0.5625rem;
    font-weight: 600;
    color: var(--mds-text-muted);
    text-transform: uppercase;
    margin-top: 0.125rem;
}

.mds-countdown-separator {
    font-size: 1.25rem;
    color: var(--mds-text-muted);
    padding-bottom: 1rem;
}

.mds-countdown.urgent {
    color: var(--mds-danger);
}

.mds-countdown.urgent .mds-countdown-value {
    background: var(--mds-danger-light);
}


/* ============================================================================
 * 24. BATTERY / SIGNAL STRENGTH
 * ============================================================================ */

.mds-signal-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.mds-signal-bar {
    width: 4px;
    border-radius: 1px;
    background: var(--mds-border-strong);
}

.mds-signal-bar.active {
    background: var(--mds-text-primary);
}

.mds-signal-bar:nth-child(1) { height: 25%; }
.mds-signal-bar:nth-child(2) { height: 50%; }
.mds-signal-bar:nth-child(3) { height: 75%; }
.mds-signal-bar:nth-child(4) { height: 100%; }


/* ============================================================================
 * 25. MAP PLACEHOLDER
 * ============================================================================ */

.mds-map-placeholder {
    background: var(--mds-surface-muted);
    border-radius: var(--mds-radius);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    color: var(--mds-text-muted);
    border: 1px solid var(--mds-border);
    position: relative;
    overflow: hidden;
}

.mds-map-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 20px,
            var(--mds-border) 20px,
            var(--mds-border) 21px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 20px,
            var(--mds-border) 20px,
            var(--mds-border) 21px
        );
    opacity: 0.3;
}


/* ============================================================================
 * 26. SECTION HEADER
 * ============================================================================ */

.mds-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
}

.mds-section-title {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mds-text-secondary);
}


/* ============================================================================
 * 27. SEARCH BAR SA SCAN DUGMETOM
 * ============================================================================ */

.mds-search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--mds-surface);
    border: 1px solid var(--mds-border);
    border-radius: var(--mds-radius);
    padding: 0 0.75rem;
    transition: border-color var(--mds-transition), box-shadow var(--mds-transition);
}

.mds-search-bar:focus-within {
    border-color: var(--mds-accent);
    box-shadow: 0 0 0 3px rgba(var(--mds-accent-rgb), 0.15);
}

.mds-search-bar input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    height: var(--mds-touch-min);
    font-size: 0.9375rem;
    color: var(--mds-text-primary);
}

.mds-search-bar input::placeholder {
    color: var(--mds-text-muted);
}

.mds-search-bar-icon {
    color: var(--mds-text-muted);
    font-size: 1.125rem;
    flex-shrink: 0;
}

.mds-search-bar-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--mds-accent);
    color: #fff;
    border-radius: var(--mds-radius-sm);
    font-size: 1.125rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--mds-transition);
}

.mds-search-bar-btn:hover {
    background: var(--mds-accent-hover);
}


/* ============================================================================
 * 28. CONTACT CARD
 * ============================================================================ */

.mds-contact-action {
    width: var(--mds-touch-min);
    height: var(--mds-touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--mds-border);
    background: var(--mds-surface);
    color: var(--mds-accent);
    font-size: 1.125rem;
    cursor: pointer;
    transition: all var(--mds-transition);
    text-decoration: none;
    flex-shrink: 0;
}

.mds-contact-action:hover {
    background: var(--mds-accent);
    color: #fff;
    border-color: var(--mds-accent);
}


/* ============================================================================
 * 29. KEY-VALUE PAIR DISPLAY
 * ============================================================================ */

.mds-kv-pair {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--mds-border);
}

.mds-kv-pair:last-child {
    border-bottom: none;
}

.mds-kv-key {
    font-size: 0.8125rem;
    color: var(--mds-text-secondary);
    flex-shrink: 0;
    padding-right: 1rem;
}

.mds-kv-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mds-text-primary);
    text-align: right;
}


/* ============================================================================
 * 30. PRIORITY INDICATOR
 * ============================================================================ */

.mds-priority {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mds-priority-high {
    color: var(--mds-danger);
}

.mds-priority-medium {
    color: var(--mds-warning);
}

.mds-priority-low {
    color: var(--mds-success);
}


/* ============================================================================
 * 31. FRAGILE / SPECIAL HANDLING INDICATOR
 * ============================================================================ */

.mds-handling-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mds-handling-fragile {
    background: var(--mds-warning-light);
    color: #92400e;
    border: 1px solid rgba(217, 119, 6, 0.25);
}

.mds-handling-heavy {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.mds-handling-cold {
    background: var(--mds-info-light);
    color: #1e40af;
    border: 1px solid rgba(37, 99, 235, 0.25);
}


/* ============================================================================
 * 32. SPINNER OVERLAY
 * ============================================================================ */

.mds-spinner-overlay {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(var(--mds-bg-rgb), 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    backdrop-filter: blur(4px);
}

.mds-spinner-overlay-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mds-text-secondary);
}


/* ============================================================================
 * 33. SEGMENTED CONTROL (Bootstrap nav-pills dopuna)
 * ============================================================================ */

.mds-segmented .nav-link {
    min-height: 40px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mds-text-secondary);
    border-radius: var(--mds-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
}

.mds-segmented .nav-link.active {
    background: var(--mds-accent);
    color: #fff;
}

.mds-segmented {
    background: var(--mds-surface-muted);
    border-radius: var(--mds-radius);
    padding: 0.25rem;
}


/* ============================================================================
 * 34. SHOWCASE UTILITY KLASE (samo za demo stranicu)
 * ============================================================================ */

.showcase-device-frame {
    max-width: 430px;
    margin: 0 auto;
    background: var(--mds-bg);
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.15);
    overflow-x: hidden;
}

@media (min-width: 431px) {
    .showcase-device-frame {
        border-left: 1px solid #ddd;
        border-right: 1px solid #ddd;
    }
}

.showcase-section {
    padding: 1.5rem 1rem;
    border-bottom: 6px solid var(--mds-surface-muted);
}

.showcase-section-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mds-accent);
    margin-bottom: 0.375rem;
}

.showcase-section-desc {
    font-size: 0.8125rem;
    color: var(--mds-text-secondary);
    margin-bottom: 1.25rem;
}

.showcase-subsection {
    margin-bottom: 1.25rem;
}

.showcase-subsection-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mds-text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--mds-border);
}

/* Swatch za boje */
.showcase-swatch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.showcase-swatch-color {
    width: 48px;
    height: 48px;
    border-radius: var(--mds-radius-sm);
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.08);
}

.showcase-swatch-name {
    font-size: 0.8125rem;
    font-weight: 600;
}

.showcase-swatch-value {
    font-size: 0.75rem;
    font-family: var(--mds-font-mono);
    color: var(--mds-text-muted);
}


/* ============================================================================
 * 35. BG-LABEL UTILITY KLASE
 * Blagi pozadinski bedževi sa odgovarajućom bojom teksta.
 * Zamjena za Sneat vendor bg-label-* klase (core.css).
 * Koriste ih StatusBadge, InterniLista i druge dijeljene komponente.
 * ============================================================================ */
.bg-label-primary {
    background-color: rgba(var(--mds-info-rgb), 0.12) !important;
    color: var(--mds-info) !important;
}
.bg-label-secondary {
    background-color: rgba(100, 116, 139, 0.12) !important;
    color: #64748b !important;
}
.bg-label-success {
    background-color: rgba(var(--mds-success-rgb), 0.12) !important;
    color: var(--mds-success) !important;
}
.bg-label-warning {
    background-color: rgba(var(--mds-warning-rgb), 0.12) !important;
    color: var(--mds-warning) !important;
}
.bg-label-danger {
    background-color: rgba(var(--mds-danger-rgb), 0.12) !important;
    color: var(--mds-danger) !important;
}
.bg-label-info {
    background-color: rgba(var(--mds-info-rgb), 0.12) !important;
    color: var(--mds-info) !important;
}
.bg-label-dark {
    background-color: rgba(15, 23, 42, 0.12) !important;
    color: #0f172a !important;
}


/* ============================================================================
 * 36. VENDOR UTILITY KLASE
 * Zamjena za Sneat utility klase koje koriste dijeljene komponente.
 * ============================================================================ */
.badge-center {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.h-px-20 { height: 20px !important; }
.w-px-20 { width: 20px !important; }

.bg-glow {
    box-shadow: 0 2px 8px rgba(var(--mds-danger-rgb), 0.4);
}


/* ============================================================================
 * 37. BOOTSTRAP ACCORDION — MDS OVERRIDE
 * Bootstrap accordion prilagođen MDS dizajn sistemu.
 * ============================================================================ */
.mds-app .accordion {
    --bs-accordion-border-color: var(--mds-border);
    --bs-accordion-border-radius: var(--mds-radius);
    --bs-accordion-inner-border-radius: var(--mds-radius-sm);
    --bs-accordion-btn-padding-x: 1rem;
    --bs-accordion-btn-padding-y: 0.875rem;
    --bs-accordion-active-bg: var(--mds-surface);
    --bs-accordion-active-color: var(--mds-text-primary);
    --bs-accordion-btn-bg: var(--mds-surface);
    --bs-accordion-bg: var(--mds-surface);
    --bs-accordion-body-padding-x: 0.75rem;
    --bs-accordion-body-padding-y: 0.75rem;
    border-radius: var(--mds-radius);
    overflow: hidden;
    box-shadow: var(--mds-shadow-sm);
}
.mds-app .accordion-item {
    border-color: var(--mds-border);
}
.mds-app .accordion-item:first-of-type {
    border-top-left-radius: var(--mds-radius);
    border-top-right-radius: var(--mds-radius);
}
.mds-app .accordion-item:last-of-type {
    border-bottom-left-radius: var(--mds-radius);
    border-bottom-right-radius: var(--mds-radius);
}
.mds-app .accordion-button {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--mds-text-primary);
}
.mds-app .accordion-button:not(.collapsed) {
    background: var(--mds-surface);
    color: var(--mds-text-primary);
    box-shadow: none;
    border-bottom: 1px solid var(--mds-border);
}
.mds-app .accordion-button:focus {
    box-shadow: none;
    border-color: var(--mds-border);
}
.mds-app .accordion-body {
    padding: 0.75rem;
    background: var(--mds-surface-muted);
}

/* Alert unutar accordiona — MDS kartica sa accent lijevom ivicom */
.mds-app .accordion-body .alert.alert-primary {
    background: var(--mds-surface);
    border: 1px solid var(--mds-border);
    border-left: 4px solid var(--mds-accent);
    border-radius: var(--mds-radius-sm);
    color: var(--mds-text-primary);
    box-shadow: var(--mds-shadow-sm);
    margin-bottom: 0.75rem;
}
.mds-app .accordion-body .alert.alert-primary .border-top {
    border-color: var(--mds-border) !important;
}


/* ============================================================================
 * 38. CITY GROUP — Accordion za grupisane liste (gradovi, poslovnice)
 * ============================================================================ */
.city-group { margin-bottom: 0.5rem; }
.city-group-card {
    background: var(--mds-surface); border: 1px solid var(--mds-border);
    border-radius: var(--mds-radius); overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.city-group-header {
    padding: 0.75rem 1rem; display: flex; align-items: center;
    justify-content: space-between; cursor: pointer;
    transition: background 0.15s; user-select: none;
}
.city-group-header:hover { background: var(--mds-surface-hover); }
.city-group-name { font-size: 0.9375rem; font-weight: 700; color: var(--mds-text-primary); }
.city-group-right { display: flex; align-items: center; gap: 0.5rem; }
.city-group-count {
    font-family: var(--mds-font-mono); font-size: 0.75rem; font-weight: 700;
    background: rgba(79,70,229,0.08); color: var(--mds-accent);
    padding: 0.1875rem 0.5rem; border-radius: 6px;
}
.city-group-chevron { font-size: 0.75rem; color: var(--mds-text-muted); transition: transform 0.2s; }
.city-group-header[aria-expanded="true"] .city-group-chevron { transform: rotate(180deg); }
.city-group-body { border-top: 1px solid var(--mds-border); }


/* ============================================================================
 * 39. DELIVERY CARD — Kartica za pošiljku/dostavu/interni u listama
 * ============================================================================ */
.delivery-card {
    padding: 1rem; margin: 0.5rem 0.75rem;
    background: var(--mds-surface); border: 1px solid var(--mds-border);
    border-radius: var(--mds-radius-sm); transition: background 0.15s; cursor: pointer;
}
.delivery-card:first-child { margin-top: 0.75rem; }
.delivery-card:last-child { margin-bottom: 0.75rem; }
.delivery-card:active { background: var(--mds-surface-hover); }

.delivery-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.625rem; gap: 0.375rem; }
.delivery-card-top-left { display: flex; align-items: center; gap: 0.375rem; }
.delivery-card-type { font-size: 0.875rem; color: var(--mds-text-muted); }
.delivery-card-date { font-size: 0.6875rem; color: var(--mds-text-muted); font-family: var(--mds-font-mono); }
.delivery-card-items {
    font-size: 0.6875rem; font-weight: 600; color: var(--mds-text-secondary);
    display: flex; align-items: center; gap: 0.25rem;
    background: var(--mds-surface-muted); padding: 0.125rem 0.4375rem; border-radius: 6px;
}
.delivery-card-items i { font-size: 0.5625rem; }

/* Ruta: origin dot → dashed → dest dot */
.delivery-route { margin-bottom: 0.5rem; padding-left: 0.125rem; display: flex; flex-direction: column; gap: 0.5rem; }
.delivery-route-stop { display: flex; align-items: flex-start; gap: 0.625rem; }
.delivery-route-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 0.1875rem; position: relative; }
.delivery-route-dot.origin { background: var(--mds-accent); }
.delivery-route-dot.origin::after {
    content: ''; position: absolute; top: 12px; left: 3.5px; width: 0;
    border-left: 2px dashed var(--mds-border); height: calc(100% + 44px); min-height: 50px;
}
.delivery-route-dot.dest { background: var(--mds-success); }
.delivery-route-connector { display: none; }
.delivery-route-text { flex: 1; min-width: 0; }
.delivery-route-label { font-size: 0.5625rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mds-text-muted); line-height: 1.2; }
.delivery-route-name { font-size: 0.8125rem; font-weight: 700; color: var(--mds-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.delivery-route-address { font-size: 0.75rem; color: var(--mds-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }

/* Napomena na kartici */
.delivery-card-note {
    display: flex; align-items: flex-start; gap: 0.375rem;
    background: var(--mds-warning-light); border-radius: 6px;
    padding: 0.375rem 0.5rem; margin-top: 0.375rem; margin-bottom: 0.25rem;
    font-size: 0.6875rem; color: #92400e; font-weight: 500; line-height: 1.35;
}
.delivery-card-note i { color: var(--mds-warning); flex-shrink: 0; margin-top: 0.0625rem; font-size: 0.625rem; }

/* Footer */
.delivery-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 0.5rem; border-top: 1px solid var(--mds-border); }
.delivery-card-meta { display: flex; flex-direction: column; gap: 0.1875rem; }
.delivery-card-amount { font-family: var(--mds-font-mono); font-size: 0.8125rem; font-weight: 700; color: var(--mds-danger); }
.delivery-card-time { font-size: 0.6875rem; font-weight: 600; color: var(--mds-warning); }
.delivery-card-time i { margin-right: 0.1875rem; }
.delivery-card-actions { display: flex; gap: 0.375rem; }
.delivery-card-action {
    width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid var(--mds-border); background: var(--mds-surface);
    color: var(--mds-text-secondary); display: flex; align-items: center;
    justify-content: center; font-size: 0.9375rem; cursor: pointer;
    text-decoration: none; transition: all 0.15s;
}
.delivery-card-action.accept { background: var(--mds-success); border-color: var(--mds-success); color: #fff; }
.delivery-card-action.reject { border-color: var(--mds-danger); color: var(--mds-danger); }
.delivery-card-action.info { border-color: var(--mds-accent); color: var(--mds-accent); }

/* Empty state za liste */
.ponude-empty { text-align: center; padding: 3rem 1.5rem; }
.ponude-empty-icon {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--mds-surface-muted); color: var(--mds-text-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; margin: 0 auto 1rem;
}


/* ============================================================================
 * 40. DETAIL SECTION CARD — Kartica sa headerom za detalj stranice
 * ============================================================================ */
.detail-section { margin-bottom: 0.75rem; }
.detail-section-card {
    background: var(--mds-surface); border: 1px solid var(--mds-border);
    border-radius: var(--mds-radius); overflow: hidden;
    box-shadow: var(--mds-shadow-sm);
}
.detail-section-header {
    padding: 0.75rem 1rem; display: flex; align-items: center;
    gap: 0.5rem; border-bottom: 1px solid var(--mds-border);
}
.detail-section-header i { color: var(--mds-accent); font-size: 1rem; }
.detail-section-header span { font-size: 0.875rem; font-weight: 700; color: var(--mds-text-primary); }
.detail-section-body { padding: 0.875rem 1rem; }

/* Napomena */
.customer-note {
    display: flex; align-items: flex-start; gap: 0.625rem;
    background: var(--mds-warning-light); border: 1px solid rgba(217,119,6,0.2);
    border-radius: var(--mds-radius-sm); padding: 0.75rem;
}
.customer-note i { color: var(--mds-warning); font-size: 1rem; flex-shrink: 0; margin-top: 0.0625rem; }
.customer-note span { font-size: 0.8125rem; color: #92400e; font-weight: 500; }


/* ============================================================================
 * 41. ARTICLE ITEM — Artikal stavka u detalj listama
 * ============================================================================ */
.article-item {
    display: flex; gap: 0.75rem; padding: 0.75rem 0;
    border-bottom: 1px solid var(--mds-border);
}
.article-item:last-child { border-bottom: none; }
.article-img {
    width: 56px; height: 56px; border-radius: 10px;
    background: var(--mds-surface-muted); overflow: hidden; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.article-img img { width: 100%; height: 100%; object-fit: contain; }
.article-body { flex: 1; min-width: 0; }
.article-name {
    font-size: 0.8125rem; font-weight: 600; color: var(--mds-text-primary);
    line-height: 1.35; margin-bottom: 0.375rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.article-meta {
    display: flex; flex-wrap: wrap; gap: 0.5rem 1rem;
    font-size: 0.75rem; color: var(--mds-text-muted);
}
.article-meta-value {
    font-family: var(--mds-font-mono); font-weight: 600; color: var(--mds-text-primary);
}
.article-qty-highlight {
    display: inline-flex; align-items: center; gap: 0.375rem;
    margin-top: 0.375rem; padding: 0.25rem 0.625rem;
    background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px; font-family: var(--mds-font-mono);
    font-size: 0.8125rem; font-weight: 800; color: var(--mds-danger);
}
.article-qty-highlight i { font-size: 0.75rem; }


/* ============================================================================
 * DARK MODE - preko Bootstrap data-bs-theme="dark"
 * Prepisujemo MDS varijable za tamnu temu
 * ============================================================================ */

[data-bs-theme="dark"] {
    --mds-primary: #e2e8f0;
    --mds-surface: #1e293b;
    --mds-surface-elevated: #273548;
    --mds-surface-muted: #162032;
    --mds-surface-hover: #334155;
    --mds-bg: #0f172a;
    --mds-bg-rgb: 15, 23, 42;

    --mds-text-primary: #f1f5f9;
    --mds-text-secondary: #94a3b8;
    --mds-text-muted: #64748b;
    --mds-text-inverse: #0f172a;

    --mds-border: #293548;
    --mds-border-strong: #3b4f66;

    --mds-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --mds-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);
    --mds-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    --mds-shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.25);

    /* Statusne boje za tamnu temu */
    --mds-accent-light: rgba(79, 70, 229, 0.15);
    --mds-success-light: rgba(5, 150, 105, 0.15);
    --mds-warning-light: rgba(217, 119, 6, 0.15);
    --mds-danger-light: rgba(220, 38, 38, 0.15);
    --mds-info-light: rgba(37, 99, 235, 0.15);

    /* Bootstrap variable bridge — dark mode */
    --bs-body-color: var(--mds-text-primary);
    --bs-body-bg: var(--mds-bg);
    --bs-secondary-color: var(--mds-text-secondary);
    --bs-tertiary-color: var(--mds-text-muted);
    --bs-border-color: var(--mds-border);
    --bs-card-bg: var(--mds-surface);
    --bs-card-border-color: var(--mds-border);
}

/* Dark mode: bg-label varijante */
[data-bs-theme="dark"] .bg-label-primary { background-color: rgba(96, 165, 250, 0.15) !important; color: #93c5fd !important; }
[data-bs-theme="dark"] .bg-label-secondary { background-color: rgba(148, 163, 184, 0.15) !important; color: #cbd5e1 !important; }
[data-bs-theme="dark"] .bg-label-success { background-color: rgba(52, 211, 153, 0.15) !important; color: #6ee7b7 !important; }
[data-bs-theme="dark"] .bg-label-warning { background-color: rgba(251, 191, 36, 0.15) !important; color: #fcd34d !important; }
[data-bs-theme="dark"] .bg-label-danger { background-color: rgba(248, 113, 113, 0.15) !important; color: #fca5a5 !important; }
[data-bs-theme="dark"] .bg-label-info { background-color: rgba(96, 165, 250, 0.15) !important; color: #93c5fd !important; }
[data-bs-theme="dark"] .bg-label-dark { background-color: rgba(203, 213, 225, 0.15) !important; color: #e2e8f0 !important; }

/* Dark mode: accordion */
[data-bs-theme="dark"] .accordion-body .alert.alert-primary {
    background: var(--mds-surface);
    border-color: var(--mds-border);
    border-left-color: var(--mds-accent);
    color: var(--mds-text-primary);
}

/* Dark mode specifične korekcije */
[data-bs-theme="dark"] .mds-topbar {
    background-color: var(--mds-surface);
    border-bottom-color: var(--mds-border);
}

[data-bs-theme="dark"] .mds-bottomnav {
    background-color: var(--mds-surface);
    border-top-color: var(--mds-border);
}

[data-bs-theme="dark"] .mds-counter {
    border-color: var(--mds-surface);
}

[data-bs-theme="dark"] .mds-card,
[data-bs-theme="dark"] .mds-stat-card,
[data-bs-theme="dark"] .mds-quick-action {
    background: var(--mds-surface);
    border-color: var(--mds-border);
    box-shadow: none;
}

[data-bs-theme="dark"] .mds-search-bar {
    background: var(--mds-surface);
    border-color: var(--mds-border);
}

[data-bs-theme="dark"] .mds-search-bar input {
    color: var(--mds-text-primary);
}

[data-bs-theme="dark"] .mds-barcode-display {
    background: var(--mds-surface-elevated);
    border-color: var(--mds-border);
}

[data-bs-theme="dark"] .mds-signature-area {
    background: var(--mds-surface-muted);
    border-color: var(--mds-border-strong);
}

[data-bs-theme="dark"] .mds-qty-stepper {
    background: var(--mds-surface);
    border-color: var(--mds-border);
}

[data-bs-theme="dark"] .mds-status-novo {
    background: rgba(8, 145, 178, 0.15);
    color: #67e8f9;
}

[data-bs-theme="dark"] .mds-status-priprema {
    background: rgba(217, 119, 6, 0.15);
    color: #fbbf24;
}

[data-bs-theme="dark"] .mds-status-isporuceno {
    background: rgba(5, 150, 105, 0.15);
    color: #34d399;
}

[data-bs-theme="dark"] .mds-status-otkazano {
    background: rgba(220, 38, 38, 0.15);
    color: #f87171;
}

[data-bs-theme="dark"] .mds-status-cekanje {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
}

[data-bs-theme="dark"] .mds-status-transport {
    background: rgba(124, 58, 237, 0.15);
    color: #a78bfa;
}

[data-bs-theme="dark"] .mds-status-preuzeto {
    background: rgba(2, 132, 199, 0.15);
    color: #38bdf8;
}

[data-bs-theme="dark"] .mds-handling-fragile {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
}

[data-bs-theme="dark"] .mds-handling-heavy {
    background: rgba(156, 163, 175, 0.15);
    color: #d1d5db;
    border-color: rgba(156, 163, 175, 0.3);
}

[data-bs-theme="dark"] .mds-handling-cold {
    background: rgba(34, 211, 238, 0.15);
    color: #22d3ee;
    border-color: rgba(34, 211, 238, 0.3);
}

[data-bs-theme="dark"] .mds-skeleton {
    background: linear-gradient(
        90deg,
        var(--mds-surface-muted) 25%,
        var(--mds-surface-hover) 37%,
        var(--mds-surface-muted) 63%
    );
    background-size: 200% 100%;
}

[data-bs-theme="dark"] .mds-segmented {
    background: var(--mds-surface-muted);
}

/* Dark mode za showcase */
[data-bs-theme="dark"] .showcase-swatch-color {
    border-color: rgba(255,255,255,0.08);
}

[data-bs-theme="dark"] .showcase-device-frame {
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

@media (min-width: 431px) {
    [data-bs-theme="dark"] .showcase-device-frame {
        border-color: #334155;
    }
}

/* Dark mode: City Group */
[data-bs-theme="dark"] .city-group-count { background: rgba(129,140,248,0.12); color: #818cf8; }
[data-bs-theme="dark"] .city-group-card { box-shadow: none; }

/* Dark mode: Delivery Card */
[data-bs-theme="dark"] .delivery-card { background: var(--mds-surface); border-color: var(--mds-border); }
[data-bs-theme="dark"] .delivery-card-action.accept { background: var(--mds-success); border-color: var(--mds-success); }
[data-bs-theme="dark"] .delivery-card-action.info { border-color: #818cf8; color: #818cf8; }
[data-bs-theme="dark"] .delivery-card-note { background: rgba(217,119,6,0.12); color: #fbbf24; }
[data-bs-theme="dark"] .ponude-empty-icon { background: rgba(255,255,255,0.06); }

/* Dark mode: Detail Section Card */
[data-bs-theme="dark"] .detail-section-card { box-shadow: none; }
[data-bs-theme="dark"] .detail-section-header i { color: #818cf8; }
[data-bs-theme="dark"] .customer-note { background: rgba(217,119,6,0.12); border-color: rgba(217,119,6,0.2); }
[data-bs-theme="dark"] .customer-note span { color: #fbbf24; }
[data-bs-theme="dark"] .article-qty-highlight { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.25); color: #f87171; }
