/* --- GLOBALNI KONTEJNER (MAX SPECIFICITY) --- */
#ffv-file-viewer-app.ffv-main-container {
    width: 100% !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    margin-bottom: 20px !important;
    box-sizing: border-box !important;
    background: transparent !important;
}
#ffv-file-viewer-app * {
    box-sizing: border-box !important;
}

/* --- TOP BAR I KONTROLE --- */
#ffv-file-viewer-app .ffv-top-bar {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    margin-bottom: 20px !important;
    background: #f8f9fa !important;
    padding: 15px !important;
    border-radius: 8px !important;
    border: 1px solid #dcdcde !important;
}
#ffv-file-viewer-app .ffv-breadcrumbs {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #555 !important;
    margin: 0 !important;
    padding: 0 !important;
}
#ffv-file-viewer-app .ffv-bc-link {
    color: #2271b1 !important;
    text-decoration: none !important;
    padding: 3px 6px !important;
    border-radius: 4px !important;
    transition: background 0.2s !important;
    box-shadow: none !important;
}
#ffv-file-viewer-app .ffv-bc-link:hover {
    background: #e0e0e1 !important;
}
#ffv-file-viewer-app .ffv-controls {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}
#ffv-file-viewer-app .ffv-search-input {
    flex-grow: 1 !important;
    padding: 8px 12px !important;
    border: 1px solid #8c8f94 !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    line-height: normal !important;
    background: #fff !important;
    color: #222 !important; /* ISPRAVLJENO: Crni tekst unutar pretrage */
    min-height: 36px !important;
    margin: 0 !important;
    box-shadow: none !important;
}
#ffv-file-viewer-app .ffv-search-input:focus {
    border-color: #2271b1 !important;
    box-shadow: 0 0 0 1px #2271b1 !important;
    outline: none !important;
}

/* --- WRAPPER I GRID SISTEM --- */
#ffv-file-viewer-app .ffv-wrapper {
    width: 100% !important;
    position: relative !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}
#ffv-file-viewer-app .ffv-wrapper.ffv-layout-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 20px !important;
    align-items: stretch !important;
}
#ffv-file-viewer-app .ffv-wrapper.ffv-layout-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}
#ffv-file-viewer-app .ffv-wrapper.ffv-layout-compact {
    display: flex !important;
    flex-direction: column !important;
    border: 1px solid #dcdcde !important;
    border-radius: 8px !important;
    background: #fff !important;
    overflow: hidden !important;
}

/* --- POJEDINAČNI ELEMENTI (KARTICE) --- */
#ffv-file-viewer-app .ffv-item {
    position: relative !important;
    background: #fff !important;
    border: 1px solid #dcdcde !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
}
#ffv-file-viewer-app .ffv-item:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.08) !important;
    border-color: #c3c4c7 !important;
}

/* Specifičnosti za Grid */
#ffv-file-viewer-app .ffv-layout-grid .ffv-item {
    display: flex !important;
    flex-direction: column !important;
    padding: 20px !important;
    text-align: center !important;
}
/* Specifičnosti za List */
#ffv-file-viewer-app .ffv-layout-list .ffv-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 15px 20px !important;
    gap: 20px !important;
}
/* Specifičnosti za Compact */
#ffv-file-viewer-app .ffv-layout-compact .ffv-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 10px 15px !important;
    border: none !important;
    border-bottom: 1px solid #f0f0f1 !important;
    border-radius: 0 !important;
}
#ffv-file-viewer-app .ffv-layout-compact .ffv-item:last-child { border-bottom: none !important; }

/* --- IKONE I FALLBACK --- */
#ffv-file-viewer-app .ffv-icon-wrap {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}
#ffv-file-viewer-app .ffv-layout-grid .ffv-icon-wrap { width: 64px !important; height: 64px !important; margin: 0 auto 15px !important; }
#ffv-file-viewer-app .ffv-layout-list .ffv-icon-wrap { width: 48px !important; height: 48px !important; }
#ffv-file-viewer-app .ffv-layout-compact .ffv-icon-wrap { width: 24px !important; height: 24px !important; margin-right: 15px !important; }

#ffv-file-viewer-app .ffv-icon-wrap img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    display: block !important;
}
#ffv-file-viewer-app .ffv-icon-fallback {
    width: 100% !important;
    height: 100% !important;
    background: #f0f0f1 !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    color: #646970 !important;
    text-transform: uppercase !important;
    border: 1px solid #dcdcde !important;
    margin: 0 !important;
}
#ffv-file-viewer-app .ffv-layout-grid .ffv-icon-fallback { font-size: 16px !important; }
#ffv-file-viewer-app .ffv-layout-list .ffv-icon-fallback { font-size: 13px !important; }
#ffv-file-viewer-app .ffv-layout-compact .ffv-icon-fallback { font-size: 9px !important; border-radius: 4px !important; }

/* --- METADATA I TEKST --- */
#ffv-file-viewer-app .ffv-meta {
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    min-width: 0 !important;
}
#ffv-file-viewer-app .ffv-layout-grid .ffv-meta { align-items: center !important; text-align: center !important; }
#ffv-file-viewer-app .ffv-layout-compact .ffv-meta { flex-direction: row !important; justify-content: space-between !important; align-items: center !important; gap: 15px !important; }

#ffv-file-viewer-app .ffv-name {
    font-weight: 600 !important;
    font-size: 14px !important;
    color: #1d2327 !important;
    word-break: break-word !important;
    margin-bottom: 5px !important;
    line-height: 1.3 !important;
}
#ffv-file-viewer-app .ffv-layout-compact .ffv-name { margin-bottom: 0 !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; flex-grow: 1 !important; }

#ffv-file-viewer-app .ffv-meta-sub {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    font-size: 12px !important;
    color: #646970 !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}
#ffv-file-viewer-app .ffv-layout-list .ffv-meta-sub { justify-content: flex-start !important; }

#ffv-file-viewer-app .ffv-sep { color: #ccc !important; }
#ffv-file-viewer-app .ffv-size { background: #f0f0f1 !important; padding: 2px 6px !important; border-radius: 4px !important; font-weight: 500 !important; }
#ffv-file-viewer-app .ffv-stats { font-size: 11px !important; color: #8c8f94 !important; margin-top: 8px !important; display: block !important; }

/* --- GUMBI (AKCIJE) --- */
#ffv-file-viewer-app .ffv-actions {
    display: flex !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}
#ffv-file-viewer-app .ffv-layout-grid .ffv-actions { margin-top: 20px !important; width: 100% !important; justify-content: center !important; }
#ffv-file-viewer-app .ffv-layout-compact .ffv-actions { gap: 5px !important; }

#ffv-file-viewer-app .ffv-btn {
    text-decoration: none !important;
    font-size: 13px !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    font-weight: 500 !important;
    text-align: center !important;
    cursor: pointer !important;
    border: none !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    display: inline-block !important;
    transition: background 0.2s, color 0.2s !important;
    box-shadow: none !important;
}
#ffv-file-viewer-app .ffv-layout-grid .ffv-btn { flex: 1 !important; }
#ffv-file-viewer-app .ffv-layout-compact .ffv-btn { padding: 4px 8px !important; font-size: 11px !important; }

#ffv-file-viewer-app .ffv-view { background: #f0f0f1 !important; color: #2271b1 !important; border: 1px solid #2271b1 !important; }
#ffv-file-viewer-app .ffv-view:hover { background: #f6f7f7 !important; color: #135e96 !important; border-color: #135e96 !important; }

#ffv-file-viewer-app .ffv-download { background: #2271b1 !important; color: #fff !important; }
#ffv-file-viewer-app .ffv-download:hover { background: #135e96 !important; }

#ffv-file-viewer-app .ffv-open-folder { background: #00a32a !important; color: #fff !important; width: 100% !important; }
#ffv-file-viewer-app .ffv-open-folder:hover { background: #008a20 !important; }

/* Obavijesti */
#ffv-file-viewer-app .ffv-error { color: #d63638 !important; font-weight: bold !important; padding: 12px !important; border-left: 4px solid #d63638 !important; background: #fcf0f1 !important; border-radius: 4px !important; }
#ffv-file-viewer-app .ffv-notice { padding: 12px !important; border-left: 4px solid #f0b849 !important; background: #fff8e5 !important; border-radius: 4px !important; color: #555 !important; }

/* Paginacija */
#ffv-file-viewer-app .ffv-pagination { display: flex !important; gap: 5px !important; justify-content: center !important; margin-top: 25px !important; flex-wrap: wrap !important; }
#ffv-file-viewer-app .ffv-page-btn { padding: 6px 12px !important; border: 1px solid #dcdcde !important; background: #fff !important; cursor: pointer !important; border-radius: 4px !important; font-size: 13px !important; color: #2271b1 !important; margin: 0 !important; }
#ffv-file-viewer-app .ffv-page-btn:hover { background: #f0f0f1 !important; }
#ffv-file-viewer-app .ffv-page-btn.active { background: #2271b1 !important; color: #fff !important; border-color: #2271b1 !important; }

/* --- SKRIVANJE ELEMENATA (KLJUČNO ZA PAGINACIJU) --- */
#ffv-file-viewer-app .ffv-hidden,
#ffv-file-viewer-app .ffv-wrapper .ffv-item.ffv-hidden,
#ffv-modal.ffv-hidden,
.ffv-hidden {
    display: none !important;
}

/* --- POPUP MODAL I ZABRANA SKROLANJA --- */
body.ffv-modal-open {
    overflow: hidden !important; 
}

#ffv-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important; 
    height: 100vh !important;
    z-index: 2147483647 !important; 
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.ffv-modal-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(8px) !important; 
}

.ffv-modal-content {
    position: relative !important;
    width: 90% !important;
    max-width: 1000px !important;
    height: 85vh !important;
    background: #fff !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
    z-index: 10 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important; 
}

.ffv-modal-close {
    position: absolute !important; 
    top: -15px !important;
    right: -15px !important;
    background: #d63638 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
    font-size: 20px !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 32px !important;
    text-align: center !important;
    padding: 0 !important;
    cursor: pointer !important;
    border-radius: 50% !important;
    z-index: 9999999 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
    transition: transform 0.2s, background 0.2s !important;
}

.ffv-modal-close:hover {
    background: #b32d2f !important;
    transform: scale(1.1) !important;
}

.ffv-modal-loader {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 16px !important;
    color: #666 !important;
    z-index: 5 !important;
}

#ffv-modal-iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    position: relative !important;
    z-index: 10 !important;
    background: #fff !important;
    border-radius: 8px !important;
}

#ffv-modal-html-content {
    width: 100% !important;
    height: 100% !important;
    overflow-y: auto !important;
    background: #f9f9f9 !important;
    padding: 40px !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 10 !important;
    border-radius: 8px !important;
}

#ffv-modal-html-content p {
    margin-bottom: 15px !important;
    line-height: 1.6 !important;
    color: #333 !important;
}

#ffv-modal-html-content table {
    border-collapse: collapse !important;
    width: 100% !important;
    margin-top: 20px !important;
    font-size: 13px !important;
}

#ffv-modal-html-content th, #ffv-modal-html-content td {
    border: 1px solid #ccc !important;
    padding: 8px !important;
    text-align: left !important;
}

#ffv-modal-html-content th {
    background-color: #f0f0f1 !important;
    font-weight: bold !important;
}